All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix grub-probe fail on by-(id|uuid|path) device names
@ 2012-04-20 11:40 Michael Chang
  2012-04-20 12:22 ` Vladimir 'φ-coder/phcoder' Serbinenko
  2012-04-20 13:04 ` Vladimir 'φ-coder/phcoder' Serbinenko
  0 siblings, 2 replies; 5+ messages in thread
From: Michael Chang @ 2012-04-20 11:40 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 580 bytes --]

This patch fixes grub-probe fails on probing devices under
/dev/disk/by-id and other similar mount-by alias names. The method
used to determine the whole disk is by it's name without numeric
character end, but this may be wrong for the by-(id|uuid|path) names
as they are not necessary ended without numeric character. For
instance, my disk was named
"/dev/disk/by-id/ata-WDC_WD1600BEKT-60V5T1_WD-WXK0A69Y4761".

The fix is use resolved link to kernel device names (like /dev/sda)
instead of these alias names.

Downstream bug:
https://bugzilla.novell.com/show_bug.cgi?id=757746


[-- Attachment #2: use_kernel_device_name_in_device_is_wholedisk.patch --]
[-- Type: text/x-patch, Size: 633 bytes --]

=== modified file 'util/getroot.c'
--- util/getroot.c	2012-03-31 10:27:10 +0000
+++ util/getroot.c	2012-04-20 11:06:18 +0000
@@ -2093,7 +2093,16 @@
 static int
 device_is_wholedisk (const char *os_dev)
 {
-  int len = strlen (os_dev);
+  int len;
+  char os_dev_realpath[PATH_MAX];
+
+  if (strncmp (os_dev, "/dev/disk/by-id/", 16) == 0 ||
+      strncmp (os_dev, "/dev/disk/by-uuid/", 18) == 0 ||
+      strncmp (os_dev, "/dev/disk/by-path/", 18) == 0)
+    if (realpath (os_dev, os_dev_realpath))
+      os_dev = os_dev_realpath;
+
+  len = strlen (os_dev);
 
   if (os_dev[len - 1] < '0' || os_dev[len - 1] > '9')
     return 1;


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-04-23  7:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-20 11:40 [PATCH] fix grub-probe fail on by-(id|uuid|path) device names Michael Chang
2012-04-20 12:22 ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-04-20 13:04 ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-04-23  7:29   ` Michael Chang
2012-04-23  7:35     ` Vladimir 'φ-coder/phcoder' Serbinenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.