[Libguestfs] [PATCH] builder: ignore spaces after repo identifiers (RHBZ#1506511)
Richard W.M. Jones
rjones at redhat.com
Fri Oct 27 14:24:59 UTC 2017
On Thu, Oct 26, 2017 at 04:11:56PM +0200, Pino Toscano wrote:
> ---
> builder/index-scan.l | 5 +++--
> builder/test-virt-index-validate-good-4 | 3 +++
> builder/test-virt-index-validate.sh | 1 +
> 3 files changed, 7 insertions(+), 2 deletions(-)
> create mode 100644 builder/test-virt-index-validate-good-4
>
> diff --git a/builder/index-scan.l b/builder/index-scan.l
> index bdb474b33..49dad72bc 100644
> --- a/builder/index-scan.l
> +++ b/builder/index-scan.l
> @@ -78,8 +78,9 @@ extern void scanner_destroy (yyscan_t scanner);
> ^\n { return EMPTY_LINE; }
>
> /* [...] marks beginning of a section. */
> -^"["[-A-Za-z0-9._]+"]"\n {
> - yylval->str = strndup (yytext+1, yyleng-3);
> +^"["[-A-Za-z0-9._]+"]"[[:blank:]]*\n {
> + const char *end = strrchr (yytext, ']');
> + yylval->str = strndup (yytext+1, end-yytext-1);
> return SECTION_HEADER;
> }
>
> diff --git a/builder/test-virt-index-validate-good-4 b/builder/test-virt-index-validate-good-4
> new file mode 100644
> index 000000000..8e8d1065b
> --- /dev/null
> +++ b/builder/test-virt-index-validate-good-4
> @@ -0,0 +1,3 @@
> +# Empty spaces after the repository identifier
> +[foo]
> +key=value
> diff --git a/builder/test-virt-index-validate.sh b/builder/test-virt-index-validate.sh
> index b00a086b0..851285a1e 100755
> --- a/builder/test-virt-index-validate.sh
> +++ b/builder/test-virt-index-validate.sh
> @@ -23,3 +23,4 @@ set -e
> $VG virt-index-validate test-virt-index-validate-good-1
> $VG virt-index-validate test-virt-index-validate-good-2
> $VG virt-index-validate test-virt-index-validate-good-3
> +$VG virt-index-validate test-virt-index-validate-good-4
ACK, except please add test-virt-index-validate-good-4 to EXTRA_DIST.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine. Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/
More information about the Libguestfs
mailing list