Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deleted files with open file handles don't behave correctly in drvfs #1807

Closed
clockfort opened this issue Mar 23, 2017 · 6 comments
Closed

Comments

@clockfort
Copy link

  • A brief description
    A deleted file with open file handles on it does not behave correctly on drvfs; it is still semi-visible to some applications when accessed via directory listing. (I have repro'd the issue in ls and git)

  • Actual results / repro steps

clockfort@clockfort-sfb:~/desktop/test$ pwd -P      # I'm in a drvfs directory
/mnt/c/Users/clockfort/Desktop/test
clockfort@clockfort-sfb:~/desktop/test$ touch foo.txt
clockfort@clockfort-sfb:~/desktop/test$ lsof | grep foo.txt # I'm keeping less open in another terminal
less    596 clockfort    4r   REG   0,14       0  2533274790569269 /mnt/c/Users/clockfort/Desktop/test/foo.txt
clockfort@clockfort-sfb:~/desktop/test$ rm foo.txt
clockfort@clockfort-sfb:~/desktop/test$ ls
ls: cannot access 'foo.txt': No such file or directory
foo.txt
clockfort@clockfort-sfb:~/desktop/test$ ls foo.txt
ls: cannot access 'foo.txt': No such file or directory
clockfort@clockfort-sfb:~/desktop/test$ rm foo.txt
rm: cannot remove 'foo.txt': No such file or directory
clockfort@clockfort-sfb:~/desktop/test$ lsof | grep foo.txt # I closed the file handle
clockfort@clockfort-sfb:~/desktop/test$ ls
clockfort@clockfort-sfb:~/desktop/test$
  • Your Windows build number

Build 15048

clockfort@clockfort-sfb:~/desktop/git/atlasdb$ uname -a
Linux clockfort-sfb 4.4.0-43-Microsoft #1-Microsoft Wed Dec 31 14:42:53 PST 2014 x86_64 x86_64 x86_64 GNU/Linux
clockfort@clockfort-sfb:~/desktop/git/atlasdb$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.2 LTS
Release:        16.04
Codename:       xenial
  • Strace of the failing command
clockfort@clockfort-sfb:~/desktop/test$ strace ls
execve("/bin/ls", ["ls"], [/* 16 vars */]) = 0
brk(NULL)                               = 0x1aff000
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) = 0x7f3b84680000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=32592, ...}) = 0
mmap(NULL, 32592, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f3b84687000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libselinux.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\260Z\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=130224, ...}) = 0
mmap(NULL, 2234080, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f3b841d0000
mprotect(0x7f3b841ef000, 2093056, PROT_NONE) = 0
mmap(0x7f3b843ee000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1e000) = 0x7f3b843ee000
mmap(0x7f3b843f0000, 5856, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f3b843f0000
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|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P\t\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1864888, ...}) = 0
mmap(NULL, 3967392, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f3b83e00000
mprotect(0x7f3b83fbf000, 2097152, PROT_NONE) = 0
mmap(0x7f3b841bf000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1bf000) = 0x7f3b841bf000
mmap(0x7f3b841c5000, 14752, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f3b841c5000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libpcre.so.3", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0000\25\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=456632, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f3b84670000
mmap(NULL, 2552072, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f3b83b90000
mprotect(0x7f3b83bfe000, 2097152, PROT_NONE) = 0
mmap(0x7f3b83dfe000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x6e000) = 0x7f3b83dfe000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\240\r\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=14608, ...}) = 0
mmap(NULL, 2109680, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f3b83980000
mprotect(0x7f3b83983000, 2093056, PROT_NONE) = 0
mmap(0x7f3b83b82000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7f3b83b82000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\260`\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=138696, ...}) = 0
mmap(NULL, 2212904, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f3b83760000
mprotect(0x7f3b83778000, 2093056, PROT_NONE) = 0
mmap(0x7f3b83977000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x17000) = 0x7f3b83977000
mmap(0x7f3b83979000, 13352, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f3b83979000
close(3)                                = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f3b84660000
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f3b84650000
arch_prctl(ARCH_SET_FS, 0x7f3b84650800) = 0
mprotect(0x7f3b841bf000, 16384, PROT_READ) = 0
mprotect(0x7f3b83977000, 4096, PROT_READ) = 0
mprotect(0x7f3b83b82000, 4096, PROT_READ) = 0
mprotect(0x7f3b83dfe000, 4096, PROT_READ) = 0
mprotect(0x7f3b843ee000, 4096, PROT_READ) = 0
mprotect(0x61d000, 4096, PROT_READ)     = 0
mprotect(0x7f3b84625000, 4096, PROT_READ) = 0
munmap(0x7f3b84687000, 32592)           = 0
set_tid_address(0x7f3b84650ad0)         = 652
set_robust_list(0x7f3b84650ae0, 24)     = 0
rt_sigaction(SIGRTMIN, {0x7f3b83765b50, [], SA_RESTORER|SA_SIGINFO, 0x7f3b83771390}, NULL, 8) = 0
rt_sigaction(SIGRT_1, {0x7f3b83765be0, [], SA_RESTORER|SA_RESTART|SA_SIGINFO, 0x7f3b83771390}, NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0
getrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=8192*1024}) = 0
statfs("/sys/fs/selinux", 0x7fffdc60b960) = -1 ENOENT (No such file or directory)
statfs("/selinux", 0x7fffdc60b960)      = -1 ENOENT (No such file or directory)
brk(NULL)                               = 0x1aff000
brk(0x1b20000)                          = 0x1b20000
open("/proc/filesystems", O_RDONLY)     = 3
fstat(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
read(3, "nodev      sysfs\nnodev      root"..., 4096) = 367
read(3, "", 4096)                       = 0
close(3)                                = 0
open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=1668976, ...}) = 0
mmap(NULL, 1668976, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f3b8448d000
close(3)                                = 0
ioctl(1, TCGETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(1, TIOCGWINSZ, {ws_row=78, ws_col=188, ws_xpixel=0, ws_ypixel=0}) = 0
open(".", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFDIR|0777, st_size=512, ...}) = 0
getdents(3, /* d_reclen < sizeof(struct dirent) *//* 1 entries */, 32768) = 94
getdents(3, /* 0 entries */, 32768)     = 0
close(3)                                = 0
fstat(1, {st_mode=S_IFCHR|0660, st_rdev=makedev(4, 1), ...}) = 0
ioctl(1, TCGETS, {B38400 opost isig icanon echo ...}) = 0
write(1, "foo.txt\n", 8foo.txt
)                = 8
close(1)                                = 0
close(2)                                = 0
exit_group(0)                           = ?
+++ exited with 0 +++
clockfort@clockfort-sfb:~/desktop/test$ strace ls -lha foo.txt
execve("/bin/ls", ["ls", "-lha", "foo.txt"], [/* 16 vars */]) = 0
brk(NULL)                               = 0x126c000
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) = 0x7f104fd90000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=32592, ...}) = 0
mmap(NULL, 32592, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f104fd95000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libselinux.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\260Z\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=130224, ...}) = 0
mmap(NULL, 2234080, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f104f7d0000
mprotect(0x7f104f7ef000, 2093056, PROT_NONE) = 0
mmap(0x7f104f9ee000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1e000) = 0x7f104f9ee000
mmap(0x7f104f9f0000, 5856, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f104f9f0000
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|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P\t\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1864888, ...}) = 0
mmap(NULL, 3967392, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f104f400000
mprotect(0x7f104f5bf000, 2097152, PROT_NONE) = 0
mmap(0x7f104f7bf000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1bf000) = 0x7f104f7bf000
mmap(0x7f104f7c5000, 14752, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f104f7c5000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libpcre.so.3", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0000\25\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=456632, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f104fd80000
mmap(NULL, 2552072, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f104f190000
mprotect(0x7f104f1fe000, 2097152, PROT_NONE) = 0
mmap(0x7f104f3fe000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x6e000) = 0x7f104f3fe000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\240\r\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=14608, ...}) = 0
mmap(NULL, 2109680, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f104ef80000
mprotect(0x7f104ef83000, 2093056, PROT_NONE) = 0
mmap(0x7f104f182000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7f104f182000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\260`\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=138696, ...}) = 0
mmap(NULL, 2212904, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f104ed60000
mprotect(0x7f104ed78000, 2093056, PROT_NONE) = 0
mmap(0x7f104ef77000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x17000) = 0x7f104ef77000
mmap(0x7f104ef79000, 13352, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f104ef79000
close(3)                                = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f104fd70000
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f104fd60000
arch_prctl(ARCH_SET_FS, 0x7f104fd60800) = 0
mprotect(0x7f104f7bf000, 16384, PROT_READ) = 0
mprotect(0x7f104ef77000, 4096, PROT_READ) = 0
mprotect(0x7f104f182000, 4096, PROT_READ) = 0
mprotect(0x7f104f3fe000, 4096, PROT_READ) = 0
mprotect(0x7f104f9ee000, 4096, PROT_READ) = 0
mprotect(0x61d000, 4096, PROT_READ)     = 0
mprotect(0x7f104fc25000, 4096, PROT_READ) = 0
munmap(0x7f104fd95000, 32592)           = 0
set_tid_address(0x7f104fd60ad0)         = 670
set_robust_list(0x7f104fd60ae0, 24)     = 0
rt_sigaction(SIGRTMIN, {0x7f104ed65b50, [], SA_RESTORER|SA_SIGINFO, 0x7f104ed71390}, NULL, 8) = 0
rt_sigaction(SIGRT_1, {0x7f104ed65be0, [], SA_RESTORER|SA_RESTART|SA_SIGINFO, 0x7f104ed71390}, NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0
getrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=8192*1024}) = 0
statfs("/sys/fs/selinux", 0x7fffe500cda0) = -1 ENOENT (No such file or directory)
statfs("/selinux", 0x7fffe500cda0)      = -1 ENOENT (No such file or directory)
brk(NULL)                               = 0x126c000
brk(0x128d000)                          = 0x128d000
open("/proc/filesystems", O_RDONLY)     = 3
fstat(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
read(3, "nodev      sysfs\nnodev      root"..., 4096) = 367
read(3, "", 4096)                       = 0
close(3)                                = 0
open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=1668976, ...}) = 0
mmap(NULL, 1668976, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f104fa8d000
close(3)                                = 0
ioctl(1, TCGETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(1, TIOCGWINSZ, {ws_row=78, ws_col=188, ws_xpixel=0, ws_ypixel=0}) = 0
open("/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=2995, ...}) = 0
read(3, "# Locale name alias data base.\n#"..., 512) = 512
read(3, "See the\n# GNU General Public Lic"..., 512) = 512
read(3, "nd for the time being for\n# back"..., 512) = 512
read(3, "hese lines were removed\n# becaus"..., 512) = 512
read(3, "8859-1\ngalego\t\tgl_ES.ISO-8859-1\n"..., 512) = 512
read(3, "O.ISO-8859-1 nb_NO.ISO-8859-1\nno"..., 512) = 435
read(3, "", 512)                        = 0
close(3)                                = 0
open("/usr/share/locale/en_US.UTF-8/LC_TIME/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US.utf8/LC_TIME/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US/LC_TIME/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.UTF-8/LC_TIME/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.utf8/LC_TIME/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en/LC_TIME/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=26258, ...}) = 0
mmap(NULL, 26258, PROT_READ, MAP_SHARED, 3, 0) = 0x7f104fd96000
close(3)                                = 0
futex(0x7f104f7c48c8, FUTEX_WAKE_PRIVATE, 2147483647) = 0
lstat("foo.txt", 0x126e730)             = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US.UTF-8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US.utf8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.UTF-8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.utf8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en_US.UTF-8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en_US.utf8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en_US/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en.UTF-8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en.utf8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
write(2, "ls: ", 4ls: )                     = 4
write(2, "cannot access 'foo.txt'", 23cannot access 'foo.txt') = 23
open("/usr/share/locale/en_US.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en_US.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en_US.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en_US/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
write(2, ": No such file or directory", 27: No such file or directory) = 27
write(2, "\n", 1
)                       = 1
close(1)                                = 0
close(2)                                = 0
exit_group(2)                           = ?
+++ exited with 2 +++
@aseering
Copy link
Contributor

Hi @clockfort -- thanks for the detailed write-up! I think this is the same underlying issue as #1535 , though a somewhat different scenario. In short, it's a clash between Windows and Linux semantics. Windows doesn't allow you to remove an open file. Linux does. DrvFs must support both simultaneously. Since the two have conflicting requirements, there must necessarily be rough edges; the question is where the WSL team chooses to put them.

Related to that point: Do you have a program or script that depends on the Linux behavior? Or is this just a curiosity that you observed? When trade-offs need to be mande, the WSL team often seems to prefer to make trade-offs in favor of what's most useful to the most people.

@clockfort
Copy link
Author

Yeah, I know why there'd be rough edges around this :-)
Sorry I didn't see that other issue because of the misleading overly-specific name; feel free to close this issue as duplicate if that one has the same underlying issue.

My situation specifically was that I had a git directory, and checking out another branch deleted and added files to directory; including a file that a gradle daemon had an open handle on; the checkout threw an error because it couldn't put back a (different version) of the file in the same place.
From there things get really weird, and you can git add the phantom file it thinks is there, but then it simultaneously appears as added as a delete and existing as untracked (??!!), while all the while it's actually deleted and was never there.

clockfort@clockfort-sfb:~/desktop/git/atlasdb$ git status
On branch develop
Your branch is behind 'origin/develop' by 73 commits, and can be fast-forwarded.
  (use "git pull" to update your local branch)
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        deleted:    versions.props

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        versions.props

@laktak
Copy link

laktak commented Mar 24, 2017

@aseering Could #1615 be related as well?

@aseering
Copy link
Contributor

Yeah, certainly possible.

@benhillis
Copy link
Member

I believe @JasonLinMS fixed this recently.

@benhillis
Copy link
Member

Duplicate of #966.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants