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. 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). If you can confirm the incorrect behavior, we should report this to the kernel folks. Rich _______________________________________________ Toybox mailing list Toybox@lists.landley.net http://lists.landley.net/listinfo.cgi/toybox-landley.net