From 3dc921d89cb99d9bcc68c3bfd3fcfe4ec927aa74 Mon Sep 17 00:00:00 2001 From: Wang Bing-hua Date: Sat, 2 Aug 2025 20:03:37 +0800 Subject: [PATCH] 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. --- crates/uv/src/commands/project/run.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/crates/uv/src/commands/project/run.rs b/crates/uv/src/commands/project/run.rs index be9ac3783..594a5c28a 100644 --- a/crates/uv/src/commands/project/run.rs +++ b/crates/uv/src/commands/project/run.rs @@ -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()), } }