[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Command line arguments depend on locale
From: |
Pádraig Brady |
Subject: |
Re: Command line arguments depend on locale |
Date: |
Thu, 31 Jan 2013 18:25:48 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1 |
On 01/30/2013 11:05 PM, Benny Amorsen wrote:
Apparently ping has now started interpreting its command line arguments
depending on locale. I.e. ping -i 0.1 no longer works in locales where
comma is the decimal separator.
This makes it difficult to call system commands. The only workaround is
to set LC_ALL to a known-good locale, but then your users get no benefit
from the translations of error messages and so on.
Is Linux really doomed to repeat the mistakes made by Visual Basic more
than a decade ago?
Yes this is a slippery slope.
ping is definitely wrong to do this IMHO.
A less clear cut example is printf(1).
POSIX states that LC_NUMERIC controls the format
of the numbers _written_.
In coreutils we're careful to reset to the C locale
so that strtod etc. work consistently.
Just testing bash here shows it was a different interpretation
which I would deem not what POSIX intended:
# coreutils
$ LC_NUMERIC=de_DE env printf "%f\n" 0.1
0,100000
$ LC_NUMERIC=de_DE env printf "%f\n" 0,1
printf: 0,1: value not completely converted
0,000000
# bash
$ LC_NUMERIC=de_DE printf "%f\n" 0,1
0,100000
$ LC_NUMERIC=de_DE printf "%f\n" 0.1
bash: printf: 0.1: invalid number
0,000000
cheers,
Pádraig
- Re: Command line arguments depend on locale,
Pádraig Brady <=