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: only long options are allowed to contain '=' #6711

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

stefan-bellmann
Copy link

@stefan-bellmann stefan-bellmann commented Sep 17, 2024

Enhance argument validation for unset command

Fixes #6166

Description

This change improves the argument validation logic for the unset command. It specifically addresses the handling of arguments containing the '=' character and ensures that only long options (starting with '--') are allowed to contain this character.

Changes

  • Add a check to validate if an argument contains the '=' character
  • Implement an additional check that ensures that short options '-' used with '=' assignment are treated as invalid arguments
  • Return an error with a descriptive message for invalid arguments

Impact

This change enhances the robustness of the unset command by preventing potential misuse or confusion when users provide arguments with the '=' character in short option format.

@cakebaker cakebaker changed the title fix: only long options are allowed to contain '=' env: only long options are allowed to contain '=' Sep 17, 2024
@stefan-bellmann stefan-bellmann force-pushed the fix_issue_6166_env_minus_u_should_be_rejected branch from dec45a3 to 1fd5012 Compare September 17, 2024 14:55
@stefan-bellmann stefan-bellmann marked this pull request as draft September 17, 2024 15:08
@stefan-bellmann stefan-bellmann force-pushed the fix_issue_6166_env_minus_u_should_be_rejected branch from 1fd5012 to f0fd458 Compare September 17, 2024 15:15
@stefan-bellmann stefan-bellmann force-pushed the fix_issue_6166_env_minus_u_should_be_rejected branch from f0fd458 to d6cd10d Compare September 17, 2024 15:17
Copy link

GNU testsuite comparison:

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

@sylvestre
Copy link
Contributor

please also add a test in tests/by-util/test_env.rs to make sure we don't regress

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 -0 -u=o 6=C should be rejected
2 participants