mirror of
				git://git.code.sf.net/p/cdesktopenv/code
				synced 2025-03-09 15:50:02 +00:00 
			
		
		
		
	Fix 'printf %T' ignoring the current locale in LC_TIME (#263)
src/lib/libast/tm/tmlocale.c: - Load the locale set by LC_TIME or LC_ALL if it hasn't been loaded before or if it was loaded previously but isn't the current locale. src/cmd/ksh93/tests/locale.sh: - Add a regression test using the nl_NL.UTF-8 and ja_JP.UTF-8 locales. Fixes: https://github.com/ksh93/ksh/issues/261
This commit is contained in:
		
							parent
							
								
									4a846a9d19
								
							
						
					
					
						commit
						504cbda269
					
				
					 3 changed files with 30 additions and 2 deletions
				
			
		|  | @ -85,10 +85,29 @@ do	[[ $locale == *[Jj][Ii][Ss] ]] || continue | |||
| done | ||||
| unset LC_ALL | ||||
| 
 | ||||
| # Test the effect of setting a locale, followed by setting a different locale | ||||
| # then setting the previous locale. The output from 'printf %T' should use | ||||
| # the current locale. | ||||
| # https://github.com/ksh93/ksh/issues/261 | ||||
| ((SHOPT_MULTIBYTE)) && for locale in "${locales[@]}" | ||||
| do	[[ $locale == *nl_NL*[Uu][Tt][Ff]* ]] && nl_NL=$locale | ||||
| 	[[ $locale == *ja_JP*[Uu][Tt][Ff]* ]] && ja_JP=$locale | ||||
| done | ||||
| if [[ -n $nl_NL ]] && [[ -n $ja_JP ]]; then | ||||
| 	LC_ALL=$nl_NL | ||||
| 	exp=$(printf '%(%A)T' now) | ||||
| 	LC_ALL=$ja_JP | ||||
| 	printf '%T' now > /dev/null | ||||
| 	LC_ALL=$nl_NL | ||||
| 	got=$(printf '%(%A)T' now) | ||||
| 	[[ $exp == $got ]] || err_exit "'printf %T' ignores changes to LC_ALL when locale is set, unset then set (expected $exp, got $got)" | ||||
| fi | ||||
| unset LC_ALL | ||||
| 
 | ||||
| # this locale is supported by ast on all platforms | ||||
| # EU for { decimal_point="," thousands_sep="." } | ||||
| 
 | ||||
| if((SHOPT_MULTIBYTE)); then | ||||
| if ((SHOPT_MULTIBYTE)); then | ||||
| locale=C_EU.UTF-8 | ||||
| else | ||||
| locale=C_EU | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue