diff options
author | Jim Meyering <meyering@redhat.com> | 2008-09-25 20:01:24 +0200 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2008-09-26 23:31:30 +0200 |
commit | e13188e7ef7bbd609c1586332a335b4194b881aa (patch) | |
tree | a4d7b7f8bbcd4fee73be6d61bfa7710fe0af9380 /tests/misc/seq | |
parent | 2a4dcb627ea6310c2be0e8f570b470754bd1fc7e (diff) | |
download | coreutils-e13188e7ef7bbd609c1586332a335b4194b881aa.tar.xz |
seq -0.1 0.1 2: print final number when locale's decimal point is ","
* src/seq.c (print_numbers): Use strtold, not c_strtold to convert
from just-formatted-using-asprintf string back to double, since
asprintf may have used something other than "." as the decimal point.
Reported by lsof@nodata.co.uk as <http://bugzilla.redhat.com/463556>.
Thanks to Ondřej Vašík for discovering that the bug was locale-related.
$ LC_ALL=cs_CZ.UTF-8 seq -0.1 0.1 2|grep 2.0
[Exit 1]
$ seq -0.1 0.1 2|grep 2.0
2.0
* tests/check.mk (TESTS_ENVIRONMENT): Add LOCALE_FR_UTF8, for...
* tests/misc/seq [locale-dec-pt]: New test for the above.
* NEWS (bug fix): Mention it.
Diffstat (limited to 'tests/misc/seq')
-rwxr-xr-x | tests/misc/seq | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/misc/seq b/tests/misc/seq index f68d74cf5..8e76f42da 100755 --- a/tests/misc/seq +++ b/tests/misc/seq @@ -26,6 +26,10 @@ use strict; my $prog = 'seq'; my $try_help = "Try `$prog --help' for more information.\n"; +my $locale = $ENV{LOCALE_FR_UTF8}; +! defined $locale || $locale eq 'none' + and $locale = 'C'; + my @Tests = ( ['onearg-1', qw(10), {OUT => [(1..10)]}], @@ -88,6 +92,17 @@ my @Tests = {ERR => "seq: no % directive in format string `'\n" . $try_help }], ['fmt-e', qw(-f %g%g 1), {EXIT => 1}, {ERR => "seq: too many % directives in format string `%g%g'\n"}], + + # With coreutils-6.12 and earlier, with a UTF8 numeric locale that uses + # something other than "." as the decimal point, this use of seq would + # fail to print the "2,0" endpoint. + ['locale-dec-pt', qw(-0.1 0.1 2), + {OUT => [qw(-0.1 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 + 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0)]}, + + {ENV => "LC_ALL=$locale"}, + {OUT_SUBST => 's/,/./g'}, + ], ); # Append a newline to each entry in the OUT array. |