-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Disable allow_abbrev from Python scripts using argparse #9294
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
base: development
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok by me, but I've circulated this within the maintenance team in case some people want to.
For consistency, please make a companion pull request to https://github.com/Mbed-TLS/mbedtls-framework for the scripts in the framework submodule.
Also, if we decide this as a policy, we should add a note to the Python coding standards.
Added backports to 3.6 and 2.28 and created PR Mbed-TLS/mbedtls-framework#29 to update the scripts in the framework submodule. |
Please add a commit to update the framework submodule to the head of Mbed-TLS/mbedtls-framework#29. We'll ask you to update that commit again when the framework pull request is merged. We currently need this process to deal with the CI in the framework repository, we're still working on improving the automation. |
I'm removing |
scripts/config.py
Outdated
@@ -485,8 +485,9 @@ def write(self, filename=None): | |||
def main(): | |||
"""Command line mbedtls_config.h manipulation tool.""" | |||
parser = argparse.ArgumentParser(description=""" | |||
Mbed TLS configuration file manipulation tool. | |||
""") | |||
Mbed TLS configuration file manipulation tool. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pylint is unhappy about the indentation.
To reproduce the CI failure:
scripts/min_requirements.py
tests/scripts/check-python-files.sh
You'll probably want to do this in a virtual environment with a Python version that isn't too recent, otherwise Pylint complains more. Just make sure
pylint scripts/config.py
doesn't complain about indentation anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the updates, looks good to me
Hi @gilles-peskine-arm, |
Nothing, I'm afraid. We need to find review bandwidth and that's always a problem. |
Python's argparse library, by default, allows shortening of command line arguments. This can introduce silent failures when shortened commands are used and another command is added to the script which uses that name. Signed-off-by: Juha Ylinen <[email protected]>
Fix indentation error in scripts/config.py Signed-off-by: Juha Ylinen <[email protected]>
Signed-off-by: Juha Ylinen <[email protected]>
fa8d1cc
to
6252607
Compare
Rebased |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
A lot of scripts have moved to https://github.com/Mbed-TLS/mbedtls-framework now. Those are unified between the development and 3.6 branches. |
Description
Python's argparse library, by default, allows shortening of command line arguments. This can introduce silent failures when shortened commands are used and another command is added to the script which uses that name.
This change sets ArgumentParser parameter allow_abbrev to False.
PR checklist