This is the mail archive of the
mailing list for the glibc project.
[BUG] Generic syscalls -- chmod vs. fchmodat
- From: Linas Vepstas <linasvepstas at gmail dot com>
- To: Chris Metcalf <cmetcalf at tilera dot com>, Arnd Bergmann <arnd at arndb dot de>
- Cc: GLIBC Devel <libc-alpha at sourceware dot org>, linux-kernel at vger dot kernel dot org, libc-ports at sourceware dot org
- Date: Mon, 24 Jan 2011 13:57:56 -0600
- Subject: [BUG] Generic syscalls -- chmod vs. fchmodat
- Reply-to: linasvepstas at gmail dot com
Chris, Arnd, all,
Found a bug/incompatibility in the generic syscalls chmod implementation;
not sure if this is a kernel bug or a glibc bug, or how to correctly resolve it.
The new "generic chmod" implementation for glibc sends chmod to the
kernel call sys_fchmodat with AT_FDCWD, instead of using the older
"deprecated" chmod syscall. These two behave slightly differently: with
the new implementation, the file "" (i.e. string of length zero) gets
as . and so the syscall succeeds, setting perms on . The old syscall would
return an errno=2 No such file or directory for this filename.
My gut instinct is that this is a kernel bug, but am not so sure; perhaps this
is "working as designed". I thought of submitting a patch to fs/namei.c to
fix this, but then got lost in the details: there didn't seem to be
good place to add this check. Meanwhile, a glibc test case (posix/tst-chmod.c)
is failing as a result.
Should we put a check for this funky non-filename into the glibc
generic code, or into sys_chmodat? Recommendations?