summaryrefslogtreecommitdiff
path: root/libre/grub/grub-2.00.5086-fix-lvm-parsing.patch
diff options
context:
space:
mode:
authoraurelien <aurelien@cwb.io>2013-09-23 10:33:22 +0200
committeraurelien <aurelien@cwb.io>2013-09-23 10:33:22 +0200
commit2735c9d273c54b555681f30f5c685998fed7b484 (patch)
treef8172dbea44d1c4751a99a62fb236a14c9d2dc20 /libre/grub/grub-2.00.5086-fix-lvm-parsing.patch
parentd78a32a6ccb8663a62a093b54e947e2efc840fe0 (diff)
parent97f65e06566f3bb15bc7395624017b8e6ca0d043 (diff)
downloadabslibre-2735c9d273c54b555681f30f5c685998fed7b484.tar.gz
abslibre-2735c9d273c54b555681f30f5c685998fed7b484.tar.bz2
abslibre-2735c9d273c54b555681f30f5c685998fed7b484.zip
Merge branch 'master' of ssh://parabolagnulinux.org:1863/srv/git/abslibre
Diffstat (limited to 'libre/grub/grub-2.00.5086-fix-lvm-parsing.patch')
-rw-r--r--libre/grub/grub-2.00.5086-fix-lvm-parsing.patch54
1 files changed, 54 insertions, 0 deletions
diff --git a/libre/grub/grub-2.00.5086-fix-lvm-parsing.patch b/libre/grub/grub-2.00.5086-fix-lvm-parsing.patch
new file mode 100644
index 000000000..9a2eb3ff7
--- /dev/null
+++ b/libre/grub/grub-2.00.5086-fix-lvm-parsing.patch
@@ -0,0 +1,54 @@
+There is no explicit option to turn off alignment; it is implicitly
+disabled if one of --separator or --nameprefixes option is used.
+
+--separator was added in 2007, --nameprefixes - in 2009. So let's use
+--separator to extend range of versions we are compatible with. Note that
+one or another must be used, current parsing is broken otherwise.
+
+Signed-off-by: Andrey Borzenkov <address@hidden>
+
+---
+ util/getroot.c | 12 +++++++++---
+ 1 file changed, 9 insertions(+), 3 deletions(-)
+
+diff --git a/util/getroot.c b/util/getroot.c
+index 2ad8a55..3afcf96 100644
+--- a/util/getroot.c
++++ b/util/getroot.c
+@@ -1322,7 +1322,7 @@ grub_util_get_dev_abstraction (const char *os_dev)
+ static void
+ pull_lvm_by_command (const char *os_dev)
+ {
+- char *argv[6];
++ char *argv[8];
+ int fd;
+ pid_t pid;
+ FILE *mdadm;
+@@ -1351,12 +1351,17 @@ pull_lvm_by_command (const char *os_dev)
+
+ /* execvp has inconvenient types, hence the casts. None of these
+ strings will actually be modified. */
++ /* by default PV name is left aligned in 10 character field, meaning that
++ we do not know where name ends. Using dummy --separator disables
++ alignment. We have a single field, so separator itself is not output */
+ argv[0] = (char *) "vgs";
+ argv[1] = (char *) "--options";
+ argv[2] = (char *) "pv_name";
+ argv[3] = (char *) "--noheadings";
+- argv[4] = vgname;
+- argv[5] = NULL;
++ argv[4] = (char *) "--separator";
++ argv[5] = (char *) ":";
++ argv[6] = vgname;
++ argv[7] = NULL;
+
+ pid = exec_pipe (argv, &fd);
+ free (vgname);
+@@ -1376,6 +1381,7 @@ pull_lvm_by_command (const char *os_dev)
+ while (getline (&buf, &len, mdadm) > 0)
+ {
+ char *ptr;
++ /* LVM adds two spaces as standard prefix */
+ for (ptr = buf; ptr < buf + 2 && *ptr == ' '; ptr++);
+ if (*ptr == '\0')
+ continue;