BUG in mkinitrd Prevents Silent Bootsplash
SuSE Pro v9.0. After YOU updated my machine to kernel v2.4.21-238 the other day, the SuSE 'silent' bootsplash screen no longer worked (the one with the 'progress bar'). All attempts to fix it failed. Only "verbose" mode worked. Evidently '/sbin/mkinitrd' script was updated as part of a recent YOU upgrade. Perhaps as part of the v2.4.21-238 upgrade? The new '/sbin/mkinitrd' script (rev 1.23 on my machine) has a *BUG* in the RegExp used to extract the "vga=..." value found in the GRUB 'menu.lst' file and the LILO 'lilo.conf' file. There is only one set of parens in the RegExp found at line 292 (inside the "for vga in..." block), but there should be two. Here's the 'diff' output (line-wrapped by the e-mailer of course); I've put carets (^) below the missing close and open parens that need to be added to make it work correctly again: 292c292 < -e 's/^.*[ \t]*vga [ \t]*=[\t]*\([0-9]\+\|0[xX][0-9a-fA-F]\+\).*$/\1/p'` ; do ---
-e 's/^.*[ \t]*vga [ \t]*=[\t]*\([0-9]\+\)\|\(0[xX][0-9a-fA-F]\+\).*$/\1/p'` ; do ^^ ^^ As 'root':
1) Make a backup copy of the original '/sbin/mkinitrd' before making this change (just in case...). 2) Edit '/sbin/mkinitrd' to make the change 3) Execute 'mkinitrd'. It should output a "Bootsplash:..." message as part of its diagnostics. That tells you it worked ok. 4) The 'silent' bootsplash will work correctly the next time the machine is booted. Regards, Larry
On Thursday 12 August 2004 22:51, Larry I Smith wrote:
The new '/sbin/mkinitrd' script (rev 1.23 on my machine) has a *BUG* in the RegExp used to extract the "vga=..." value found in the GRUB 'menu.lst' file and the LILO 'lilo.conf' file. There is only one set of parens in the RegExp found at line 292 (inside the "for vga in..." block), but there should be two. Here's the 'diff' output (line-wrapped by the e-mailer of course); I've put carets (^) below the missing close and open parens that need to be added to make it work correctly again:
292c292 < -e 's/^.*[ \t]*vga [ \t]*=[\t]*\([0-9]\+\|0[xX][0-9a-fA-F]\+\).*$/\1/p'` ; do ---
-e 's/^.*[ \t]*vga
[ \t]*=[\t]*\([0-9]\+\)\|\(0[xX][0-9a-fA-F]\+\).*$/\1/p'` ; do ^^ ^^
No, this is wrong. The bug is there, but the fix is bad. If it works, it's by accident. Your regexp will match far too much, especially if there are other lines that use hexadecimal variables (hint: logical or now suddenly applies to the entire expression instead of just the parenthesis) This is my first attempt at a fix [ \t]*=[\t]*\(0[xX][0-9a-fA-F]\+\|[0-9]\+\).*$/\1/p'` ; do or possibly [ \t]*=[\t]*\([0-9][0-9][0-9]\|0[xX][0-9a-fA-F]\+\).*$/\1/p'` ; do
Anders Johansson wrote:
On Thursday 12 August 2004 22:51, Larry I Smith wrote:
The new '/sbin/mkinitrd' script (rev 1.23 on my machine) has a *BUG* in the RegExp used to extract the "vga=..." value found in the GRUB 'menu.lst' file and the LILO 'lilo.conf' file. There is only one set of parens in the RegExp found at line 292 (inside the "for vga in..." block), but there should be two. Here's the 'diff' output (line-wrapped by the e-mailer of course); I've put carets (^) below the missing close and open parens that need to be added to make it work correctly again:
292c292 < -e 's/^.*[ \t]*vga [ \t]*=[\t]*\([0-9]\+\|0[xX][0-9a-fA-F]\+\).*$/\1/p'` ; do ---
-e 's/^.*[ \t]*vga
[ \t]*=[\t]*\([0-9]\+\)\|\(0[xX][0-9a-fA-F]\+\).*$/\1/p'` ; do ^^ ^^
No, this is wrong. The bug is there, but the fix is bad. If it works, it's by accident. Your regexp will match far too much, especially if there are other lines that use hexadecimal variables (hint: logical or now suddenly applies to the entire expression instead of just the parenthesis)
This is my first attempt at a fix
[ \t]*=[\t]*\(0[xX][0-9a-fA-F]\+\|[0-9]\+\).*$/\1/p'` ; do
or possibly
[ \t]*=[\t]*\([0-9][0-9][0-9]\|0[xX][0-9a-fA-F]\+\).*$/\1/p'` ; do
I disagree. Remember the original is on one line; the emailer has split it onto two lines: -e 's/^.*[ \t]*vga [ \t]*=[\t]*\([0-9]\+\)\|\(0[xX][0-9a-fA-F]\+\).*$/\1/p'` The above should match "vga=" followed by a decimal number (e.g. vga=779), -or- "vga=" followed by a hex number (e.g. vga=0x31a). I've tried numerous values (both valid and invalid) for "vga=..." in 'menu.lst' and they all worked as expected. Here's the entire block (although the email wrap-at-col-72 might make it hard to read): Note that 'splash="auto"' at script start unless 'mkinitrd -s' was specified: -- snip --- # handle splash screen [ "x$splash" = xoff ] && splash= if [ "x$splash" = xauto ] ; then splash= vgascan=/dev/null [ -f $root_dir/etc/lilo.conf ] \ && vgascan="$vgascan $root_dir/etc/lilo.conf" [ -f $root_dir/boot/grub/menu.lst ] \ && vgascan="$vgascan $root_dir/boot/grub/menu.lst" for vga in `cat $vgascan \ | sed -ne '/^[ \t]*#/d' \ -e 's/^.*[ \t]*vga[ \t]*=[ \t]*\([0-9]\+\)\|\(0[xX][0-9a-fA-F]\+\).*$/\1/p'` ; do splashsize= case $vga in 785|786|0x311|0x312|0x0311|0x0312) splashsize=640x480 ;; 788|789|0x314|0x315|0x0314|0x0315) splashsize=800x600 ;; 791|792|0x317|0x318|0x0317|0x0318) splashsize=1024x768 ;; 794|0x31a|0x31A|0x031a) splashsize=1280x1024 ;; 795|0x31b|0x31B|0x031b) splashsize=1280x1024 ;; *) vgahex=`printf 0x%04x "$[$vga]"` splashsize=`hwinfo debug=0 -all +bios.vbe \ | sed -ne 's/^.*Mode '$vgahex': \([^ ][^ ]*\) .*$/\1/p' 2>/dev/null` ;; esac [ -n "$splashsize" -a "x${splash/$splashsize/}" = "x$splash" ] \ && splash="$splash,$splashsize" done splash=${splash#,} fi -- snip -- Regards, Larry
On Friday 13 August 2004 04:42, Larry I Smith wrote:
Anders Johansson wrote:
On Thursday 12 August 2004 22:51, Larry I Smith wrote:
The new '/sbin/mkinitrd' script (rev 1.23 on my machine) has a *BUG* in the RegExp used to extract the "vga=..." value found in the GRUB 'menu.lst' file and the LILO 'lilo.conf' file. There is only one set of parens in the RegExp found at line 292 (inside the "for vga in..." block), but there should be two. Here's the 'diff' output (line-wrapped by the e-mailer of course); I've put carets (^) below the missing close and open parens that need to be added to make it work correctly again:
292c292 < -e 's/^.*[ \t]*vga [ \t]*=[\t]*\([0-9]\+\|0[xX][0-9a-fA-F]\+\).*$/\1/p'` ; do ---
-e 's/^.*[ \t]*vga
[ \t]*=[\t]*\([0-9]\+\)\|\(0[xX][0-9a-fA-F]\+\).*$/\1/p'` ; do ^^ ^^
No, this is wrong. The bug is there, but the fix is bad. If it works, it's by accident. Your regexp will match far too much, especially if there are other lines that use hexadecimal variables (hint: logical or now suddenly applies to the entire expression instead of just the parenthesis)
This is my first attempt at a fix
[ \t]*=[\t]*\(0[xX][0-9a-fA-F]\+\|[0-9]\+\).*$/\1/p'` ; do
or possibly
[ \t]*=[\t]*\([0-9][0-9][0-9]\|0[xX][0-9a-fA-F]\+\).*$/\1/p'` ; do
I disagree.
Remember the original is on one line; the emailer has split it onto two lines:
-e 's/^.*[ \t]*vga [ \t]*=[\t]*\([0-9]\+\)\|\(0[xX][0-9a-fA-F]\+\).*$/\1/p'`
The above should match "vga=" followed by a decimal number (e.g. vga=779), -or- "vga=" followed by a hex number (e.g. vga=0x31a).
It doesn't. It matches "vga=" followed by one or more digits -or- any hexadecimal number on any line preceded by anything at all
Anders Johansson wrote:
On Friday 13 August 2004 04:42, Larry I Smith wrote:
Anders Johansson wrote:
On Thursday 12 August 2004 22:51, Larry I Smith wrote:
The new '/sbin/mkinitrd' script (rev 1.23 on my machine) has a *BUG* in the RegExp used to extract the "vga=..." value found in the GRUB 'menu.lst' file and the LILO 'lilo.conf' file. There is only one set of parens in the RegExp found at line 292 (inside the "for vga in..." block), but there should be two. Here's the 'diff' output (line-wrapped by the e-mailer of course); I've put carets (^) below the missing close and open parens that need to be added to make it work correctly again:
292c292 < -e 's/^.*[ \t]*vga [ \t]*=[\t]*\([0-9]\+\|0[xX][0-9a-fA-F]\+\).*$/\1/p'` ; do ---
-e 's/^.*[ \t]*vga
[ \t]*=[\t]*\([0-9]\+\)\|\(0[xX][0-9a-fA-F]\+\).*$/\1/p'` ; do ^^ ^^
No, this is wrong. The bug is there, but the fix is bad. If it works, it's by accident. Your regexp will match far too much, especially if there are other lines that use hexadecimal variables (hint: logical or now suddenly applies to the entire expression instead of just the parenthesis)
This is my first attempt at a fix
[ \t]*=[\t]*\(0[xX][0-9a-fA-F]\+\|[0-9]\+\).*$/\1/p'` ; do
or possibly
[ \t]*=[\t]*\([0-9][0-9][0-9]\|0[xX][0-9a-fA-F]\+\).*$/\1/p'` ; do
I disagree.
Remember the original is on one line; the emailer has split it onto two lines:
-e 's/^.*[ \t]*vga [ \t]*=[\t]*\([0-9]\+\)\|\(0[xX][0-9a-fA-F]\+\).*$/\1/p'`
The above should match "vga=" followed by a decimal number (e.g. vga=779), -or- "vga=" followed by a hex number (e.g. vga=0x31a).
It doesn't. It matches
"vga=" followed by one or more digits -or- any hexadecimal number on any line preceded by anything at all
Well, I guess my machine works differently than yours. If you copy the entire "handle splash screen" block to a standalone script and set 'splash="auto"' to mimic 'mkinitrd', and set 'vgascan="./test.txt"' instead of '/boot/grub/menu.lst', and add 'echo $vga' just before the 'case' statement, then given this './test.txt' file: vga=0x31a 0xffe vga=791 0xdda vga=123 vga=0xabc vga=nba 795 the script will echo: 0x31a 791 123 0xabc So, it only finds lines with "vga=" followed by a decimal or hexidecimal number. I think we're done here. This pattern (ignoring the spaces added for readability): regexp1 \(regexp2\) \| \(regexp3\) will match regexp1 followed by regexp2 -or- regexp1 followed by regexp3. The 'or' operator matches either of the 2 regexps enclosed in parens, but regexp1 must always be matched. Have a nice day. No more, please, that's enough..... Regards, Larry
On Friday 13 August 2004 06:18, Larry I Smith wrote:
Well, I guess my machine works differently than yours.
You're really going to make me prove this, aren't you
If you copy the entire "handle splash screen" block to a standalone script and set 'splash="auto"' to mimic 'mkinitrd', and set 'vgascan="./test.txt"' instead of '/boot/grub/menu.lst', and add 'echo $vga' just before the 'case' statement, then given this './test.txt' file:
vga=0x31a 0xffe vga=791 0xdda vga=123 vga=0xabc vga=nba 795
the script will echo:
0x31a 791 123 0xabc
No it won't. Count spaces too. There's some other bug there that I can't quite see at the moment, but to illustrate the point, try this in your test.txt a vga=0x31a b a 0xffe b a vga=791 b a 0xdda b a vga=123 b a vga=0xabc b a vga=nba b a 795 b The output will be 0x31a b a 791 b a 123 b 0xabc b I'm too tired to see why the matching is off
This pattern (ignoring the spaces added for readability):
regexp1 \(regexp2\) \| \(regexp3\)
will match regexp1 followed by regexp2 -or- regexp1 followed by regexp3. The 'or' operator matches either of the 2 regexps enclosed in parens, but regexp1 must always be matched.
wrong rest of mail ignored
Anders Johansson wrote:
On Friday 13 August 2004 06:18, Larry I Smith wrote:
Well, I guess my machine works differently than yours.
You're really going to make me prove this, aren't you
If you copy the entire "handle splash screen" block to a standalone script and set 'splash="auto"' to mimic 'mkinitrd', and set 'vgascan="./test.txt"' instead of '/boot/grub/menu.lst', and add 'echo $vga' just before the 'case' statement, then given this './test.txt' file:
vga=0x31a 0xffe vga=791 0xdda vga=123 vga=0xabc vga=nba 795
the script will echo:
0x31a 791 123 0xabc
No it won't. Count spaces too. There's some other bug there that I can't quite see at the moment, but to illustrate the point, try this in your test.txt
a vga=0x31a b a 0xffe b a vga=791 b a 0xdda b a vga=123 b a vga=0xabc b a vga=nba b a 795 b
The output will be
0x31a b a 791 b a 123 b 0xabc b
I'm too tired to see why the matching is off
This pattern (ignoring the spaces added for readability):
regexp1 \(regexp2\) \| \(regexp3\)
will match regexp1 followed by regexp2 -or- regexp1 followed by regexp3. The 'or' operator matches either of the 2 regexps enclosed in parens, but regexp1 must always be matched.
wrong
rest of mail ignored
That's unfriendly....
Yes, I know about the other bug. It's always been there (since mkinitrd v1.0 perhaps), and I don't feel inclined to fix it if SuSE doesn't. It is benign; it merely causes un-necessary, but harmless, invocations of 'hwinfo' in the default case. Enough already. Ok. Regards, Larry
On Friday 13 August 2004 06:52, Larry I Smith wrote:
rest of mail ignored
That's unfriendly....
so is "I think we're done here"
Yes, I know about the other bug. It's always been there (since mkinitrd v1.0 perhaps), and I don't feel inclined to fix it if SuSE doesn't. It is benign; it merely causes un-necessary, but harmless, invocations of 'hwinfo' in the default case.
Enough already. Ok.
Fine. I've shown you by example that your regexp doesn't work (though the weird side effects are truly weird), and in the second mail (my first) I gave examples of regexps that do work without side effects. I have nothing more to add
Larry I Smith wrote:
SuSE Pro v9.0.
After YOU updated my machine to kernel v2.4.21-238 the other day, the SuSE 'silent' bootsplash screen no longer worked (the one with the 'progress bar'). All attempts to fix it failed. Only "verbose" mode worked.
Evidently '/sbin/mkinitrd' script was updated as part of a recent YOU upgrade. Perhaps as part of the v2.4.21-238 upgrade?
The new '/sbin/mkinitrd' script (rev 1.23 on my machine) has a *BUG* in the RegExp used to extract the "vga=..." value found in the GRUB 'menu.lst' file and the LILO 'lilo.conf' file. There is only one set of parens in the RegExp found at line 292 (inside the "for vga in..." block), but there should be two. Here's the 'diff' output (line-wrapped by the e-mailer of course); I've put carets (^) below the missing close and open parens that need to be added to make it work correctly again:
292c292 < -e 's/^.*[ \t]*vga [ \t]*=[\t]*\([0-9]\+\|0[xX][0-9a-fA-F]\+\).*$/\1/p'` ; do ---
-e 's/^.*[ \t]*vga [ \t]*=[\t]*\([0-9]\+\)\|\(0[xX][0-9a-fA-F]\+\).*$/\1/p'` ; do ^^ ^^ As 'root':
1) Make a backup copy of the original '/sbin/mkinitrd' before making this change (just in case...).
2) Edit '/sbin/mkinitrd' to make the change
3) Execute 'mkinitrd'. It should output a "Bootsplash:..." message as part of its diagnostics. That tells you it worked ok.
4) The 'silent' bootsplash will work correctly the next time the machine is booted.
Regards, Larry
Thanks to Anders Johansson for his insights into this problem. His comments got me pointed in the right direction. Here's a more reliable fix for 'mkinitrd'... Original RegExp in 'mkinitrd' rev 1.23: -e 's/^.*[ \t]*vga[ \t]*=[ \t]*\([0-9]\+\|0[xX][0-9a-fA-F]\+\).*$/\1/p'` The original, above, looks for decimal numbers following "vga=" before it looks for hex numbers. But because "vga=0x31a" starts with "0", it matches "[0-9]\+" thereby causing "\1" to evaluate to "0" - but the intent was to match "0x31a". Revised RegExp: -e 's/^.*[ \t]*vga[ \t]*=[ \t]*\(0[xX][0-9a-fA-F]\+\|[0-9]\+\).*$/\1/p'` This revised version looks for hex numbers following "vga=" before it looks for decimal numbers. Now everything works as expected. My original fix does work, but it may cause needless, but benign, invocations of "hwinfo" in the default "case" statement. Regards, Larry
participants (2)
-
Anders Johansson
-
Larry I Smith