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

fix(dracut.sh): kmoddir does not handle trailing / #2237

Merged
merged 1 commit into from Feb 27, 2023

Conversation

pvalena
Copy link
Contributor

@pvalena pvalena commented Feb 24, 2023

Fixes #2236

+(/) only works in bash interactive mode. Using any non-interactive bash run simply doesn't remove anything.

The solution is copied from dracut-lib.sh, trim().

Changes

Trailing / for kmoddir variable are now handled properly.

Checklist

  • I have tested it locally
  • I have reviewed and updated any documentation if relevant
  • I am providing new code and test(s) for it

Fixes #2236

Fixes dracutdevs#2236

+(/) only works in bash interactive mode. Using any non-interactive
bash run simply doesn't remove anything.

The solution is copied from dracut-lib.sh, trim().
@pvalena
Copy link
Contributor Author

pvalena commented Feb 24, 2023

Note: I've checked for similar code and found only:

dracut-functions.sh:    local p=${1//+(\/)//}
modules.d/90mdraid/module-setup.sh:            -e '/(RUN|IMPORT\{program\})\+?="[[:alpha:]/]*mdadm[[:blank:]]+(--incremental|-I)[[:blank:]]+(--export )?(\$env\{DEVNAME\}|\$tempnode|\$devnode)/d' \

@pvalena
Copy link
Contributor Author

pvalena commented Feb 24, 2023

RHBZ for reference: https://bugzilla.redhat.com/show_bug.cgi?id=2173100#

Copy link
Member

@aafeijoo-suse aafeijoo-suse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad, thanks for the fix.

Copy link
Collaborator

@LaszloGombos LaszloGombos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@LaszloGombos LaszloGombos merged commit 1ddcb13 into dracutdevs:master Feb 27, 2023
66 of 74 checks passed
@@ -1033,7 +1033,7 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
((stdloglvl < 0)) && stdloglvl=0

[[ $drivers_dir_l ]] && drivers_dir=$drivers_dir_l
drivers_dir="${drivers_dir%%+(/)}"
drivers_dir="${drivers_dir%"${drivers_dir##*[!/]}"}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, you could call normalize_path() on the dir. That also replaces multiple / inside the path by a single one, but I don't think that is a problem...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I didn't know that exists. Probably a better solution.

@pvalena pvalena deleted the fix-2236 branch February 27, 2023 14:48
LaszloGombos pushed a commit to LaszloGombos/dracut that referenced this pull request Mar 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

dracut --kmoddir fails on paths with traling /
4 participants