Poul-Henning Kamp wrote:
In message <[EMAIL PROTECTED]>, Diomidis Spinellis writes:

dds         2006-01-03 21:58:22 UTC

FreeBSD src repository

Modified files:
sys/kern vfs_syscalls.c Log:
Normalize the tv_usec part of the utimes(2) arguments to ensure
that a file's atime and mtime are only set to correct fractional
second values (0-999999000ns with the current interface).
Prior to this change users could create files with values outside
that range.  Moreover, on 32-bit machines tv_usec offsets larger than
4.3s would result in an unnormalized AND wrong timestamp value,
due to overflow.


I think this is wrong.  We should return EINVAL if the fractional
part is not correct.

I saw that one coming :-) Solaris (SunOS 5.10) returns EINVAL, Mac OS X Tiger and Linux 2.4.21 appear to ignore the field, and NetBSD 1.5 follows our buggy behavior. POSIX is silent on the matter, and does not specify EINVAL in the list of prescribed errno values <http://www.opengroup.org/onlinepubs/007908799/xsh/utimes.html>.

However, POSIX, in general, allows returning additional error codes:
 Implementations may support additional errors not included in this
 list, may generate errors included in this list under circumstances
 other than those described here, or may contain extensions or
 limitations that prevent some errors from occurring. The ERRORS section
 on each reference page specifies whether an error shall be returned, or
 whether it may be returned. Implementations shall not generate a
 different error number from the ones described here for error
 conditions described in this volume of IEEE Std 1003.1-2001, but may
 generate additional errors unless explicitly disallowed for a
 particular function.

On the other hand, normalization is easy, relatively efficient, follows the letter of the standard, and will not break existing software. As a precedent, consider that Unix traditionaly normalizes filename paths.

Diomidis - dds@
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to