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

Fix cross-drive script installation #11167

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

konstin
Copy link
Member

@konstin konstin commented Feb 2, 2025

Fallback to copy if renaming a script doesn't work, similar to the site packages installation.

Fixes #11163

Test Plan

Failing:

docker volume rm -f gh11163_usr_local_bin
docker run -v gh11163_usr_local_bin:/usr/local/bin -e UV_LINK_MODE=copy -v $(pwd):/io -it --rm ghcr.io/astral-sh/uv:0.5-python3.11-bookworm-slim uv pip install --system ruff

Passing:

cargo build --target x86_64-unknown-linux-musl
docker volume rm -f gh11163_usr_local_bin
docker run -v gh11163_usr_local_bin:/usr/local/bin -e UV_LINK_MODE=copy -v $(pwd):/io -it --rm ghcr.io/astral-sh/uv:0.5-python3.11-bookworm-slim /io/target/x86_64-unknown-linux-musl/debug/uv pip install --system ruff

Fallback to copy if renaming a script doesn't work, similar to the site packages installation.

**Test Plan**

```
cargo build --target x86_64-unknown-linux-musl
docker volume rm -f gh11163_usr_local_bin
docker run -v gh11163_usr_local_bin:/usr/local/bin -e UV_LINK_MODE=copy -v $(pwd):/io -it --rm ghcr.io/astral-sh/uv:0.5-python3.11-bookworm-slim /io/target/x86_64-unknown-linux-musl/debug/uv pip install --system ruff
docker volume rm -f gh11163_usr_local_bin
docker run -v gh11163_usr_local_bin:/usr/local/bin -e UV_LINK_MODE=copy -v $(pwd):/io -it --rm ghcr.io/astral-sh/uv:0.5-python3.11-bookworm-slim uv pip install --system ruff
```
@konstin konstin added the bug Something isn't working label Feb 2, 2025
Comment on lines +485 to +494
// Here, two wrappers over rename are clashing: We want to retry for security software
// blocking the file, but we also need the copy fallback is the problem was trying to
// move a file cross-drive.
match uv_fs::rename_with_retry_sync(&path, &script_absolute) {
Ok(()) => (),
Err(err) => {
debug!("Failed to rename, falling back to copy: {err}");
fs_err::copy(&path, &script_absolute)?;
}
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

'Invalid cross-device link (os error 18)' during 'ruff' installation in Docker container
1 participant