Hi Gianfranco, I was able to reproduce the bug on FreeBSD. It turns out that on that system the unlinkat call fails if the pathname argument is a relative file name (starting with "../") and the fd argument refers to a directory that has been removed after openat.
Unfortunately I have not got any Hurd box. Can you please compile and run the attached file on gnu/hurd? Regards, Sergey
#include <sys/types.h> #include <fcntl.h> #include <unistd.h> #include <assert.h> #include <sys/stat.h> #include <stdio.h> #define TESTDIR "t" int main () { int fd; int mode = 0700; struct stat st; if (access (TESTDIR, F_OK) == 0) { fprintf (stderr, "the directory \"%s\" exists: please remove it and retry\n", TESTDIR); return 2; } assert (mkdir (TESTDIR, mode) == 0); assert (mkdir (TESTDIR "/a", mode) == 0); assert (mkdir (TESTDIR "/b", mode) == 0); fd = openat (AT_FDCWD, TESTDIR "/a", O_DIRECTORY); assert (fd >= 0); assert (unlinkat (AT_FDCWD, TESTDIR "/a", AT_REMOVEDIR) == 0); if (fstatat (fd, "../b", &st, 0)) perror ("fstatat"); if (unlinkat (fd, "../b", AT_REMOVEDIR)) { perror ("unlinkat"); return 1; } rmdir (TESTDIR); return 0; }