On Sat, Jan 17, 2015 at 11:00 PM, Rich Felker <dal...@libc.org> wrote: > On Sat, Jan 17, 2015 at 06:59:57PM -0600, Rob Landley wrote: >> On 01/17/2015 01:53 PM, Rob Landley wrote: >> > On 01/17/2015 12:09 AM, enh wrote: >> > So anyway I checked that in, and now I'm porting your patch on top of >> > that change and I hit the _weirdest_ thing where "./touch nonexistent" >> > doesn't cause an error because utimensat() on a file that didn't exist >> > returned ok (file still doesn't exist afterwards), >> >> Because if both timestamps have nanoseconds set to UTIME_OMIT it returns >> success even if the file did not exist. >> >> Possibly the man page should mention that. > > No, it's a kernel bug that should be fixed, and that may be necessary > to work around in userspace if the kernel doesn't fix it. See > http://pubs.opengroup.org/onlinepubs/9699919799/functions/futimens.html > > In particular: > > The utimensat() and utimes() functions shall fail if: > > [ENOENT] > A component of path does not name an existing file or path is an > empty string. > > There is no option to ignore this error condition just because both > timestamps are UTIME_OMIT.
but the "shall" sections include EACCES and EPERM which are both explicitly excluded by... > This is made even more clear in the description: > > If both tv_nsec fields are set to UTIME_OMIT, no ownership or > permissions check shall be performed for the file, but other error > conditions may still be detected (including [EACCES] errors > related to the path prefix). ...which only says "may" for other error conditions (like ENOENT). _we_ all agree this is undesirable, but i'm not sure it's out of spec. a quick grep of the Android source tree turns up a qemu implementation of utimensat that contains the same UTIME_OMIT [too-]early exit. i plan on reporting it upstream anyway. in the meantime, the man page now at least contains a warning. --elliott _______________________________________________ Toybox mailing list Toybox@lists.landley.net http://lists.landley.net/listinfo.cgi/toybox-landley.net