Bug#514708: #513216 consists of two different bugs in /usr/sbin/grub-install

Prohle Peter prohlep at math.bme.hu
Tue Feb 10 09:51:09 UTC 2009


Package: grub
Version: 0.97-47lenny2
File:    /usr/sbin/grub-install
Subject: #513216 consists of two different bugs in /usr/sbin/grub-install
To:      Debian Bug Tracking System <submit at bugs.debian.org>

Bug1: a syntax insufficiency in grub-install in line 374

Bug2: the way of calling of grub-probe could be enhanced in order
       not to provoke the syntax insufficiency above

I use the regurarly updated Lenny in out-of-the-box setting, and I also have:

# grub-install --no-floppy --recheck --root-directory=/work /dev/sda
grub-probe: error: Cannot open `/boot/grub/device.map'
/usr/sbin/grub-install: line 374: [: =: unary operator expected
Installation finished. No error reported.
This is the contents of the device map /work/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/sda
#

The reason for this error is simply, that the standard output of the
grub-probe in the left hand side of the testing CAN BE EMPTY, and then
the missing left hand side corrupts the syntax.

The solution for this error is to put the `...` standard output into "":

# diff /usr/sbin/grub-install grub-install_better
374c374
< if [ `grub-probe -t fs ${grubdir}` = "xfs" ] ; then
---
> if [ "`grub-probe -t fs ${grubdir}`" = "xfs" ] ; then
#

Let us mention, that the dobule == would be safer, than the single =,
namely:

 	if [ "`grub-probe -t fs ${grubdir}`" == "xfs" ] ; then

Best wishes,
      Peter PROHLE.





More information about the Pkg-grub-devel mailing list