-
Notifications
You must be signed in to change notification settings - Fork 401
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
Avoid using nullglob option and fix dracut-install #1762
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
862001a
to
5915072
Compare
When running dracut-install with '-o' (optional source), and nullglob at the same time, when all of the arguments evaluate <null>, dracut-install should not fail even when the source is not specified.
This reverts commit 3506476, to replace the implementation.
Avoid using shell options in findkeymap, instead of using a wrapper[*] to restore the previous options. Using mapfile and find to generate the list of files also has the benefit of being more readable in this case. [*] Reverted commit 3506476 Original issue description from Michal Hecko <[email protected]>: The findkeymap function manipulates the shell options and relies on restoring them using the trap. However, as the function might be called recursively, each recursive invocation changes the signal handler to its own. As the recursion is entered with shell options already modified, the changed trap handler is replaced with restoration to the modified shell options, not the original ones.
I've run some tests (automated & manual) and fixed the remaining issues. Testskeymapfile: https://gist.github.com/f6048df4d7f2a2d609974283a674b9fd |
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
Thanks! |
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
as there's a check for file existence (and it being a regular file), recommended in the scriplet and I think prefered. Related: dracutdevs#1762
Glob is in most cases not expected to evaluate to null. To avoid unexpected failures, don't use the
nullglob
option.I've found no code (WRT the modifications applied) where nullglob is needed, as the variable is either checked explicitly by
[[ -f $file ]]
, or passed toinst_multiple -o
where the file string is actually expected instead. I think more code is actually expecting an invalid argument instead of missing one (f.e.cp
), so this increases resiliency.Changes
nullglob
option usemapfile
(recursion overwritestrap
setting)dracut-install
not to fail when-o
is specified, but no source is specifiedChecklist
Additional
E.g., a PR which I don't think should be needed: msekletar/prefixdevname#1
Tests
keymapfile: https://gist.github.com/f6048df4d7f2a2d609974283a674b9fd
dracut-install: https://gist.github.com/07171bb36863394728852810b21c026f