diff options
| author | intrigeri | 2015-08-01 10:14:22 +0000 |
|---|---|---|
| committer | intrigeri | 2015-08-01 10:14:22 +0000 |
| commit | d8331c694a9023d82d702ed39e556d70bfb14869 (patch) | |
| tree | 7e72d9a657390e866ee06a9110c256525caabf77 /libmat | |
| parent | d397ab99d1da7eba5db2dc14c68dec9bcd479b8d (diff) | |
archive: explicitly treat text we got from tarfile as encoded UTF-8 (Closes: MAT#9831).
Without this, I see test failures caused by:
test_remove_bz2 (libtest.TestArchiveProcessing)
Test MAT's ability to process .tar.bz2 ... /usr/lib/python2.7/tarfile.py:1993: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
if self.name is not None and os.path.abspath(name) == self.name:
This change seems to make sense because we're creating our tarin and tarout
objects with encoding='utf-8' in the first place, so it's no big surprise that
what we get from it is UTF-8 -encoded text.
Diffstat (limited to 'libmat')
| -rw-r--r-- | libmat/archive.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libmat/archive.py b/libmat/archive.py index 4c62dc8..c96c74b 100644 --- a/libmat/archive.py +++ b/libmat/archive.py | |||
| @@ -237,7 +237,9 @@ class TarStripper(GenericArchiveStripper): | |||
| 237 | else: # Don't add the file to the archive | 237 | else: # Don't add the file to the archive |
| 238 | logging.debug('%s will not be added' % item.name) | 238 | logging.debug('%s will not be added' % item.name) |
| 239 | continue | 239 | continue |
| 240 | tarout.add(path, item.name, filter=self._remove) | 240 | tarout.add(unicode(path.decode('utf-8')), |
| 241 | unicode(item.name.decode('utf-8')), | ||
| 242 | filter=self._remove) | ||
| 241 | tarin.close() | 243 | tarin.close() |
| 242 | tarout.close() | 244 | tarout.close() |
| 243 | self.do_backup() | 245 | self.do_backup() |
