[LXC] Honor process.cwd and process.env in the LXC backend#494
Open
SohamDas2021 wants to merge 3 commits into
Open
[LXC] Honor process.cwd and process.env in the LXC backend#494SohamDas2021 wants to merge 3 commits into
SohamDas2021 wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes two contract violations in the Linux LXC backend by ensuring process.cwd and process.env from the config are actually applied when executing inside the container, and adds targeted tests to prevent regressions.
Changes:
- Pass
ExecutionRequest.envthrough the LXC runner into thelxc-attachinvocation. - Honor
process.cwdby wrapping the inner command with acdprelude that avoids additional shell-escaping needs. - Add a new LXC env+cowd regression test (config + runner script) and include it in the LXC test suite.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/scripts/run_lxc_env_cwd_test.sh | Adds a regression script that exercises process.cwd and process.env end-to-end via lxc-exec. |
| tests/scripts/run_lxc_all_tests.sh | Wires the new env+cwd test into the overall LXC test runner. |
| tests/configs/lxc_env_cwd_test.json | Adds a config that self-validates cwd and env propagation inside the container via distinct exit codes. |
| src/backends/lxc/common/src/lxc_runner.rs | Ensures the LXC backend passes request env/cwd into container execution. |
| src/backends/lxc/common/src/lxc_bindings.rs | Implements env (--set-var=...) and cwd plumbing for lxc-attach, with unit tests for argv construction. |
Contributor
Author
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
huzaifa-d
approved these changes
Jun 4, 2026
bbonaby
approved these changes
Jun 5, 2026
| fn build_attach_args(env: &[String], working_directory: &str, command: &str) -> Vec<String> { | ||
| let mut args: Vec<String> = Vec::with_capacity(env.len() + 6); | ||
|
|
||
| // Each `KEY=VAL` becomes a separate `--set-var=KEY=VAL`. Skip entries |
Collaborator
There was a problem hiding this comment.
thought: wonder if we should print a warning when we do things like skipping.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📖 Description
Fixes two silent-contract violations in the LXC backend:
process.cwdandprocess.envfrom the config were both ignored, so every container ran from/with no user-supplied environment regardless of what the JSON requested.🔗 References
🔍 Validation
✅ Checklist
📋 Issue Type
Microsoft reviewers: PR builds don't auto-run (ADO policy). Comment
/azp runto start
MXC-PR-Build. See docs/pull-requests.md.Microsoft Reviewers: Open in CodeFlow