env: trace environment changes with -v - #14263
Open
wtcpython wants to merge 1 commit into
Open
Conversation
|
Binary size comparison: |
|
GNU testsuite comparison: |
sylvestre
reviewed
Aug 30, 2026
| )); | ||
| } | ||
| // GNU traces only the unsets that remove something | ||
| if opts.debug && env::var_os(name).is_some() { |
Contributor
There was a problem hiding this comment.
GNU prints unset: unconditionally, even for a variable that isn't set or an invalid name
sylvestre
reviewed
Aug 30, 2026
| assert_eq!(result.stderr_str(), "unset: ENV_VERBOSE_UNSET_ME\n"); | ||
|
|
||
| // unsetting a variable that does not exist is not traced | ||
| let result = new_ucmd!() |
Contributor
There was a problem hiding this comment.
GNU does trace it. Should expect unset: ENV_VERBOSE_NOT_SET
sylvestre
reviewed
Aug 30, 2026
| ); | ||
| continue; | ||
| } | ||
| if opts.debug { |
Contributor
There was a problem hiding this comment.
to_string_lossy() mangles non-UTF-8 args - GNU passes the raw bytes through. Write the OsStr bytes to stderr instead. Same at line 1065.
wtcpython
force-pushed
the
env-verbose-trace
branch
2 times, most recently
from
August 31, 2026 01:45
450d95a to
85d29c9
Compare
wtcpython
force-pushed
the
env-verbose-trace
branch
from
September 7, 2026 03:13
85d29c9 to
5abae63
Compare
Contributor
Author
|
@sylvestre ready |
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.
Fixes #14171.
GNU traces each environment change in verbose mode, and
-vvis just-vrepeated. We printed nothing for
-vand dumped the input args for-vv.Print the same trace lines as GNU (
cleaning environ,setenv,unset,chdir) and drop the argument dump. Add tests for the traced output and for-vvmatching-v.