Skip to content

Fix config.py --help when the current directory contains a percent character #162

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

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

Conversation

gilles-peskine-arm
Copy link
Contributor

Fix config.py --help raising an exception (or otherwise misbehaving, in rare cases) when the current working directory contains a percent character. This was due to a percent escape bug.

To check for similar issues, I used the following code, which searches in all Python files for help="...".format or help="..."% or help="...%...", allowing for different quote characters.

git ls-files --recurse-submodules '*.py' | xargs perl -000 -ne 'while (/(help=("""|"(?!")|\x27\x27\x27|\x27(?!\x27))(.*?)\2\s*(\.format|%)?)/sg) { printf "%s:%d:%s\n\n", $ARGV, $., $1 if defined $4 or $2 =~ /%/ } }continue{ close ARGV if eof'

PR checklist

  • TF-PSA-Crypto PR not required because: no problem found in crypto
  • development PR TODO (but can be done independently)
  • 3.6 PR provided

Fix `config.py --help` raising an exception (or otherwise misbehaving, in
rare cases) when the current working directory contains a percent character.
This was due to a percent escape bug.

Signed-off-by: Gilles Peskine <[email protected]>
@gilles-peskine-arm gilles-peskine-arm added bug Something isn't working priority-medium Medium priority - this can be reviewed as time permits size-xs Estimated task size: extra small (a few hours at most) labels Apr 16, 2025
@gilles-peskine-arm gilles-peskine-arm added needs-review Every commit must be reviewed by at least two team members, needs-reviewer This PR needs someone to pick it up for review labels Apr 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-review Every commit must be reviewed by at least two team members, needs-reviewer This PR needs someone to pick it up for review priority-medium Medium priority - this can be reviewed as time permits size-xs Estimated task size: extra small (a few hours at most)
Projects
Status: In Development
Development

Successfully merging this pull request may close these issues.

1 participant