X Tutup
Skip to content

Commit cb91b17

Browse files
committed
Add testcase containing mountpoint with escaped backslash
Signed-off-by: Johannes Frey <me@johannes-frey.de>
1 parent 87f9fdb commit cb91b17

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

mount/mountinfo_linux_test.go

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,8 @@ const (
441441
31 21 0:23 / /DATA/foo_bla_bla rw,relatime - cifs //foo/BLA\040BLA\040BLA/ rw,sec=ntlm,cache=loose,unc=\\foo\BLA BLA BLA,username=my_login,domain=mydomain.com,uid=12345678,forceuid,gid=12345678,forcegid,addr=10.1.30.10,file_mode=0755,dir_mode=0755,nounix,rsize=61440,wsize=65536,actimeo=1`
442442

443443
mountInfoWithDoubleQuotes = `1046 30 253:1 /tmp/bar /var/lib/kubelet/pods/98d150a4-d814-4d52-9068-b10f62d7a895/volumes/kubernetes.io~empty-dir/tmp-dir/"var rw,relatime shared:1 - ext4 /dev/mapper/ubuntu--vg-root rw,errors=remount-ro
444-
1046 30 253:1 /tmp/bar /tmp/"foo" rw,relatime shared:1 - ext4 /dev/mapper/ubuntu--vg-root rw,errors=remount-ro`
444+
1046 30 253:1 /tmp/bar /tmp/"foo" rw,relatime shared:1 - ext4 /dev/mapper/ubuntu--vg-root rw,errors=remount-ro
445+
1060 30 253:1 /tmp/bar /tmp/\134"foo\134" rw,relatime shared:1 - ext4 /dev/mapper/ubuntu--vg-root rw,errors=remount-ro`
445446
)
446447

447448
func TestParseFedoraMountinfo(t *testing.T) {
@@ -575,6 +576,19 @@ func TestParseMountinfoWithDoubleQuotes(t *testing.T) {
575576
Source: "/dev/mapper/ubuntu--vg-root",
576577
VFSOptions: "rw,errors=remount-ro",
577578
},
579+
{
580+
ID: 1060,
581+
Parent: 30,
582+
Major: 253,
583+
Minor: 1,
584+
Root: "/tmp/bar",
585+
Mountpoint: `/tmp/\"foo\"`,
586+
Options: "rw,relatime",
587+
Optional: "shared:1",
588+
FSType: "ext4",
589+
Source: "/dev/mapper/ubuntu--vg-root",
590+
VFSOptions: "rw,errors=remount-ro",
591+
},
578592
}
579593

580594
if len(infos) != len(expected) {

0 commit comments

Comments
 (0)
X Tutup