[Libguestfs] [PATCH] builder: accept also '_' in group names

Pino Toscano ptoscano at redhat.com
Wed Feb 19 16:34:02 UTC 2014


---
 builder/index-scan.l     | 2 +-
 builder/index-validate.c | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/builder/index-scan.l b/builder/index-scan.l
index b120590..832ea51 100644
--- a/builder/index-scan.l
+++ b/builder/index-scan.l
@@ -52,7 +52,7 @@ extern void yyerror (const char *);
 ^\n                                     { return EMPTY_LINE; }
 
   /* [...] marks beginning of a section. */
-^"["[-A-Za-z0-9.]+"]"\n {
+^"["[-A-Za-z0-9._]+"]"\n {
                       yylval.str = strndup (yytext+1, yyleng-3);
                       return SECTION_HEADER;
                     }
diff --git a/builder/index-validate.c b/builder/index-validate.c
index 26abaa8..7f02ffb 100644
--- a/builder/index-validate.c
+++ b/builder/index-validate.c
@@ -128,6 +128,14 @@ main (int argc, char *argv[])
     int seen_sig = 0;
     struct field *fields;
 
+    if (compat_1_24_0) {
+      if (strchr (sections->name, '_')) {
+        fprintf (stderr, _("%s: %s: section [%s] has invalid characters which will not work with virt-builder 1.24.0\n"),
+                 program_name, input, sections->name);
+        exit (EXIT_FAILURE);
+      }
+    }
+
     for (fields = sections->fields; fields != NULL; fields = fields->next) {
       if (compat_1_24_0) {
         if (strchr (fields->key, '[') ||
-- 
1.8.3.1




More information about the Libguestfs mailing list