bugGNU GRUB - Bugs: bug #36640, Please make grub-probe support...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #36640: Please make grub-probe support symlinks

Submitted by:  Sebastian Pipping <hartwork>
Submitted on:  Tue 12 Jun 2012 04:21:36 PM UTC  
 
Category: NoneSeverity: Major
Priority: 5 - NormalItem Group: None
Status: FixedPrivacy: Public
Assigned to: NoneOriginator Name: 
Open/Closed: ClosedRelease: 
Release: Bazaar - trunkReproducibility: None
Planned Release: None

Sat 16 Jun 2012 04:36:11 PM UTC, comment #4:

Vladimir,

thanks for coming up with a patch so quickly! As you pasted the patch inline, copy-paste produced a malformed patch ..

# patch -p 0 < patch
patching file util/getroot.c
patch: **** malformed patch at line 4: ptr = ret + sizeof ("/dev/disk") + rdisk - 1;

.. with whitespace broken and even some '*'s missing.

I believed I was able to restore the patch correctly, see [1] for my result to be sure.

Fortunately, the patch seems to work well. I confirm all(?) possible combinations working:

# for d in /dev/loop7 /dev/GRUB_BOOT_TEST_DISK ; do \
for m in normal-device.map symlink-device.map \
both-a-b-device.map both-b-a-device.map '' ; do \
printf "[%s][%s] -> " "$d" "$m"; \
./grub-probe --device-map="$m" --target=drive \
--device "$d" ; \
done ; \
done
[/dev/loop7][normal-device.map] -> (hd0)
[/dev/loop7][symlink-device.map] -> (hd0)
[/dev/loop7][both-a-b-device.map] -> (hd0)
[/dev/loop7][both-b-a-device.map] -> (hd0)
[/dev/loop7][] -> (hostdisk//dev/loop7)
[/dev/GRUB_BOOT_TEST_DISK][normal-device.map] -> (hd0)
[/dev/GRUB_BOOT_TEST_DISK][symlink-device.map] -> (hd0)
[/dev/GRUB_BOOT_TEST_DISK][both-a-b-device.map] -> (hd0)
[/dev/GRUB_BOOT_TEST_DISK][both-b-a-device.map] -> (hd0)
[/dev/GRUB_BOOT_TEST_DISK][] -> (hostdisk//dev/loop7)

Best,

Sebastian

[1] http://hartwork.org/public/grub-issue-36640-restored.patch

Sebastian Pipping <hartwork>
Thu 14 Jun 2012 02:39:46 PM UTC, comment #3:

Please try this patch:
=== modified file 'util/getroot.c'
--- util/getroot.c 2012-06-07 12:24:48 +0000
+++ util/getroot.c 2012-06-14 14:33:18 +0000
@@ -2074,7 +2074,11 @@ devmapper_out:
ptr = ret + sizeof ("/dev/disk") + rdisk - 1;
while (ptr >= '0' && ptr <= '9')
ptr++;
- *ptr = 0;
+ if (*ptr)
+ {
+ *is_part = 1;
+ *ptr = 0;
+ }
return ret;
#else
# warning "The function `convert_system_partition_to_system_disk' might not work on your OS correctly."
@@ -2175,8 +2179,10 @@ grub_util_biosdisk_get_grub_dev (const c

drive = find_system_device (os_dev, &st, 1, 1);
sys_disk = convert_system_partition_to_system_disk (os_dev, &st, &is_part);
+ if (!sys_disk)
+ return 0;
grub_util_info ("%s is a parent of %s", sys_disk, os_dev);
- if (grub_strcmp (os_dev, sys_disk) == 0)
+ if (!is_part)
{
free (sys_disk);
return make_device_name (drive, -1, -1);
@@ -2264,11 +2270,15 @@ grub_util_biosdisk_get_grub_dev (const c
but are really more like disks. */
if (grub_errno == GRUB_ERR_UNKNOWN_DEVICE)
{
+ char *canon;
grub_util_warn
(_("disk does not exist, so falling back to partition device %s"),
os_dev);

- drive = find_system_device (os_dev, &st, 0, 1);
+ canon = canonicalize_file_name (os_dev);
+ drive = find_system_device (canon ? : os_dev, &st, 0, 1);
+ if (canon)
+ free (canon);
return make_device_name (drive, -1, -1);
}
else

Vladimir Serbinenko <phcoder>
Project Administrator
Tue 12 Jun 2012 04:37:28 PM UTC, comment #2:

I have verified to be running 2.0~beta6. In fact, I have it installed system-wide.

Your commands work (but my commands still show a problem), therefore I assume your test is too simple to hit the problem. Please try something closer to my commands down there, ideally the same thing. I took my time to report something reproducable, please take your time to reproduce it. Thanks.

Sebastian Pipping <hartwork>
Tue 12 Jun 2012 04:25:56 PM UTC, comment #1:

Can't reproduce it here:
phcoder@debian.x201.phnet:18:24:15:/dev$ sudo ln -s sda4 tst
phcoder@debian.x201.phnet:18:24:56:/dev$ sudo /usr/local/sbin/grub-probe -t fs -d /dev/tst
ext2

Please make sure that you really run 2.0~beta6 and not some older version.

Vladimir Serbinenko <phcoder>
Project Administrator
Tue 12 Jun 2012 04:21:36 PM UTC, original submission:

Related to bug #36639 in a way.

Please make grub-probe support symlinks. The shell session below demonstrates the current unpleasant behaviors of GRUB 2.00~beta6.

# ls -al /dev/GRUB_BOOT_TEST_DISK
lrwxrwxrwx 1 root root 5 Jun 12 17:17 /dev/GRUB_BOOT_TEST_DISK -> loop7

# cat /tmp/tmp.IDdNMT35bf/boot/grub/device.map
(hd0) /dev/loop7
(hd0) /dev/GRUB_BOOT_TEST_DISK

# grub-probe --device-map=/tmp/tmp.IDdNMT35bf/boot/grub/device.map --target=drive --device /dev/loop7
(hd0)

# grub-probe --device-map=/tmp/tmp.IDdNMT35bf/boot/grub/device.map --target=drive --device /dev/GRUB_BOOT_TEST_DISK
grub-probe: error: cannot find a GRUB drive for /dev/GRUB_BOOT_TEST_DISK. Check your device.map.

# grub-probe --device-map= --target=drive --device /dev/loop7
(hostdisk//dev/loop7)

# grub-probe --device-map= --target=drive --device /dev/GRUB_BOOT_TEST_DISK
grub-probe: error: cannot find a GRUB drive for /dev/GRUB_BOOT_TEST_DISK. Check your device.map.

Sebastian Pipping <hartwork>

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by phcoder (Posted a comment)
  • -unavailable- added by hartwork (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 16 Jun 2012 04:37:25 PM UTCphcoderStatusNone=>Fixed
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1