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