Subject: Re: bug#7325: new test failure due to non-portability of printf formats like %05.3s

From: Jim Meyering <[email-masked]>
Date: Sat, 06 Nov 2010 15:37:44 +0100

Pádraig Brady wrote:
>  On 06/11/10 02:54, Paul Eggert wrote:
>> On 11/04/2010 11:34 PM, Jim Meyering wrote:
>>> Pádraig Brady wrote:
>>>> I still slightly prefer just using %.X as
>>>> it's backwards compat with older coreutils (excluding 8.6).
>>>
>>> So do I.
>>
>> I built that and tried it out, and found another problem that has been
>> annoying me for years in other programs: 'stat' prints out unnecessary
>> trailing zeros for time stamps, when the file system resolution is
>> coarser than nanosecond resolution.  So I figured I'd fix that too,
>> for 'stat' (other programs can be fixed later).  With this fix, %.X
>> outputs the time stamp but omits trailing zeros if it can infer that
>> the file system would always put zeros there.  If you want a specific
>> number of zeros, you can use something like %.3X or %.9X (or %.100X :-).
>
> Interesting. So it's variable precision by default
>
> $ touch -d '1970-01-01 18:43:33.5000000000' 2; ~/git/t/coreutils/src/stat -c "%.W %.X %.Y %.Z" 2
> 0.000000000 63813.500000000 63813.500000000 1289052572.699980883
> $ touch -d '1970-01-01 18:43:33.5000000000' 2; ~/git/t/coreutils/src/stat -c "%.W %.X %.Y %.Z" 2
> 0.00000000 63813.50000000 63813.50000000 1289052573.53698077
>
> I like it.
>
> BTW you dropped a blank line at the end of the NEWS section.

Good catch.  I've adjusted his patch.

That happens regularly, so we should add a check for this.
Here's a start:

sed -n 4,/Noteworthy/p NEWS| perl -n0e '/\n\n\n\* Noteworthy.*$/ or die'

> p.s. I'm marking this bug as done

Thanks.

BTW, I've just pushed Paul's patch and the fix for FreeBSD's /bin/sh bug,
and made a snapshot.