[PATCH] extlinux: Understand "default" properly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The configuration looks like the following:

  default Fedora (3.11.6-301.fc20.i686+PAE) 20 (Heisenbug)

  title Fedora (3.11.6-301.fc20.i686+PAE) 20 (Heisenbug)
  ...

Grubby skips over the default clause as it has more than one element. And even
if it did not, it would not match it against the title, since it handles titles
specially, concatenating the title, but not the default clause.

This commit adds special handling for extlinux, which causes it to parse
default and title in the same way.

Signed-off-by: Lubomir Rintel <lkundrak@xxxxx>
---
 grubby.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/grubby.c b/grubby.c
index 935edf1..b0f95e3 100644
--- a/grubby.c
+++ b/grubby.c
@@ -151,6 +151,7 @@ struct configFileInfo {
     int defaultIsVariable;
     int defaultSupportSaved;
     int defaultIsSaved;
+    int defaultIsUnquoted;
     enum lineType_e entryStart;
     enum lineType_e entryEnd;
     int needsBootPrefix;
@@ -622,6 +623,7 @@ struct configFileInfo extlinuxConfigType = {
     .needsBootPrefix = 1,
     .maxTitleLength = 255,
     .mbAllowExtraInitRds = 1,
+    .defaultIsUnquoted = 1,
 };
 
 struct grubConfig {
@@ -1166,9 +1168,6 @@ static struct grubConfig * readConfig(const char * inName,
 		cfg->flags &= ~GRUB_CONFIG_NO_DEFAULT;
 		defaultLine = line;
 	    }
-	} else if (line->type == LT_DEFAULT && line->numElements == 2) {
-	    cfg->flags &= ~GRUB_CONFIG_NO_DEFAULT;
-	    defaultLine = line;
 
         } else if (iskernel(line->type)) {
 	    /* if by some freak chance this is multiboot and the "module"
@@ -1201,8 +1200,9 @@ static struct grubConfig * readConfig(const char * inName,
 	    cfg->fallbackImage = strtol(line->elements[1].item, &end, 10);
 	    if (*end) cfg->fallbackImage = -1;
 
-	} else if (line->type == LT_TITLE && line->numElements > 1) {
-	    /* make the title a single argument (undoing our parsing) */
+	} else if ((line->type == LT_DEFAULT && cfi->defaultIsUnquoted) ||
+                (line->type == LT_TITLE && line->numElements > 1)) {
+	    /* make the title/default a single argument (undoing our parsing) */
 	    len = 0;
 	    for (int i = 1; i < line->numElements; i++) {
 		len += strlen(line->elements[i].item);
@@ -1309,6 +1309,11 @@ static struct grubConfig * readConfig(const char * inName,
 	    }
 	}
 
+	if (line->type == LT_DEFAULT && line->numElements == 2) {
+	    cfg->flags &= ~GRUB_CONFIG_NO_DEFAULT;
+	    defaultLine = line;
+	}
+
 	/* If we find a generic config option which should live at the
 	   top of the file, move it there. Old versions of grubby were
 	   probably responsible for putting new images in the wrong 
-- 
1.8.4.2

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list




[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux