Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

env: fix only long options are allowed to contain '=' #7008

Merged
merged 8 commits into from
Dec 31, 2024

Conversation

jovielarue
Copy link
Contributor

This fixes #6165 and was adapted from #6711.

This PR contains changes that ensure short options (-u) do not have '=' as their arguments' first character in accordance with GNU/POSIX standards.

Tests were added to ensure this change does not regress.

@jovielarue jovielarue marked this pull request as draft December 28, 2024 03:20
Copy link

GNU testsuite comparison:

GNU test failed: tests/misc/printenv. tests/misc/printenv is passing on 'main'. Maybe you have to rebase?
Skipping an intermittent issue tests/timeout/timeout (passes in this run but fails in the 'main' branch)

@sylvestre
Copy link
Contributor

great progress, thanks!

GNU test failed: tests/misc/printenv. tests/misc/printenv is passing on 'main'. Maybe you have to rebase?

Looks like a regression

@jovielarue
Copy link
Contributor Author

I'm having trouble replicating the printenv test failure from github-actions. ./run-gnu-test.sh tests/misc/printenv.sh and cargo test test_printenv are both passing for me with my changes. I'm not sure how to proceed. Do you have any suggestions on how I can debug this?

Copy link

GNU testsuite comparison:

GNU test failed: tests/misc/printenv. tests/misc/printenv is passing on 'main'. Maybe you have to rebase?
Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)

@sylvestre
Copy link
Contributor

The log says:


2024-12-28T21:05:03.0260690Z FAIL: tests/misc/printenv
2024-12-28T21:05:03.0260751Z =========================
2024-12-28T21:05:03.0260755Z 
2024-12-28T21:05:03.0260843Z env: cannot unset '=b': Invalid argument
2024-12-28T21:05:03.0260916Z --- exp	2024-12-28 20:53:00.649621280 +0000
2024-12-28T21:05:03.0260997Z +++ out	2024-12-28 20:53:00.649621280 +0000
2024-12-28T21:05:03.0261058Z @@ -1 +0,0 @@
2024-12-28T21:05:03.0261117Z -b
2024-12-28T21:05:03.0261218Z FAIL tests/misc/printenv.sh (exit status: 1)

@sylvestre
Copy link
Contributor

@jovielarue
Copy link
Contributor Author

Oh, got it. I was ensuring that all short options could not contain '=', but that is not correct. It should just be the short unset option (-u) that cannot contain '=' as its first character. I committed a change to fix this.

I've tested this with that line of code directly (not sure why it wasn't catching on my system as it was running the same tests; I suppose it could be because I am using fish shell to run these tests), and run all relevant tests. I believe it should pass now.

@jovielarue jovielarue marked this pull request as ready for review December 29, 2024 19:56
Copy link

GNU testsuite comparison:

Skipping an intermittent issue tests/timeout/timeout (passes in this run but fails in the 'main' branch)

@cakebaker cakebaker merged commit 646fc39 into uutils:main Dec 31, 2024
63 checks passed
@cakebaker
Copy link
Contributor

Thanks for your PR :)

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.

env -u=2EKt should generate an error
3 participants