On 11/20/2010 02:48 PM, Alan Curry wrote:
> strace shows this:
>
> open("tgt/", O_WRONLY|O_CREAT|O_EXCL|O_LARGEFILE, 0600) = -1 EISDIR (Is a
> directory)
>
> which I think is just bad kernel behavior. There's no errno (among the
> classical errno values anyway) which completely expresses "you tried to creat
> something with a trailing slash", but I'd rather see ENOENT or ENOTDIR than
> EISDIR.Actually, POSIX _does_ specify what should happen here, and the Linux kernel is violating POSIX (on other systems, like Solaris 10, you get the correct ENOTDIR). It's just that its such a pervasive bug that we haven't bothered to make gnulib work around this bug in the Linux kernel. I personally haven't reported this as a kernel bug, so I'm not sure if the kernel folks are aware of this issue. http://www.opengroup.org/onlinepubs/9699919799/functions/open.html [ENOTDIR] A component of the path prefix is not a directory; or O_CREAT and O_EXCL are not specified, the path argument contains at least one non- <slash> character and ends with one or more trailing <slash> characters, and the last pathname component names an existing file that is neither a directory nor a symbolic link to a directory; or O_DIRECTORY was specified and the path argument does not name a directory. as further modified by: http://austingroupbugs.net/view.php?id=146 http://austingroupbugs.net/view.php?id=324 At page 1382 line 45322 section open, change: [ENOENT] O_CREAT is not set and the named file does not exist; or O_CREAT is set and either the path prefix does not exist or the path argument points to an empty string. to: [ENOENT] O_CREAT is not set and a component of path does not name an existing file, or O_CREAT is set and a component of the path prefix of path does not name an existing file, or path points to an empty string. After page 1382 line 45324 section open, add: [ENOENT] or [ENOTDIR] O_CREAT is set, and the path argument contains at least one non-<slash> character and ends with one or more trailing <slash> characters. If path names an existing file, an [ENOENT] error shall not occur. -- Eric Blake [email protected] +1-801-349-2682 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
