B1;2403;0cOn Mon, 20 Jun 2011, Eric Blake wrote: > > For the record, this is what "git bisect" says: > > > > 65cfc6722361570bfe255698d9cd4dccaf47570d is the first bad commit > > > > commit 65cfc6722361570bfe255698d9cd4dccaf47570d > > Author: Al Viro <v...@zeniv.linux.org.uk> > > Date: Sun Mar 13 15:56:26 2011 -0400 > > > > readlinkat(), fchownat() and fstatat() with empty relative pathnames > > > > For readlinkat() we simply allow empty pathname; it will fail unless > > we have dfd equal to O_PATH-opened symlink, so we are outside of > > POSIX scope here. For fchownat() and fstatat() we allow AT_EMPTY_PATH; > > let the caller explicitly ask for such behaviour. > > > > Signed-off-by: Al Viro <v...@zeniv.linux.org.uk> > > Yes, most likely this is a kernel and/or glibc bug. POSIX requires > readlinkat(dfd, "", buf, size) to fail with ENOENT, if dfd is either > AT_FDCWD or open on a directory. Which does strace say about the > syscall made just before the gnulib test-readlink fails?
Sorry for the late reply. I'm including the complete strace at the end. > I'll try and reproduce this setup myself, [...] Please do so. Apparently this is an issue with just Linux and m4, and does not seem to be specifical to Debian at all, so it should be easy to reproduce indeed. The strace output: execve("./test-readlink", ["./test-readlink"], [/* 19 vars */]) = 0 brk(0) = 0x1c90000 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f91ab64d000 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) open("/etc/ld.so.cache", O_RDONLY) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=9189, ...}) = 0 mmap(NULL, 9189, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f91ab64a000 close(3) = 0 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\300\357\1\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=1570832, ...}) = 0 mmap(NULL, 3684440, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f91ab0ac000 mprotect(0x7f91ab226000, 2097152, PROT_NONE) = 0 mmap(0x7f91ab426000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x17a000) = 0x7f91ab426000 mmap(0x7f91ab42b000, 18520, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f91ab42b000 close(3) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f91ab649000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f91ab648000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f91ab647000 arch_prctl(ARCH_SET_FS, 0x7f91ab648700) = 0 mprotect(0x7f91ab426000, 16384, PROT_READ) = 0 mprotect(0x7f91ab64f000, 4096, PROT_READ) = 0 munmap(0x7f91ab64a000, 9189) = 0 rt_sigaction(SIGINT, {SIG_IGN, [], SA_RESTORER, 0x7f91ab0de480}, {SIG_DFL, [], 0}, 8) = 0 rt_sigaction(SIGQUIT, {SIG_IGN, [], SA_RESTORER, 0x7f91ab0de480}, {SIG_DFL, [], 0}, 8) = 0 rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0 clone(child_stack=0, flags=CLONE_PARENT_SETTID|SIGCHLD, parent_tidptr=0x7fff370e7318) = 12511 wait4(12511, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 12511 rt_sigaction(SIGINT, {SIG_DFL, [], SA_RESTORER, 0x7f91ab0de480}, NULL, 8) = 0 rt_sigaction(SIGQUIT, {SIG_DFL, [], SA_RESTORER, 0x7f91ab0de480}, NULL, 8) = 0 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0 --- SIGCHLD (Child exited) @ 0 (0) --- readlink("no_such", 0x7fff370e7340, 80) = -1 ENOENT (No such file or directory) readlink("no_such/", 0x7fff370e7340, 80) = -1 ENOENT (No such file or directory) readlink("", 0x7fff370e7340, 80) = -1 EINVAL (Invalid argument) write(2, "test-readlink.h:41: assertion fa"..., 37test-readlink.h:41: assertion failed ) = 37 rt_sigprocmask(SIG_UNBLOCK, [ABRT], NULL, 8) = 0 gettid() = 12510 tgkill(12510, 12510, SIGABRT) = 0 --- SIGABRT (Aborted) @ 0 (0) --- +++ killed by SIGABRT +++