[Bug 1251926] Re: 40grub2 incorrectly extracts title from grub.cfg entries that contain more than two single quotes

n.st 1251926 at bugs.launchpad.net
Sat Nov 16 23:43:48 UTC 2013


Apparently, this issue was fixed in revision 30 (i.e. 1.56ubuntu1):
http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/trusty/os-
prober/trusty/revision/30#linux-boot-probes/mounted/common/40grub2

** Changed in: os-prober (Ubuntu)
       Status: New => Fix Released

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to os-prober in Ubuntu.
https://bugs.launchpad.net/bugs/1251926

Title:
  40grub2 incorrectly extracts title from grub.cfg entries that contain
  more than two single quotes

Status in “os-prober” package in Ubuntu:
  Fix Released

Bug description:
  When linux-boot-prober (from os-prober 1.51ubuntu3 on Ubuntu 12.04.3)
  finds a grub.cfg containing a line like

  menuentry 'Gentoo GNU/Linux, with Linux x86_64-3.8.13-gentoo' --class
  gentoo --class gnu-linux --class gnu --class os $menuentry_id_option
  'gnulinux-x86_64-3.8.13-gentoo-advanced-
  eb397f81-2ff4-4751-9c95-39c1e9427a6d' {

  and runs /linux-boot-probes/mounted/common/40grub2 to parse it, it
  will return

  /dev/sda4:/dev/sda4:Gentoo GNU/Linux, with Linux x86_64-3.8.13-gentoo'
  --class gentoo --class gnu-linux --class gnu --class os
  $menuentry_id_option 'gnulinux-x86_64-3.8.13-gentoo-advanced-
  eb397f81-2ff4-4751-9c95-39c1e9427a6d:/boot/kernel-genkernel-
  x86_64-3.10.17-gentoo:/boot/initramfs-genkernel-
  x86_64-3.10.17-gentoo:root=UUID=eb397f81-2ff4-4751-9c95-39c1e9427a6d
  ro

  where
  Gentoo GNU/Linux, with Linux x86_64-3.8.13-gentoo' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-x86_64-3.8.13-gentoo-advanced-eb397f81-2ff4-4751-9c95-39c1e9427a6d
  is the title (which should just be "Gentoo GNU/Linux, with Linux x86_64-3.8.13-gentoo" instead).

  Apparently, the regex used by 40grub2 is too greedy and matches
  everything between the two outermost single quotes, instead of the
  first two. The same will probably happen with entries where the title
  is enclosed in double quotes and more than two of those are present,
  but I haven't observed it yet.

  I have attached a patch for 40grub2 that modifies the regex to stop at the first occurence of a single quote for titles enclosed in single quotes and the first double quote for titles enclosed in double quotes.
  Note that this might fail in the rare case of someone using escaped quotes in their GRUB menuentry titles (although I'm not entirely sure if that's even supported).

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/os-prober/+bug/1251926/+subscriptions



More information about the foundations-bugs mailing list