-
Notifications
You must be signed in to change notification settings - Fork 210
make local worker execute command with canonicalized path, #2221
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
base: main
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -929,7 +929,24 @@ impl RunningActionImpl { | |
| // De-bloat the `debug` level by using the `trace` | ||
| // level more effectively and adjust this. | ||
| info!(?args, "Executing command",); | ||
| let mut command_builder = process::Command::new(args[0]); | ||
|
|
||
| // If the program contains a slash, we treat it as a path and resolve it relative to the work directory. | ||
| let program = if Path::new(&args[0]).components().count() > 1 { | ||
| PathBuf::from(&self.work_directory) | ||
| .join(&command_proto.working_directory) | ||
| .join(&args[0]) | ||
| .canonicalize() | ||
| .err_tip(|| { | ||
| format!( | ||
| "Could not canonicalize path for command root {}.", | ||
| args[0].to_string_lossy() | ||
| ) | ||
| })? | ||
| } else { | ||
| PathBuf::from(&args[0]) | ||
| }; | ||
|
|
||
| let mut command_builder = process::Command::new(program); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @zhizhi-dev Can you add a test for this please? Possibly split out the canonicalisation as a new function and test that?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, Rust is not my primary language . Recent days I use Nativelink as chromium RBE backend on Windows. Chromium's siso always send command like [‘../../third_party/llvm-build/.../clang-cl.exe',.....], Nativelink can not execute command |
||
| command_builder | ||
| .args(&args[1..]) | ||
| .kill_on_drop(true) | ||
|
|
||
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.
BTW there's a warning flag on this one
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.
Could this be a false positive?