[Top][All Lists]

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

Re: [PATCH] printf,seq,sleep,tail,timeout: accept current-locale floats

From: Pádraig Brady
Subject: Re: [PATCH] printf,seq,sleep,tail,timeout: accept current-locale floats
Date: Sun, 27 Jan 2019 20:47:29 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

Thanks for doing all that.
This is a net positive I think, though for the record there are some 

I see both current locale and C locale formats are accepted.
Allowing both C and local locales does introduce some ambiguity.
For example users in the german locale may expect 1.234
to wait 1234 seconds:

  $ LC_NUMERIC=de_DE printf "%'d\n" 1234
  $ time LC_NUMERIC=de_DE sleep 1.234
  real  0m1.237s

Now I agree that allowing both is better/required for backwards compat.
BTW I see that sleep in ksh only supports the current locale, which is
surprising at it breaks scripts that specified say 1.2 when run under some 
I also see that printf in bash (4.3) also only supports the locale decimal 
thus having the same compat issue.

Also it's worth noting that allowing locale specific input limits the 
portability of scripts,
to specific locales, and to new enough implementations of sleep(1) etc.

BTW I checked that multi-byte decimal points are supported with:

  LC_NUMERIC=ps_AF.utf8 src/sleep 1٫234

I pushed a small syntax-check fix,
and have attached a proposed test.


Attachment: locale-decimal-test.diff
Description: Text Data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]