WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH][RESEND] Better error reporting in config file parsin

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH][RESEND] Better error reporting in config file parsing errors
From: Glauber de Oliveira Costa <gcosta@xxxxxxxxxx>
Date: Mon, 23 Oct 2006 16:35:15 -0300
Delivery-date: Mon, 23 Oct 2006 12:25:42 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.11
Hello,

I lost some time today using xm create, while invoking 'xm create cfg',
because I accidentally had a file called 'cfg' in my current working
directory. As the error dumping refers only to 'cfg', it revealed itself
somehow tricky to figure out.

I'm attaching a patch that informs the complete path of the file being
processing, besides giving a more complete error message that would give
more valuable input to help finding any issues.

Comments very welcome.

-- 
Glauber de Oliveira Costa
Red Hat Inc.
"Free as in Freedom"
--- xen-3.0.3-testing-11633/tools/python/xen/xm/opts.py.orig    2006-09-28 
18:52:39.000000000 -0400
+++ xen-3.0.3-testing-11633/tools/python/xen/xm/opts.py 2006-10-20 
16:59:35.000000000 -0400
@@ -483,11 +483,8 @@ class Opts:
         'path'    search path
         'defconfig' script name
         """
-        for x in [ '' ] + self.vals.path.split(':'):
-            if x:
-                p = os.path.join(x, self.vals.defconfig)
-            else:
-                p = self.vals.defconfig
+        for x in [ os.path.curdir ] + self.vals.path.split(':'):
+            p = os.path.join(x, self.vals.defconfig)
             if os.path.exists(p):
                 self.info('Using config file "%s".' % p)
                 self.load(p, help)
@@ -518,6 +515,10 @@ class Opts:
         exec cmd in globs, locs
         try:
             execfile(defconfig, globs, locs)
+        except SyntaxError,e:
+                raise SyntaxError, \
+                "Errors were found at line %d while processing %s:\n\t%s"\
+                %(e.lineno,defconfig,e.text)
         except:
             if not help: raise
         if help:
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>