You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The program should print nothing (err should be nil). Internally, the standard library is expected to pass the AT_REMOVEDIR flag to libc, as per #9923.
What did you see instead?
The program prints is not a directory - the Unlinkat returns EISDIR because it requires the AT_REMOVEDIR flag. By running an strace on the above program, we can see that the AT_REMOVEDIR flag (0x200/512) is not being passed as the last parameter to Unlinkat:
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Ran this code, which calls
Unlinkat
.What did you expect to see?
The program should print nothing (
err
should benil
). Internally, the standard library is expected to pass theAT_REMOVEDIR
flag to libc, as per #9923.What did you see instead?
The program prints
is not a directory
- theUnlinkat
returnsEISDIR
because it requires theAT_REMOVEDIR
flag. By running anstrace
on the above program, we can see that theAT_REMOVEDIR
flag (0x200/512) is not being passed as the last parameter toUnlinkat
:readlinkat(AT_FDCWD, "/proc/self/exe", "/tmp/x/x", 128) = 8 fcntl(0, F_GETFL) = 0x2 (flags O_RDWR) mmap(NULL, 262144, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f7aa5733000 fcntl(1, F_GETFL) = 0x2 (flags O_RDWR) fcntl(2, F_GETFL) = 0x2 (flags O_RDWR) newfstatat(AT_FDCWD, "dir/subdir", {st_mode=S_IFDIR|0755, st_size=40, ...}, 0) = 0 openat(AT_FDCWD, "dir", O_RDONLY) = 3 + unlinkat(3, "subdir", 0) = -1 EISDIR (Is a directory) mmap(NULL, 262144, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f7aa56f3000 openat(AT_FDCWD, "/etc//localtime", O_RDONLY) = 4 read(4, "TZif2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\7\0\0\0\7\0\0\0\0"..., 4096) = 3648 read(4, "", 4096) = 0 close(4) = 0 write(2, "2019/12/02 18:04:12 is a directo"..., 352019/12/02 18:04:12 is a directory ) = 35 exit_group(1) = ?
The text was updated successfully, but these errors were encountered: