Re: [BUG] Generic syscalls -- chmod vs. fchmodat

From: Roland McGrath
Date: Tue Jan 25 2011 - 12:45:36 EST

> My feeling is that it should be in glibc: as Mike mentioned, we don't normally
> change the behavior of existing system calls unless they are obviously
> broken to start with. If we want to keep fchmodat getting the implicit
> "." directory, and at the same time keep fchmod returning an error, the fchmod
> wrapper around fchmodat is the only place that can enforce this.

My point was that it's quite arguable that the *at syscall interfaces were
broken to begin with. I've never seen anything suggesting their intent was
other than to permit relative pathnames, and the empty string has never
been a valid relative pathname. To fit the POSIX requirements as I read
them, the *at functions must refuse to resolve the empty string. So if the
kernel does not change and my interpretation of POSIX stands, then libc
must wrap all the *at syscalls with a function that checks for the empty
string and fails with ENOENT as a special case.

I don't have any strong opinion about this subject, but it makes the most
sense to me for the kernel's behavior to change. I know of no reason to
think that the current treatment of the empty string was ever intended at
the creation of the *at interfaces.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at