On Fri, 2012-02-03 at 10:52 +0100, Vladimir 'φ-coder/phcoder' Serbinenko
wrote:
> > zfs-on-linux-rlaager6.patch
> >
> >
> > Handle pool names with trailing spaces
> What about the ones with spaces in the middle? It feels like the logic 
> is broken elsewhere and using strncmp is just a workaround which works 
> only for one particular case

I've attached a new patch. I've tested it with both cases.

I've also attached a patch that handles `zpool status` outputting full
device paths.

-- 
Richard
Handle vdevs with full paths

Index: util/getroot.c
===================================================================
--- util/getroot.c	2012-02-03 04:21:29.199249594 -0600
+++ util/getroot.c	2012-02-03 05:02:55.693211000 -0600
@@ -302,7 +301,10 @@
 		    devices = xrealloc (devices, sizeof (devices[0])
 					* devices_allocated);
 		  }
-		devices[ndevices++] = xasprintf ("/dev/%s", name);
+		if (name[0] == '/')
+		  devices[ndevices++] = xstrdup (name);
+		else
+		  devices[ndevices++] = xasprintf ("/dev/%s", name);
 	      }
 	    break;
 	  }
Handle pool names with spaces

Index: util/getroot.c
===================================================================
--- util/getroot.c	2012-02-03 04:21:29.199249594 -0600
+++ util/getroot.c	2012-02-03 05:02:55.693211000 -0600
@@ -260,7 +260,7 @@
   char cksum[257], notes[257];
   unsigned int dummy;
 
-  cmd = xasprintf ("zpool status %s", poolname);
+  cmd = xasprintf ("zpool status \"%s\"", poolname);
   fp = popen (cmd, "r");
   free (cmd);
 
@@ -285,8 +285,7 @@
 	      st++;
 	    break;
 	  case 1:
-	    if (!strcmp (name, poolname))
-	      st++;
+	    st++;
 	    break;
 	  case 2:
 	    if (strcmp (name, "mirror") && !sscanf (name, "mirror-%u", &dummy)
@@ -420,6 +422,9 @@
       if (sscanf (sep, "%s %s", entry.fstype, entry.device) != 2)
 	continue;
 
+      unescape (entry.fstype);
+      unescape (entry.device);
+
       /* Using the mount IDs, find out where this fits in the list of
 	 visible mount entries we've seen so far.  There are three
 	 interesting cases.  Firstly, it may be inserted at the end: this is

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to