This is the mail archive of the
mailing list for the glibc project.
Re: [BUG] Generic syscalls -- chmod vs. fchmodat
- From: Roland McGrath <roland at redhat dot com>
- To: Arnd Bergmann <arnd at arndb dot de>
- Cc: linasvepstas at gmail dot com, Chris Metcalf <cmetcalf at tilera dot com>, GLIBC Devel <libc-alpha at sourceware dot org>, linux-kernel at vger dot kernel dot org, libc-ports at sourceware dot org, linux-api at vger dot kernel dot org, Mike Frysinger <vapier at gentoo dot org>
- Date: Tue, 25 Jan 2011 09:45:15 -0800 (PST)
- Subject: Re: [BUG] Generic syscalls -- chmod vs. fchmodat
- References: <AANLkTikhKHnR+7DskxYqWXduX4=tpfgsfL4sNYq+4QDq@mail.gmail.com><email@example.com>
> 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.