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

dracut --kmoddir fails on paths with traling / #2236

Closed
pvalena opened this issue Feb 24, 2023 · 1 comment · Fixed by #2237
Closed

dracut --kmoddir fails on paths with traling / #2236

pvalena opened this issue Feb 24, 2023 · 1 comment · Fixed by #2237
Labels

Comments

@pvalena
Copy link
Contributor

pvalena commented Feb 24, 2023

Describe the bug
There's an error in recently added commit 2c2bd86#diff-99bfb8fe311d6a59318f685a5e3401b59293b577968aa08cc4ff7320a163bb28R1034

The code added in the commit only works in interactive mode:

$ cat example.sh
set -x

drivers_dir=/root/test/tmp/lib/modules/6.2.0-63.fc39.x86_64+debug/
drivers_dir="${drivers_dir%%+(/)}"

Note the trailing / which the last line of the example.sh was supposed to remove:

$ bash example.sh
+ drivers_dir=/root/test/tmp/lib/modules/6.2.0-63.fc39.x86_64+debug/
+ drivers_dir=/root/test/tmp/lib/modules/6.2.0-63.fc39.x86_64+debug/

Only way I was able to trigger the correct behaviour was an interactive mode:

$ bash -i < example.sh
stty: 'standard input': Inappropriate ioctl for device
$ set -x
$
$ drivers_dir=/root/test/tmp/lib/modules/6.2.0-63.fc39.x86_64+debug/
+ drivers_dir=/root/test/tmp/lib/modules/6.2.0-63.fc39.x86_64+debug/
$ drivers_dir="${drivers_dir%%+(/)}"
+ drivers_dir=/root/test/tmp/lib/modules/6.2.0-63.fc39.x86_64+debug
$ exit

Distribution used
Fedora Rawhide

Dracut version
059

Init system
systemd

To Reproduce

Add trailing / to kmoddir:

$ dracut -f --kmoddir /lib/modules/`uname -r`/
dracut: drivers_dir path set via -k/--kmoddir must contain "/lib/modules/" as a parent of your kernel module directory,
dracut: or modules may not be placed in the correct location inside the initramfs.
dracut: was given: /lib/modules/6.1.12-200.fc37.x86_64/
dracut: expected: /lib/modules/6.1.12-200.fc37.x86_64/lib/modules/6.1.12-200.fc37.x86_64
dracut: Please move your modules into the correct directory structure and pass the new location,
dracut: or set DRACUT_KMODDIR_OVERRIDE=1 to ignore this check.

Expected behavior
Trailing / removed.

Additional context

@pvalena pvalena added the bug Our bugs label Feb 24, 2023
@pvalena
Copy link
Contributor Author

pvalena commented Feb 24, 2023

I have a simple fix - will submit PR now.

pvalena added a commit to pvalena/dracut that referenced this issue Feb 24, 2023
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().
LaszloGombos pushed a commit that referenced this issue Feb 27, 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().
aafeijoo-suse pushed a commit to aafeijoo-suse/dracut that referenced this issue Jun 15, 2023
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().

(cherry picked from commit 1ddcb13)
pvalena added a commit to pvalena/dracut that referenced this issue Jul 23, 2023
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().
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 a pull request may close this issue.

2 participants