[Libguestfs] [PATCH 1/2] builder: allow the index parser to parse files with no sections

Richard W.M. Jones rjones at redhat.com
Thu Mar 20 17:23:56 UTC 2014


On Thu, Mar 20, 2014 at 05:04:24PM +0100, Pino Toscano wrote:
> Gracefully handle files with no sections; extend the validate.sh test
> to try to validate an empty file.
> ---
>  builder/index-parse.y       | 2 ++
>  builder/website/validate.sh | 7 +++++++
>  2 files changed, 9 insertions(+)
> 
> diff --git a/builder/index-parse.y b/builder/index-parse.y
> index 9355bd4..5133959 100644
> --- a/builder/index-parse.y
> +++ b/builder/index-parse.y
> @@ -108,6 +108,8 @@ sections:
>          { $$ = $1; }
>      | section EMPTY_LINE emptylines sections
>          { $$ = $1; $$->next = $4; }
> +    | emptylines
> +        { $$ = NULL; }
>  
>  section:
>        SECTION_HEADER fields
> diff --git a/builder/website/validate.sh b/builder/website/validate.sh
> index bd9a4ed..f2e24cf 100755
> --- a/builder/website/validate.sh
> +++ b/builder/website/validate.sh
> @@ -19,6 +19,13 @@
>  export LANG=C
>  set -e
>  
> +fn=test-filename-for-index-validate
> +
> +rm -f $fn
> +touch $fn
> +
>  $VG ../virt-index-validate $srcdir/index
>  $VG ../virt-index-validate $srcdir/index.asc
> +$VG ../virt-index-validate $fn
>  
> +rm $fn
> -- 
> 1.8.3.1

ACK.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top




More information about the Libguestfs mailing list