-
Notifications
You must be signed in to change notification settings - Fork 372
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
Use non-canonical paths for mount paths. #942
Conversation
I still have to test this extensively on macOS and with symlinks, just to ensure this works well (and also for Docker-in-Docker). |
Specifically, this fails in workspaces for docker-in-docker: this is the mount point: -v $PREFIX/merged/tmp/tmp.BHCKdn/external/external_lib:/tmp/tmp.BHCKdn/external/external_lib
failed to read `/var/lib/docker/overlay2/c7c0edabf2c42ce958ffef1d9eb8b59b903c0bdf2605682a8ca2cb54a2662ef0/merged/tmp/tmp.BHCKdn/external/external_lib/Cargo.toml`
EDIT: This was a bug in my code and using |
947: Resolve symlinks for cargo and xargo home. r=Emilgardis a=Alexhuszagh Resolve symlinks for the xargo and cargo home (as well as the Nix store) prior to mounting, since they are mounted at a fixed location anyway. This is because podman mounts symlinks as root by default. Closes #373. Doesn't interfere with #920 and #942, although #942 might need work to ensure non-canonical paths are mounted with normal permissions. Co-authored-by: Alex Huszagh <ahuszagh@gmail.com>
.mount_finder | ||
.find_path(Path::new(&absolute_path), true)?; | ||
mount_cb(docker, host_path.as_ref(), mount_path.as_ref())?; | ||
docker.args(&["-e", &format!("{}={}", var, mount_path)]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops
Symlinks and canonical paths can destroy assumptions about paths: say I have a file at `/tmp/path/to/file` I reference in my crate, and ask to mount `/tmp/path/to` on the container. Currently, on macOS, since `/tmp` is a symlink to `/private/tmp`, the code that expects `/tmp/path/to/file` will fail because in the container it will be mounted at `/private/tmp/path/to/file`. Also fix device_ns parsing with drive letters. Fixes a minor bug where the host root instead of the var names was passed as the environment variable.
bors r=Emilgardis |
Build succeeded: |
Symlinks and canonical paths can destroy assumptions about paths: say I have a file at
/tmp/path/to/file
I reference in my crate, and ask to mount/tmp/path/to
on the container. Currently, on macOS, since/tmp
is a symlink to/private/tmp
, the code that expects/tmp/path/to/file
will fail because in the container it will be mounted at/private/tmp/path/to/file
.In addition, this fixes
DeviceNS
parsing with drive letters (this previously didn't matter since it never occurred, due todunce
canonicalization). This PR also fixes a minor bug where the host root instead of the var names was passed as the environment variable (introduced in #904).Closes #920.