-
-
Notifications
You must be signed in to change notification settings - Fork 56
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
Better parsing of command-line options #90
base: master
Are you sure you want to change the base?
Conversation
I don't like this part - the list can easily de-synchronize, there are also some actions that takes extra arguments (like repoquery). Having
This part is fine. |
What about explicitly detecting known bad cases and exiting with a an error message? Ultimately I would like to do something like split-gpg1 and only allow command-line arguments we understand, so that we know we have not made any mistakes. The DNF version in dom0 is frozen, so we should be able to do this unambiguously. What do you think? |
Changed so that |
Yes. this one is ok.
There are several actions that are limited to the call in updatevm only (like search, or list), repoquery should also be one of them. For those, we don't have frozen set of supported options. |
OpenQA test summaryComplete test suite and dependencies: https://openqa.qubes-os.org/tests/overview?distri=qubesos&version=4.1&build=2022040304-4.1&flavor=pull-requests New failures, excluding unstableCompared to: https://openqa.qubes-os.org/tests/overview?distri=qubesos&version=4.1&build=2022031706-4.1&flavor=update
Failed tests33 failures
Fixed failuresCompared to: https://openqa.qubes-os.org/tests/36922#dependencies 4 fixed
Unstable tests
|
With this PR, I tried to get more details by adding So, please:
And only then convert back to non-draft. |
This makes qubes-dom0-update aware of various command-line options that take arguments, so it can process them accordingly. It is not a perfect solution; that would require using a C wrapper program to reject abbreviated or unknown options. It also uses bash regex matching instead of the `echo | grep` anti-pattern, replaces an `==` with `=`, adds a missing `--`, and unsets a variable that will be checked for being set later. The same approach used here could be used to refactor qubes-gpg-client-wrapper if it were worth the time, which it probably isn’t unless qubes-gpg-client-wrapper will see future use.
The previous commit tried to fix up incorrectly passed options, but that didn't always work. Instead, try to detect known bad options (on a best-effort basis) and print an error message.
This changes the error message to a warning and fixes up the user's mistake.
1b5e47a
to
0be9c7e
Compare
This makes qubes-dom0-update aware of various command-line options that
take arguments, so it can process them accordingly. It is not a perfect
solution; that would require using a C wrapper program to reject
abbreviated or unknown options. It also uses bash regex matching
instead of the
echo | grep
anti-pattern, replaces an==
with=
,adds a missing
--
, and unsets a variable that will be checked forbeing set later.
The same approach used here could be used to refactor
qubes-gpg-client-wrapper if it were worth the time, which it probably
isn’t unless qubes-gpg-client-wrapper will see future use.
Marking as draft because I have not tested it yet. I will test it once more time becomes available.