Bug#568317: linux-image-* postinst did not correctly run lilo
Niko Tyni wrote:
> Reassigning now. ...
Thanks.
> ... you could probably follow up and explain what exactly was incorrect
> about running lilo.
Looking at my /var/lib/dpkg/info/linux-image-*.postinst files, I see in
the code reading and parsing $CONF_LOC = '/etc/kernel-img.conf':
...
$do_symlink = "" if /do_symlinks\s*=\s*(no|false|0)\s*$/ig;
...
$do_bootloader = "Yes" if /do_bootloader\s*=\s*(yes|true|1)\s*$/ig;
$explicit_do_loader = "YES" if /do_bootloader\s*=\s*(yes|true|1)\s*$/ig;
...
Most of the match patterns are used once only; using /g on them is not
necessary, and is probably wasteful (though perl is fast enough to
handle such things).
The pattern /do_bootloader.../ig is used twice. The first one may match;
the second one will surely not match because of the spurious /g, thus
explicit_do_loader will never be set (and lilo not run, or run after a
question left un-answered in unattended runs of "apt-get install").
---
Minor issues, while I am criticizing perl style...
These patterns are anchored at the end, should also be anchored at the
beginning (and with explicit m//) like:
$do_symlink = "" if m/^\s*do_symlinks\s*=\s*(no|false|0)\s*$/i;
...
$image_dest = "$1" if m/^\s*image_dest\s*=\s*(\S+)\s*$/i;
I wonder about the need to use my() in a single-level script.
---
Cheers, Paul
Paul Szabo psz@maths.usyd.edu.au http://www.maths.usyd.edu.au/u/psz/
School of Mathematics and Statistics University of Sydney Australia
Reply to: