]> granicus.if.org Git - python/commitdiff
Issue #7357: No longer suppress fatal extraction errors by
authorLars Gustäbel <lars@gustaebel.de>
Sun, 13 Dec 2009 11:32:27 +0000 (11:32 +0000)
committerLars Gustäbel <lars@gustaebel.de>
Sun, 13 Dec 2009 11:32:27 +0000 (11:32 +0000)
default.

TarFile's errorlevel argument controls how errors are
handled that occur during extraction. There are three
possible levels 0, 1 and 2. If errorlevel is set to 1 or 2
fatal errors (e.g. a full filesystem) are raised as
exceptions. If it is set to 0, which is the default value,
extraction errors are suppressed, and error messages are
written to the debug log instead. But, if the debug log is
not activated, which is the default as well, all these
errors go unnoticed.

The original intention was to imitate GNU tar which tries
to extract as many members as possible instead of stopping
on the first error. It turns out that this is no good
default behaviour for a tar library. This patch simply
changes the default value for the errorlevel argument from
0 to 1, so that fatal extraction errors are raised as
EnvironmentError exceptions.

Lib/tarfile.py
Misc/NEWS

index f48b477bb6319caec86dd71f2710cf7c65d43b79..eb42055dd2935ba6e8dab0bf667b1262b231cb28 100644 (file)
@@ -1489,7 +1489,7 @@ class TarFile(object):
     ignore_zeros = False        # If true, skips empty or invalid blocks and
                                 # continues processing.
 
-    errorlevel = 0              # If 0, fatal errors only appear in debug
+    errorlevel = 1              # If 0, fatal errors only appear in debug
                                 # messages (if debug >= 0). If > 0, errors
                                 # are passed to the caller as exceptions.
 
index 2ccef1001c2619511c44f055e8a407ebaffd4697..9cc7e82f6e9ca6afcaa7712ceeb94ad5472dd85e 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -15,6 +15,9 @@ Core and Builtins
 Library
 -------
 
+- Issue #7357: tarfile no longer suppresses fatal extraction errors by
+  default.
+
 - Issue #7470: logging: fix bug in Unicode encoding fallback.
 
 - Issue #5949: fixed IMAP4_SSL hang when the IMAP server response is