mount points with whitespace are not escaped
Jeremy Drake
cygwin@jdrake.com
Tue Jun 4 00:36:29 GMT 2024
Steps to reproduce:
$ mkdir /$'My New\r\nFolder'
$ mount c: /$'My New\r\nFolder'
$ mount
C:/cygwin64/bin on /usr/bin type ntfs (binary,auto)
C:/cygwin64/lib on /usr/lib type ntfs (binary,auto)
C:/cygwin64 on / type ntfs (binary,auto)
C: on /My New
Folder type ntfs (binary,user)
$ cat /proc/self/mounts
C:/cygwin64/bin /usr/bin ntfs binary,auto 1 1
C:/cygwin64/lib /usr/lib ntfs binary,auto 1 1
C:/cygwin64 / ntfs binary,auto 1 1
C: /My New
Folder ntfs binary,user 1 1
$ cat /proc/self/mountinfo
0 0 39488:20815 / /usr/bin binary,auto - ntfs C:/cygwin64/bin rw
1 1 39488:20815 / /usr/lib binary,auto - ntfs C:/cygwin64/lib rw
2 2 39488:20815 / / binary,auto - ntfs C:/cygwin64 rw
3 3 39488:20815 / /My New
Folder binary,user - ntfs C: rw
Expected (what happens on Linux) is that mount outputs the \r\n as ??, but
/proc/self/mounts and /proc/self/mountinfo use octal escapes for ' ' and
\n (I was rather surprised they didn't escape \r also, but I guess they
don't have to because only ' ' and \n are used as delimiters):
$ mount
...
/dev/mapper/XXX on /My New??Folder type ext3 (rw,noatime,data=ordered)
$ cat /proc/self/mounts | xxd
...
00000400: 6564 2030 2030 0a2f 6465 762f 646d 2d30 ed 0 0./dev/dm-0
00000410: 202f 4d79 5c30 3430 4e65 770d 5c30 3132 /My\040New.\012
00000420: 466f 6c64 6572 2065 7874 3320 7277 2c6e Folder ext3 rw,n
00000430: 6f61 7469 6d65 2c64 6174 613d 6f72 6465 oatime,data=orde
00000440: 7265 6420 3020 300a red 0 0.
$ cat /proc/self/mountinfo | xxd
...
000004f0: 2f62 696e 202f 4d79 5c30 3430 4e65 770d /bin /My\040New.
00000500: 5c30 3132 466f 6c64 6572 2072 772c 6e6f \012Folder rw,no
00000510: 6174 696d 6520 2d20 6578 7433 202f 6465 atime - ext3 /de
00000520: 762f 646d 2d30 2072 772c 6461 7461 3d6f v/dm-0 rw,data=o
00000530: 7264 6572 6564 0a rdered.
More information about the Cygwin
mailing list