Re: [coreutils] [PATCH 1/2] stat: support printing birthtime
From:
Jim Meyering
Subject:
Re: [coreutils] [PATCH 1/2] stat: support printing birthtime
Date:
Fri, 01 Oct 2010 17:44:10 +0200
Eric Blake wrote:
> On 10/01/2010 09:22 AM, Jim Meyering wrote:
>>>>> +case $(stat --format %x a) in
>>>>> + *.000000000*) sleep 2;; # worst case file system is FAT
>>>>> + *) # FIXME: sleep .1 would be sufficient if %X showed nanoseconds
>>>>> + sleep 1;; # should be adequate for any system with subsecond resolution
>>>>> +esac
>>>>
>>>> We try hard to avoid sleeping in the common case.
>>>> Any reason not to do what the FIXME suggests?
>>>>
>>>> case $(stat --format %X a) in
>>>> *.000000000) sleep 1;;
>>>
>>> You need two seconds for FAT.
>>
>> Yes. FAT is already handled.
>> The case statement I suggested was intended to replace the "sleep 1" in
>> the default case (handling the FIXME) above, not to replace the existing
>> case statement.
>
> I think you mis-parsed my FIXME conmment in patch 1/2. The point is
> that prior to either patch, %X lacks nanoseconds altogether (that is,
> you will never match *.00000000 or even *.[0-9]* until after patch
> 2). Which is why patch 2/2 deletes the FIXME, and goes with sleep .1,
> because %X is fixed to add nanoseconds. No second case statement
> needed.
Ahhh. That's it. I thought this test was going in *after*
%X nanosecond support. I hadn't seen the 2nd patch and though
you were going to leave the FIXME there.