Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
osutil: fix parsing super-block options with spaces
On any Windows + WSL 2 + Docker system, running any snap command is immediately preceded by the two errors: 2023/06/17 23:59:52.071511 system_key.go:129: cannot determine nfs usage in generateSystemKey: cannot parse mountinfo: incorrect number of tail fields, expected 3 but found 4 2023/06/17 23:59:52.080033 cmd_run.go:1046: WARNING: cannot create user data directory: cannot determine SELinux status: failed to obtain SELinux mount path: incorrect number of tail fields, expected 3 but found 4 Those errors confuse tools that parse program output and generally cause a lot of havoc. The root of the issue is caused by this specific entry in /proc/self/mountinfo (not wrapped to preserve the problematic part more prominently): 1146 77 0:149 / /Docker/host rw,noatime - 9p drvfs rw,dirsync,aname=drvfs;path=C:\Program Files\Docker\Docker\resources;symlinkroot=/mnt/,mmap,access=client,msize=262144,trans=virtio Note that the super-block mount option contains a key=value pair where the value contains un-escaped spaces. Historically mountinfo has been an utter mess to parse, with several bugs in both the userspace parsing and several bugs in the fragile kernel interface generating the contents of said file. To work around this problem allow spaces in the super-block options and silently parse them as if they had been escaped correctly. Signed-off-by: Zygmunt Krynicki <me@zygoon.pl>
- Loading branch information