[PATCH 1/3] touch: implement nanosecond precision times

Rasmus Villemoes rasmus.villemoes at prevas.dk
Tue Apr 13 22:58:30 UTC 2021


On 14/04/2021 00.33, Denys Vlasenko wrote:
> On Tue, Apr 13, 2021 at 11:03 PM Xabier Oneca -- xOneca
> <xoneca at gmail.com> wrote:
>> Hi Peter,
>>
>>>> Sorry if I trampled down your patch, but I had this patch prepared a
>>>> while ago and didn't feel like rebasing my other patches. Indeed,
>>>> yours gave me +10 bytes, so I decided to send my version too. They are
>>>> very similar, tho.
>>>
>>> This is no problem - seeing as your patch is smaller and more well
>>> documented, I don't feel trampled on at all.
>>> That was my first time submitting a patch anywhere - I had fun writing
>>> it anyway.
>>
>> Well... Your patch was very nice, and I first doubted if I should send
>> my version.
>>
>> In the end Denys accepted your version... sort of :)
>>
>> He over-shrunk the code, and now 'touch -am file' does not work. :S
> 
> Looks like a kernel-side problem to me: with [OMIT, OMIT],
> utimensat does not even check existence of the file!

First, "touch -am" is supposed to be equivalent to not passing either
flag, i.e. update both. (-a means "update atime", not "don't update
mtime", after all). So busybox touch should never get to pass OMIT,OMIT
in the first place. Second, that behaviour is documented in the man page

       If both tv_nsec fields are specified as UTIME_OMIT, then the
Linux implementation of utimensat() succeeds even  if  the
       file referred to by dirfd and pathname does not exist.

But that's irrelevant, it's simply the current touch.c code that is buggy.

Rasmus


More information about the busybox mailing list