From c22f60e6e55f1bf300dd76d2222a93911f3b2bb2 Mon Sep 17 00:00:00 2001 From: CoprDistGit Date: Thu, 12 Oct 2023 04:00:49 +0000 Subject: automatic import of xen --- pygrub-handle-one-line-menu-entries.patch | 59 +++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 pygrub-handle-one-line-menu-entries.patch (limited to 'pygrub-handle-one-line-menu-entries.patch') diff --git a/pygrub-handle-one-line-menu-entries.patch b/pygrub-handle-one-line-menu-entries.patch new file mode 100644 index 0000000..0abe62d --- /dev/null +++ b/pygrub-handle-one-line-menu-entries.patch @@ -0,0 +1,59 @@ +References: bsc#978413 + +The parsing code can't handle a single line menu entry. +For example: menuentry 'halt' { halt } +Force it to fall through where it will handle the closing brace. +Also change warning to debug to cut down on verbose output. + +Index: xen-4.13.0-testing/tools/pygrub/src/GrubConf.py +=================================================================== +--- xen-4.13.0-testing.orig/tools/pygrub/src/GrubConf.py ++++ xen-4.13.0-testing/tools/pygrub/src/GrubConf.py +@@ -150,7 +150,7 @@ class GrubImage(_GrubImage): + else: + logging.info("Ignored image directive %s" %(com,)) + else: +- logging.warning("Unknown image directive %s" %(com,)) ++ logging.debug("Unknown image directive %s" %(com,)) + + # now put the line in the list of lines + if replace is None: +@@ -309,7 +309,7 @@ class GrubConfigFile(_GrubConfigFile): + else: + logging.info("Ignored directive %s" %(com,)) + else: +- logging.warning("Unknown directive %s" %(com,)) ++ logging.debug("Unknown directive %s" %(com,)) + + if img: + self.add_image(GrubImage(title, img)) +@@ -343,7 +343,7 @@ class Grub2Image(_GrubImage): + elif com.startswith('set:'): + pass + else: +- logging.warning("Unknown image directive %s" %(com,)) ++ logging.debug("Unknown image directive %s" %(com,)) + + # now put the line in the list of lines + if replace is None: +@@ -408,7 +408,10 @@ class Grub2ConfigFile(_GrubConfigFile): + raise RuntimeError("syntax error: cannot nest menuentry (%d %s)" % (len(img),img)) + img = [] + title = title_match.group(1) +- continue ++ if not l.endswith('}'): ++ continue ++ # One line menuentry, Ex. menuentry 'halt' { halt } ++ l = '}' + + if l.startswith("submenu"): + menu_level += 1 +@@ -447,7 +450,7 @@ class Grub2ConfigFile(_GrubConfigFile): + elif com.startswith('set:'): + pass + else: +- logging.warning("Unknown directive %s" %(com,)) ++ logging.debug("Unknown directive %s" %(com,)) + + if img is not None: + raise RuntimeError("syntax error: end of file with open menuentry(%d %s)" % (len(img),img)) -- cgit v1.2.3