[Pkg-libvirt-commits] [libguestfs] 60/72: builder: handle empty lines in indexes before first section (RHBZ#1201526)

Hilko Bengen bengen at moszumanska.debian.org
Sun Apr 5 15:19:52 UTC 2015


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to branch master
in repository libguestfs.

commit f5c21a643eaea0c3e40c62af4d4d8fc2dcae6bb8
Author: Pino Toscano <ptoscano at redhat.com>
Date:   Fri Mar 13 15:02:58 2015 +0100

    builder: handle empty lines in indexes before first section (RHBZ#1201526)
    
    Properly skip empty lines before the first section, otherwise they will
    trigger a syntax error in parsing.
    
    Add a simple test for it, so it doesn't regress.
    
    (cherry picked from commit fc6c16af0b765e39793554db0f55bd75f53fce9f)
---
 builder/index-parse.y                   | 8 ++++----
 builder/test-virt-index-validate-good-3 | 4 ++++
 builder/test-virt-index-validate.sh     | 1 +
 3 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/builder/index-parse.y b/builder/index-parse.y
index 36f9f07..b1a3e7c 100644
--- a/builder/index-parse.y
+++ b/builder/index-parse.y
@@ -104,10 +104,10 @@ index:
         { context->parsed_index = $2; }
 
 sections:
-      section emptylines
-        { $$ = $1; }
-    | section EMPTY_LINE emptylines sections
-        { $$ = $1; $$->next = $4; }
+      emptylines section emptylines
+        { $$ = $2; }
+    | emptylines section EMPTY_LINE emptylines sections
+        { $$ = $2; $$->next = $5; }
     | emptylines
         { $$ = NULL; }
 
diff --git a/builder/test-virt-index-validate-good-3 b/builder/test-virt-index-validate-good-3
new file mode 100644
index 0000000..f10adf0
--- /dev/null
+++ b/builder/test-virt-index-validate-good-3
@@ -0,0 +1,4 @@
+# Empty lines before the first section
+
+[foo]
+key=value
diff --git a/builder/test-virt-index-validate.sh b/builder/test-virt-index-validate.sh
index c66929d..b00a086 100755
--- a/builder/test-virt-index-validate.sh
+++ b/builder/test-virt-index-validate.sh
@@ -22,3 +22,4 @@ set -e
 ! $VG virt-index-validate test-virt-index-validate-bad-1
 $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

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git



More information about the Pkg-libvirt-commits mailing list