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