[Pkg-libvirt-commits] [libguestfs] 31/78: builder: better handle some index parsing errors

Hilko Bengen bengen at moszumanska.debian.org
Fri May 9 12:55:50 UTC 2014


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

bengen pushed a commit to branch experimental
in repository libguestfs.

commit 9cbb619db205da435e022884c694ff4bfd687943
Author: Pino Toscano <ptoscano at redhat.com>
Date:   Wed Apr 2 18:13:59 2014 +0200

    builder: better handle some index parsing errors
    
    Add a new lexer token, unused in the grammar, for the unknown lines in
    index files; this should allow to better handle such kind of parsing
    errors, removing the need to exit() directly (and leave things in an
    unclean state).
---
 builder/index-parse.y | 1 +
 builder/index-scan.l  | 5 +----
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/builder/index-parse.y b/builder/index-parse.y
index f08a683..310870d 100644
--- a/builder/index-parse.y
+++ b/builder/index-parse.y
@@ -78,6 +78,7 @@ typedef void *yyscan_t;
 %token         EMPTY_LINE
 %token         PGP_PROLOGUE
 %token         PGP_EPILOGUE
+%token         UNKNOWN_LINE
 
 %type <section> sections section
 %type <field>   fields field
diff --git a/builder/index-scan.l b/builder/index-scan.l
index 073d85f..e3fe377 100644
--- a/builder/index-scan.l
+++ b/builder/index-scan.l
@@ -29,8 +29,6 @@
 #define YY_EXTRA_TYPE struct parse_context *
 #define YY_USER_ACTION yylloc->first_line = yylloc->last_line = yylineno;
 
-extern void yyerror (YYLTYPE * yylloc, yyscan_t scanner, struct parse_context *context, const char *msg);
-
 %}
 
 %option nounput
@@ -110,8 +108,7 @@ extern void yyerror (YYLTYPE * yylloc, yyscan_t scanner, struct parse_context *c
 
  /* anything else is an error */
 . {
-  yyerror (yylloc, yyscanner, yyextra, "unexpected character in input");
-  exit (EXIT_FAILURE);
+  return UNKNOWN_LINE;
 }
 
 %%

-- 
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