Skip to content

env: GNU-compatibility fixes#11512

Draft
can1357 wants to merge 4 commits intouutils:mainfrom
can1357:env-gnu-compat
Draft

env: GNU-compatibility fixes#11512
can1357 wants to merge 4 commits intouutils:mainfrom
can1357:env-gnu-compat

Conversation

@can1357
Copy link
Copy Markdown
Contributor

@can1357 can1357 commented Mar 26, 2026

-S accepts non-GNU variable expansion (${FOO:-default}, $FOO)

GNU only allows ${VARNAME} in env -S; anything else errors. uutils accepts extra forms and expands them into argv, so invalid input that should fail can still run.

-C/--chdir runs too early

uutils does chdir before env/signal setup. GNU does env/signal setup first, then chdir right before exec. So with -C + env/config flags, behavior differs and uutils can fail earlier in a different directory context.

-S/--split-string option forms are misparsed and can change argv

uutils pre-parses -S/--split-string in a non-standard way. -S ARG / --split-string ARG can act like empty payload, and --split-string=ARG can tokenize with leading =.

env --split-string="printf Y:%s\\n three"
GNU: Y:three
uutils: malformed parse + exec fail (127)

-S rejects backslashes in single quotes that GNU treats literally

In single quotes, GNU keeps backslashes literal (except \\ and \'). uutils errors on sequences like \a with 125.

env -S"printf %s '\''\\x'\''"
GNU: prints \x
uutils: invalid sequence '\x' in -S (125)

@github-actions
Copy link
Copy Markdown

GNU testsuite comparison:

GNU test failed: tests/env/env-S. tests/env/env-S is passing on 'main'. Maybe you have to rebase?
Skipping an intermittent issue tests/date/date-locale-hour (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/tty/tty-eof (passes in this run but fails in the 'main' branch)
Note: The gnu test tests/csplit/csplit-heap is now being skipped but was previously passing.
Note: The gnu test tests/cut/bounded-memory is now being skipped but was previously passing.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Mar 26, 2026

Merging this PR will improve performance by 13.59%

⚡ 1 improved benchmark
✅ 299 untouched benchmarks
⏩ 46 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Memory cp_recursive_deep_tree[(120, 4)] 699.2 KB 615.6 KB +13.59%

Comparing can1357:env-gnu-compat (ecc28f7) with main (3dec656)

Open in CodSpeed

Footnotes

  1. 46 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

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.

1 participant