Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#22821 - [mkinitcpio] skips "encrypt" hook if "plymouth-encrypt" specified in arguments

Attached to Project: Arch Linux
Opened by Sergey Zolotorev (serzh-z) - Tuesday, 08 February 2011, 20:50 GMT
Last edited by Thomas Bächler (brain0) - Sunday, 27 March 2011, 11:03 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To Thomas Bächler (brain0)
Architecture All
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

Description:

It seems there is an invalid grep call in mkinitcpio. So mkinitcpio skips extra hooks if dash appears in hook name specified in argument list as part of "-S" option.

For example: "encrypt" hook will be skipped also if you specified "-S plymouth-encrypt" or "base" hook will be skipped if you specified "-S bug-base".

Additional info:

mkinitcpio-0.6.8-1


Steps to reproduce:

1. Run mkinitcpio with "-S hook_name_with_dash": mkinitcpio -S bug-base
=> Parsing of "base" hook will be skipped
This task depends upon

Closed by  Thomas Bächler (brain0)
Sunday, 27 March 2011, 11:03 GMT
Reason for closing:  Fixed
Additional comments about closing:  Fixed in git for the next release.
Comment by Gerardo Exequiel Pozzi (djgera) - Tuesday, 08 February 2011, 21:06 GMT
  • Field changed: Summary (mkinitcpio skips "encrypt" hook if "plymouth-encrypt" specified in arguments ("-S plymouth-encrypt") → [mkinitcpio] skips "encrypt" hook if "plymouth-encrypt" specified in arguments)
  • Field changed: Status (Unconfirmed → Assigned)
  • Task assigned to Thomas Bächler (brain0)
hooks names must not contain "-", use "_" instead (disablehooks does not work with it)
Comment by Thomas Bächler (brain0) - Tuesday, 08 February 2011, 21:13 GMT
Hooks with dashes are problematic, but should still work. Stupid 'grep -qw' fails all the time, does anyone have a good idea to fix it?
Comment by Sergey Zolotorev (serzh-z) - Tuesday, 08 February 2011, 21:41 GMT
Maybe do the something following?

for hook in ${HOOKS}; do
hook=$(echo ${hook} | sed 's/-/_/')
echo "${SKIPHOOKS}" | sed 's/-/_/' | grep -qw ${hook} && continue
...

So '-w' will not split words by '-' anymore.
Comment by Sergey Zolotorev (serzh-z) - Tuesday, 08 February 2011, 21:47 GMT
> hooks names must not contain "-", use "_" instead (disablehooks does not work with it)

If it is not possible to use dashes in hook names then, I believe, mkinitcpio must stop building initramfs image with some WARNING message. Because user can get broken image (without cryptsetup capabilites) and will need some LiveCD to load system and fix initramfs image. There is an example: I have such case today... but reviewing mkinitcpio build output before rebooting saved me.
Comment by Jan de Groot (JGC) - Thursday, 10 February 2011, 19:26 GMT
Isn't that fixable by using grep -wq -- ${hook} instead?
Comment by Sergey Zolotorev (serzh-z) - Thursday, 10 February 2011, 21:47 GMT
Jan, see the following:

$ echo hook-foo,hook-bar | grep -qw -- bar ; echo $?
0

$ echo hook-foo,hook-bar | sed 's/-/_/g' | grep -w -- bar ; echo $?
1
Comment by Thomas Bächler (brain0) - Sunday, 27 February 2011, 11:18 GMT

Loading...