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

Double // in symlink causes weird behaviour #1147

Closed
sebmaynard opened this issue Sep 30, 2016 · 1 comment
Closed

Double // in symlink causes weird behaviour #1147

sebmaynard opened this issue Sep 30, 2016 · 1 comment

Comments

@sebmaynard
Copy link

sebmaynard commented Sep 30, 2016

  • A brief description
    Creating a symlink to a file with 2 forward slashes in it causes the symlink not to work properly
  • Expected results
    That the symlink would correctly resolve to the file
  • Actual results (with terminal output if applicable)
    The filesystem thinks it's a directory at the point of //
  • Your Windows build number
    14393.222
  • Steps / All commands required to reproduce the error from a brand new installation
    From a bash shell:
$ mkdir somedir
$ echo sometext > somedir/somefile
$ ln -s somedir//somefile somelink
lrwxrwxrwx 1 seb seb 17 Sep 30 21:28 somelink -> somedir//somefile
$ cat somelink
cat: somelink: Is a directory
$ cd somelink
$ ls -l
-rw-rw-rw- 1 seb seb 9 Sep 30 21:28 somefile
  • Strace of the failing command
execve("/bin/cat",` ["cat", "somelink"], [/* 17 vars */]) = 0
brk(0)                                  = 0x209f000
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) = 0x7f24bf4c0000
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=39870, ...}) = 0
mmap(NULL, 39870, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f24bf4c3000
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\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P \2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1840928, ...}) = 0
mmap(NULL, 3949248, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f24bee30000
mprotect(0x7f24befea000, 2097152, PROT_NONE) = 0
mmap(0x7f24bf1ea000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1ba000) = 0x7f24bf1ea000
mmap(0x7f24bf1f0000, 17088, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f24bf1f0000
close(3)                                = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f24bf4b0000
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f24bf4a0000
arch_prctl(ARCH_SET_FS, 0x7f24bf4a0740) = 0
mprotect(0x7f24bf1ea000, 16384, PROT_READ) = 0
mprotect(0x60a000, 4096, PROT_READ)     = 0
mprotect(0x7f24bf422000, 4096, PROT_READ) = 0
munmap(0x7f24bf4c3000, 39870)           = 0
brk(0)                                  = 0x209f000
brk(0x20c0000)                          = 0x20c0000
open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=2919792, ...}) = 0
mmap(NULL, 2919792, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f24beb67000
close(3)                                = 0
fstat(1, {st_mode=S_IFCHR|0600, st_rdev=makedev(4, 2), ...}) = 0
open("somelink", O_RDONLY)              = 3
fstat(3, {st_mode=S_IFDIR|0777, st_size=0, ...}) = 0
fadvise64(3, 0, 0, POSIX_FADV_SEQUENTIAL) = 0
read(3, 0x20a1000, 65536)               = -1 EISDIR (Is a directory)
write(2, "cat: ", 5cat: )                    = 5
write(2, "somelink", 8somelink)                 = 8
open("/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 4
fstat(4, {st_mode=S_IFREG|0644, st_size=2570, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f24bf490000
read(4, "# Locale name alias data base.\n#"..., 512) = 512
read(4, "PURPOSE.  See the\n# GNU General "..., 512) = 512
read(4, " entries are case independent.\n\n"..., 512) = 512
read(4, "859-1\nfinnish         fi_FI.ISO-"..., 512) = 512
read(4, "R\nko_KR\t\tko_KR.eucKR\nlithuanian "..., 512) = 512
read(4, "SO-8859-9\n", 512)             = 10
read(4, "", 512)                        = 0
close(4)                                = 0
munmap(0x7f24bf490000, 4096)            = 0
open("/usr/share/locale/en_GB.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_GB.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_GB/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_GB.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en_GB.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en_GB/LC_MESSAGES/libc.mo", O_RDONLY) = 4
fstat(4, {st_mode=S_IFREG|0644, st_size=3595, ...}) = 0
mmap(NULL, 3595, PROT_READ, MAP_PRIVATE, 4, 0) = 0x7f24bf4cc000
close(4)                                = 0
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, ": Is a directory", 16: Is a directory)        = 16
write(2, "\n", 1
)                       = 1
close(3)                                = 0
close(1)                                = 0
close(2)                                = 0
exit_group(1)                           = ?
+++ exited with 1 +++
  • Required packages and commands to install

See our contributing instructions for assistance.

@russalex
Copy link
Contributor

Some good news here, this should be fixed on the Insider builds. Just tested on 14936:

russ@russalex-book:~$ mkdir somedir
russ@russalex-book:~$ echo sometext > somedir/somefile
russ@russalex-book:~$ ln -s somedir//somefile somelink
russ@russalex-book:~$ ls -la | grep somelink
lrwxrwxrwx 1 russ russ   17 Sep 30 14:50 somelink -> somedir//somefile
russ@russalex-book:~$ cat somelink
sometext

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

No branches or pull requests

5 participants