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

Containerized Tool Info Module loading can fail on WSL2 #1135

Open
ricffb opened this issue Dec 10, 2024 · 2 comments
Open

Containerized Tool Info Module loading can fail on WSL2 #1135

ricffb opened this issue Dec 10, 2024 · 2 comments
Labels
container related to container mode

Comments

@ricffb
Copy link
Contributor

ricffb commented Dec 10, 2024

I am using WSL2 with Ubuntu24.04 to run BencheExec.
When trying to use the container for the tool info module I get the following error:

[...]benchexec/contrib/../benchexec/container.py", line 772, in get_mount_points
    source, target, fstype, options, unused1, unused2 = mount.split(b" ")
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: too many values to unpack (expected 6)

Investigating here lead me to the following line causing the Issue:

b'C:\\134Program\\040Files\\134Docker\\134Docker\\134resources /Docker/host 9p rw,dirsync,noatime,aname=drvfs;path=C:\\Program Files\\Docker\\Docker\\resources;symlinkroot=/mnt/,mmap,access=client,msize=65536,trans=fd,rfd=4,wfd=4 0 0\n'

My proposed fix:
Just ignore mounts starting with C:\\.

@@ -769,6 +767,9 @@ def get_mount_points():
     with open("/proc/self/mounts", "rb") as mounts:
         # The format of this file is the same as of /etc/fstab (cf. man 5 fstab)
         for mount in mounts:
+            if mount.startswith(b"C:\\"):
+                # Ignore pseudo-mounts from WSL.
+                continue
             source, target, fstype, options, unused1, unused2 = mount.split(b" ")
             options = set(options.split(b","))
             yield (decode_path(source), decode_path(target), fstype, options)
@ricffb ricffb added awaiting reply container related to container mode labels Dec 10, 2024
@PhilippWendler
Copy link
Member

This is a bug in WSL. We read /proc/self/mounts here, and although it is not documented, Linux escapes spaces inside the options column with \040, but WSL fails to do this. Having unescaped spaces inside a value of a file with space-delimited columns makes the file effectively unparseable.

Ignoring such mounts is not a solution because this would likely make the container isolation incomplete. And we also need the values in the options column.

Maybe we can apply some heuristic to parse such lines if there are more than 6 columns and the last columns are ints, that we treat the additional columns as part of the options. I wonder what happens if you have mounts for paths that include a ,, though.

@ricffb
Copy link
Contributor Author

ricffb commented Dec 10, 2024

It's actually a bug from Docker I think: docker/for-win#13955

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
container related to container mode
Development

No branches or pull requests

2 participants