Skip to content
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion nativelink-worker/src/running_actions_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Copy link
Member

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

warning: the borrowed expression implements the required traits
   --> nativelink-worker/src/running_actions_manager.rs:937:23
    |
937 |                 .join(&args[0])
    |                       ^^^^^^^^ help: change this to: `args[0]`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args

Copy link
Collaborator

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?

.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);
Copy link
Member

Choose a reason for hiding this comment

The 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?

Copy link
Author

@zhizhi-dev zhizhi-dev Mar 19, 2026

Choose a reason for hiding this comment

The 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)
Expand Down
Loading