[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] libxl: correctly initialise yylineno



# HG changeset patch
# User Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
# Date 1299172291 0
# Node ID e567c2eb56b431d83c9355e4db786a88c10d3522
# Parent  a5f8fb109610f8c4f55ef62a787f2b75200a4aab
libxl: correctly initialise yylineno

Sometimes xl would read an uninitialised variable when printing error
messages, resulting in things like this:
  /etc/xen/thing.cfg:1030057088: config parsing error near `"ws08r2-x64-2': 
lexical error

This is because yylineno is a variable inside the scanner created by
yylex_init, but it is not initialised by yylex_init.
(Debian bug #616099.)

On the way I discovered a lot of complication to do with the calling
convention between bison and flex in reentrant parsers/scanners which
use locations (Debian bug #616100) but as the above change makes the
current code in xen-unstable work I don't propose to do anything else
about that now in our tree.

Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
Tested-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---


diff -r a5f8fb109610 -r e567c2eb56b4 tools/libxl/libxlu_cfg.c
--- a/tools/libxl/libxlu_cfg.c  Thu Mar 03 17:07:40 2011 +0000
+++ b/tools/libxl/libxlu_cfg.c  Thu Mar 03 17:11:31 2011 +0000
@@ -43,6 +43,9 @@
 static void parse(CfgParseContext *ctx) {
     /* On return, ctx.err will be updated with the error status. */
     int r;
+
+    xlu__cfg_yyset_lineno(1, ctx->scanner);
+
     r= xlu__cfg_yyparse(ctx);
     if (r) assert(ctx->err);
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.