On Wed, Mar 19, 2014 at 05:53:10PM +0100, Pino Toscano wrote:
---
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. */
--
1.8.3.1
ACK. When you commit this, can you add (RHBZ#xxxxx) to the subject
line? It will ensure the bugs-in-changelog.sh script picks up the bug
for the release notes.
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
virt-p2v converts physical machines to virtual machines. Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v