Skip to content

Commit dfd0a9c

Browse files
Copilotlpcox
andauthored
fix(chroot): detect cargo binaries when CARGO_HOME unset (#750)
* Initial plan * fix: add fallback for Cargo PATH detection in chroot mode When AWF_CARGO_HOME is not set, detect and add ~/.cargo/bin to PATH. This ensures Rust binaries (rustc, cargo) are accessible even when CARGO_HOME environment variable is not explicitly provided. Fixes the chroot package manager test failure where rustc was not found in PATH despite being installed at the default location. Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
1 parent b0ec54e commit dfd0a9c

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

containers/agent/entrypoint.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,11 @@ AWFEOF
293293
echo "[entrypoint] Adding CARGO_HOME/bin to PATH: ${AWF_CARGO_HOME}/bin"
294294
echo "export PATH=\"${AWF_CARGO_HOME}/bin:\$PATH\"" >> "/host${SCRIPT_FILE}"
295295
echo "export CARGO_HOME=\"${AWF_CARGO_HOME}\"" >> "/host${SCRIPT_FILE}"
296+
else
297+
# Fallback: detect Cargo from default location if CARGO_HOME not provided
298+
# This ensures Rust binaries work even when CARGO_HOME env var is not set
299+
echo "# Add Cargo bin for Rust if it exists (fallback when CARGO_HOME not provided)" >> "/host${SCRIPT_FILE}"
300+
echo "[ -d \"\$HOME/.cargo/bin\" ] && export PATH=\"\$HOME/.cargo/bin:\$PATH\"" >> "/host${SCRIPT_FILE}"
296301
fi
297302
# Add JAVA_HOME/bin to PATH if provided (for Java on GitHub Actions)
298303
# Also set LD_LIBRARY_PATH to include Java's lib directory for libjli.so

0 commit comments

Comments
 (0)