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

[Xen-changelog] [xen staging] xen/tools: Fix gen-cpuid.py's ability to report errors



commit c9d7fdb83bdfd71bec84acea0e0db232c4503212
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Mon Nov 26 12:03:07 2018 +0000
Commit:     Wei Liu <wei.liu2@xxxxxxxxxx>
CommitDate: Tue Nov 27 16:57:41 2018 +0000

    xen/tools: Fix gen-cpuid.py's ability to report errors
    
    c/s 18596903 "xen/tools: support Python 2 and Python 3" unfortunately
    introduced a TypeError when changing how Fail exceptions were printed:
    
      /local/xen.git/xen/../xen/tools/gen-cpuid.py:Traceback (most recent call 
last):
        File "/local/xen.git/xen/../xen/tools/gen-cpuid.py", line 483, in 
<module>
            sys.stderr.write(e)
      TypeError: expected a character buffer object
    
    Coerce e to a string before printing.  While changing this, fold the three
    write() calls making up the line into a single one, and take the opportunity
    to neaten the output.
    
    A sample error is:
    
      /local/xen.git/xen/tools/gen-cpuid.py: Fail: Aliased value between FOO 
and BAR
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx>
    Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 xen/tools/gen-cpuid.py | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/xen/tools/gen-cpuid.py b/xen/tools/gen-cpuid.py
index 31fdee951e..27569bdd38 100755
--- a/xen/tools/gen-cpuid.py
+++ b/xen/tools/gen-cpuid.py
@@ -479,9 +479,8 @@ if __name__ == "__main__":
         sys.exit(main())
     except Fail:
         e = sys.exc_info()[1]
-        sys.stderr.write("%s:" % (sys.argv[0],))
-        sys.stderr.write(e)
-        sys.stderr.write("\n")
+        sys.stderr.write("%s: Fail: %s\n" %
+                         (os.path.abspath(sys.argv[0]), str(e)))
         sys.exit(1)
     except SystemExit:
         e = sys.exc_info()[1]
--
generated by git-patchbot for /home/xen/git/xen.git#staging

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

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