bug#7325: new test failure due to non-portability of printf formats like
From:
PƔdraig Brady
Subject:
bug#7325: new test failure due to non-portability of printf formats like %05.3s
Date:
Thu, 11 Nov 2010 14:26:55 +0000
User-agent:
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3
On 11/11/10 12:04, PƔdraig Brady wrote:
> On 11/11/10 11:49, Jim Meyering wrote:
>> Paul Eggert wrote:
>>
>>> On 11/10/2010 01:04 AM, Jim Meyering wrote:
>>>> + /* %.X => precision defaults to 9
>>>> + %.5X => precision is 5
>>>> + %#.X => precision is determined by fstimeprec
>>>> + %#.3X => precision is 3 (specified overrides "#") */
>>>
>>> How about something like this instead?
>>>
>>> %.X => precision is 9 (until POSIX goes sub-nanosecond :-)
>>> %.5X => precision is 5
>>> %.*X => precision determined by fstimeprec
>>>
>>> Then there's no reason for the "overrides" case.
>>
>> Good idea. I prefer that.
>
> Well the reason I chose %#.X was that it was the
> standard mechanism for choosing "alternate form"
> and so was backwards compat with previous stats.
> I.E. on any stat "%#.X" would give the best
> available precision.
An alternative perhaps that doesn't require the above override
behavior and is also forwards compat, is to use %.0X rather than %.*X
I.E. 0 selects the auto precision, and if you really don't
want any decimal places then don't use "." at all?
I don't feel strongly about any of these.
I slightly prefer being forwardss compat though.
I.E. that old versions of stat work with newer scripts.
cheers,
PƔdraig.