Bug#295504: grub-install: fails to notice a segfault in $grub_shell

Michael Gold Michael Gold <mgold@rogers.com>, 295504@bugs.debian.org
Wed, 16 Feb 2005 04:02:16 -0500


--2fHTh5uZTiUOsy+g
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Package: grub
Version: 0.95+cvs20040624-14

/sbin/grub segfaults on my amd64 system when called from grub-install,
due to bug #293722. The grub-install script doesn't notice this, states
"No error reported", and exits normally. Sample output:

=3D=3D
iria:~# grub-install /dev/sda
/sbin/grub-install: line 516:  5065 Segmentation fault      $grub_shell --b=
atch
root $root_drive
setup $force_lba --stage2=3D$grubdir/stage2 --prefix=3D$grub_prefix $instal=
l_drive
quit
EOF

Installation finished. No error reported.
This is the contents of the device map /boot/grub/device.map.
Check if this is correct or not. If any of the lines is incorrect,
fix it and re-run the script `grub-install'.

(hd0)   /dev/hda
(hd1)   /dev/sda
iria:~#
=3D=3D

One effect of this bug is that debian-installer didn't notice the error
when installing grub on my system, and the initial reboot failed.
grub-install should return a non-zero exit code if $grub_shell is
terminated by a signal.

Adding '|| exit 1' to line 512 should fix this bug (this is untested):
# Now perform the installation.=20
$grub_shell --batch $no_floppy --device-map=3D$device_map || exit 1 <<EOF >=
$log_file

-- System Information:
Debian Release: 3.1
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.10-9-amd64-k8
Locale: LANG=3Den_CA.UTF-8, LC_CTYPE=3Den_CA.UTF-8 (charmap=3DUTF-8)

-- debconf-show failed

--2fHTh5uZTiUOsy+g
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)

iD8DBQFCEwwY+RZl+46r4TcRAul9AJ944rMkO6iWf2Oq6RZas+HmG8PIAACbBxww
xiW4stb/6p9gIFcuTngyoMk=
=1ABv
-----END PGP SIGNATURE-----

--2fHTh5uZTiUOsy+g--