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
|
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
|
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.
|
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.
|