Skip to content

env: support --env0-from - #14609

Open
wtcpython wants to merge 1 commit into
uutils:mainfrom
wtcpython:env-env0-from
Open

wtcpython wants to merge 1 commit into
uutils:mainfrom
wtcpython:env-env0-from

Conversation

@wtcpython

@wtcpython wtcpython commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Closes #14602.

Support --env0-from=FILE to read environment variables from a NUL-delimited file, matching GNU env 9.12.

Should make test tests/env/env0-from.sh pass

@wtcpython
wtcpython marked this pull request as ready for review September 17, 2026 01:40
Copilot AI lite review requested due to automatic review settings September 17, 2026 01:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

github-actions Bot commented Sep 17, 2026 •

Copy link
Copy Markdown

GNU testsuite comparison:

Congrats! The gnu test tests/env/env0-from is no longer failing!
Congrats! The gnu test tests/id/setgid is no longer failing!

@oech3

oech3 commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

#14626 was submitted at 1st

Copilot AI review requested due to automatic review settings September 17, 2026 13:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings September 19, 2026 18:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings September 20, 2026 14:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings September 21, 2026 00:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings September 21, 2026 06:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings September 21, 2026 06:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings September 21, 2026 07:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings September 23, 2026 00:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings September 25, 2026 00:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings September 27, 2026 00:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings September 29, 2026 06:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Comment thread tests/by-util/test_env.rs Outdated
.succeeds()
.stdout_move_str();

assert!(!out.lines().any(|line| line == "UU_ENV0_OPAQUE_14609"));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the assert should be without negation. If I manually run the command with GNU env (printf "UU_ENV0_OPAQUE_14609\0" | env --env0-from=-), the string shows up in the list.

Copilot AI review requested due to automatic review settings September 29, 2026 08:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings September 29, 2026 09:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings September 29, 2026 11:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI lite review requested due to automatic review settings September 30, 2026 03:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI lite review requested due to automatic review settings October 1, 2026 11:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

Review effort: Lite
Findings: 2 High severity · 2 Medium severity

Open (4)

Comment thread src/uu/env/src/env.rs
Comment on lines +1050 to +1061
unsafe {
let mut ptr = *environ();
while !(*ptr).is_null() {
let cstr = std::ffi::CStr::from_ptr(*ptr);
writer.write_all(cstr.to_bytes())?;
match opts.line_ending {
LineEnding::Nul => writer.write_all(b"\0")?,
LineEnding::Newline => writer.write_all(b"\n")?,
}
ptr = ptr.add(1);
}
}
Comment thread src/uu/env/src/env.rs
Comment on lines +1165 to +1169
let orig = envp_ptrs.as_mut().map(|ptrs| unsafe {
let p = *environ();
*environ() = ptrs.as_mut_ptr();
p
});
Comment thread src/uu/env/src/env.rs
Comment on lines +334 to +337
entry
.iter()
.position(|&b| b == b'=')
.map(|pos| &entry[..pos])
Comment thread src/uu/env/src/env.rs
Comment on lines +1198 to +1207
cmd.env_clear();
for entry in entries {
if let Some(key) = entry_key(entry) {
let val = &entry[key.len() + 1..];
if let (Ok(k), Ok(v)) = (std::str::from_utf8(key), std::str::from_utf8(val))
{
cmd.env(k, v);
}
}
}

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add --env0-from option to env

4 participants