Re: Command line arguments depend on locale

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2013-01-31 at 09:07 +0000, Richard W.M. Jones wrote:
> On Thu, Jan 31, 2013 at 12:05:16AM +0100, Benny Amorsen wrote:
> > 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.
> 
> You should *always* set LC_ALL=C when running an external command from
> another program (and most probably from a shell script too).

Except when you shouldn't ...

If you are getting arguments that are locale dependent changing the
locale will do you more harm than good, so now you need to parse
arguments before changing locale, assuming you know what the locale of
the arguments is and how to translate them to the C locale.

System commands should probably not change their syntax based on locale.
Ping can very well document that the -i argument takes an interval using
C locale and not do locale dependent parsing. It would be much more
robust and if you are good enough to use the -i switch you probably know
how to type 0.1 instead of 0,1 (or whatever format is in your locale) as
well.

Simo.

-- 
Simo Sorce * Red Hat, Inc * New York

-- 
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/devel



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux