Please update your grub. We already use better solution by using --separator. And filenames are allowed to have trailing whitespaces so we shouldn't remove them On Nov 18, 2013 2:24 PM, "Tom River" <to...@gmx.net> wrote:
> Hi > > This is a request to add the patch for GRUB2 (Source code file is > getroot.c) > > Problem seen: > Running grub2-mkconfig gives output like "/dev/md0" not found, but sure > it's there. Analyze this more in deep, I found > out, that the string is "/dev/md0 " - watch the trailing whitespaces. > Yeah, this is a common programmer mistake over > years, don't remove leading and trailing white space from a string. > > grub2-mkconfig uses the output from "vgs --options pv_name --noheadings" > and this output contains leading and trailing > spaces. Maybe someone need to remove the trailing whitespaces from there. > > To Reproduce - Run this: > echo "'$(sudo vgs --options pv_name --noheadings)'" > ' /dev/md0 ' > > However, don't run in this kind of problem in the future, please add this > patch (in general please remove leading and > trainling whitespaces from output from other tools). > > Version with (this) problem: > grub2-2.00-23.fc19.src.rpm > > grub2-mkconfig -v > grub2-mkconfig (GRUB) 2.00 > > sudo lvm vgs --version > LVM version: 2.02.98(2) (2012-10-15) > Library version: 1.02.77 (2012-10-15) > Driver version: 4.25.0 > > This is from Fedora, but I think the patch is useful for the original code > too. > > > Patch: > --- grub-2.00/util/getroot.c.orig 2013-11-14 13:00:07.515946550 +0100 > +++ grub-2.00/util/getroot.c 2013-11-14 15:41:54.200504371 +0100 > @@ -1375,11 +1375,14 @@ > while (getline (&buf, &len, mdadm) > 0) > { > - char *ptr; > - for (ptr = buf; ptr < buf + 2 && *ptr == ' '; ptr++); > + char *ptr,*ptr1; > + for (ptr = buf; ptr < buf + 2 && isspace(*ptr); ptr++); > if (*ptr == '\0') > continue; > *(ptr + strlen (ptr) - 1) = '\0'; > + for (ptr1 = ptr+1; ptr1 < buf+len && *ptr1 && !isspace(*ptr1); > ptr1++); > + if (isspace(*ptr1)) *ptr1 = '\0'; > + > grub_util_pull_device (ptr); > } > > > >
_______________________________________________ Bug-grub mailing list Bug-grub@gnu.org https://lists.gnu.org/mailman/listinfo/bug-grub