Pino Toscano
2014-Feb-19 16:34 UTC
[Libguestfs] [PATCH] builder: accept also '_' in group names
---
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
Richard W.M. Jones
2014-Feb-19 21:12 UTC
Re: [Libguestfs] [PATCH] builder: accept also '_' in group names
On Wed, Feb 19, 2014 at 05:34:02PM +0100, Pino Toscano wrote:> --- > 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.1ACK. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming blog: http://rwmj.wordpress.com Fedora now supports 80 OCaml packages (the OPEN alternative to F#)