Tags: patch

Back to the open_tracefile

    try:
        tf = codecs.open(trace_fname, 'at', 'utf8', buffering=1)
<snip>
    except IOError, e:
        warning("failed to open trace file: %s" % (e))
        print "************* WTF ******************"

./bzr selftest
No handlers could be found for logger "bzr"
************* WTF ******************

So, the codecs.open() does throw an IOError, I think some sort of error 
recovery is possible?

One possible solution? Default to sys.stderr.

Attached patch.

-- 
Bob Tanner <[EMAIL PROTECTED]>          | Phone : (952)943-8700
http://www.real-time.com, Minnesota, Linux | Fax   : (952)943-8500
Key fingerprint = AB15 0BDF BCDE 4369 5B42  1973 7CF1 A709 2CC1 B288
diff -uNr bzr-0.6/bzrlib/trace.py bzr-0.6-tanner/bzrlib/trace.py
--- bzr-0.6/bzrlib/trace.py	2005-10-28 05:57:06.000000000 +0000
+++ bzr-0.6-tanner/bzrlib/trace.py	2005-11-02 22:36:14.317884117 +0000
@@ -130,7 +130,11 @@
     # buffering=1 means line buffered
     try:
         tf = codecs.open(trace_fname, 'at', 'utf8', buffering=1)
+    except IOError:
+	# Could not open logfile, default to sys.stderr
+        tf = sys.stderr
 
+    try:
         if os.fstat(tf.fileno())[stat.ST_SIZE] == 0:
             tf.write("\nthis is a debug log for diagnosing/reporting problems in bzr\n")
             tf.write("you can delete or truncate this file, or include sections in\n")

Attachment: pgpH0a3wjzS82.pgp
Description: PGP signature

Reply via email to