[Pkg-libvirt-commits] [libguestfs] 11/26: builder: show the file name in errors of the index parser

Hilko Bengen bengen at moszumanska.debian.org
Thu Mar 20 23:06:09 UTC 2014


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

bengen pushed a commit to annotated tag upstream/1.25.46
in repository libguestfs.

commit 15f04f21b9acb6ab5b48bceb0898d5c5955647a5
Author: Pino Toscano <ptoscano at redhat.com>
Date:   Wed Mar 19 16:14:34 2014 +0100

    builder: show the file name in errors of the index parser
---
 builder/index-parse.y    | 4 +++-
 builder/index-parser-c.c | 1 +
 builder/index-struct.h   | 1 +
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/builder/index-parse.y b/builder/index-parse.y
index dee2aec..9c75f71 100644
--- a/builder/index-parse.y
+++ b/builder/index-parse.y
@@ -143,7 +143,9 @@ emptylines:
 void
 yyerror (YYLTYPE * yylloc, yyscan_t scanner, struct parse_context *context, const char *msg)
 {
-  fprintf (stderr, "syntax error at line %d: %s\n",
+  fprintf (stderr, "%s%ssyntax error at line %d: %s\n",
+           context->input_file ? context->input_file : "",
+           context->input_file ? ": " : "",
            yylloc->first_line, msg);
 }
 
diff --git a/builder/index-parser-c.c b/builder/index-parser-c.c
index 7aeb6d0..8cae7b8 100644
--- a/builder/index-parser-c.c
+++ b/builder/index-parser-c.c
@@ -56,6 +56,7 @@ virt_builder_parse_index (value filenamev)
   FILE *in;
 
   parse_context_init (&context);
+  context.input_file = String_val (filenamev);
 
   in = fopen (String_val (filenamev), "r");
   if (in == NULL)
diff --git a/builder/index-struct.h b/builder/index-struct.h
index 9480526..7d4b8e0 100644
--- a/builder/index-struct.h
+++ b/builder/index-struct.h
@@ -43,6 +43,7 @@ struct parse_context {
    * compatibility with virt-builder 1.24.
    */
   int seen_comments;
+  const char *input_file;
 };
 
 /* Initialize the content of a parse_context. */

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