Gracefully handle entrypoint permission errors (#15026)

Gracefully handle entrypoint permission errors

`uv run --with` could fail with a "permission denied" error when it
tried to copy an entrypoint with restrictive permissions.

For instance:

```sh
$ stat -c '%A' /usr/bin/groupmems
-rwxr-s---

$ uv python find
/usr/bin/python

$ uv run --with dummy_test
error: failed to open file `/usr/bin/groupmems`: Permission denied (os error 13)
```

The entrypoint copying logic now catches these permission errors and
skips the file, making `uv` more resilient on systems with binaries that
have restrictive permissions.
This commit is contained in:
Wang Bing-hua
2025-08-02 20:03:37 +08:00
committed by GitHub
parent 34b5afcba6
commit 3dc921d89c
+8
View File
@@ -1102,6 +1102,14 @@ hint: If you are running a script with `{}` in the shebang, you may need to incl
&entry.path().display()
);
}
Err(CopyEntrypointError::Io(err))
if err.kind() == std::io::ErrorKind::PermissionDenied =>
{
trace!(
"Skipping copy of entrypoint `{}`: permission denied",
&entry.path().display()
);
}
Err(err) => return Err(err.into()),
}
}