Commit 068e7c56 authored by jvoisin's avatar jvoisin
Browse files
parent ffb4e889
......@@ -5,6 +5,7 @@ import datetime
import logging
import os
import shutil
import stat
import tarfile
import tempfile
import zipfile
......@@ -160,7 +161,10 @@ class ZipStripper(GenericArchiveStripper):
if os.path.isfile(name) and not beginning and not ending:
cfile = mat.create_class_file(name, False, add2archive=self.add2archive)
if cfile is not None:
old_stat = os.stat(name).st_mode
os.chmod(name, old_stat|stat.S_IWUSR)
os.chmod(name, old_stat)
logging.debug('Processing %s from %s' % (item.filename, self.filename))
elif item.filename not in whitelist:'%s\'s format is not supported or harmless' % item.filename)
......@@ -244,10 +248,10 @@ class TarStripper(GenericArchiveStripper):
class_file = mat.create_class_file(complete_name,
False, add2archive=self.add2archive)
if class_file:
# Nested archives are treated like unsupported ones
if not class_file.is_clean():
if not list_unsupported:
return False
# Nested archives are treated like unsupported files
elif isinstance(class_file, GenericArchiveStripper):
......@@ -7,6 +7,7 @@
import os
import sys
import shutil
import tarfile
import tempfile
import test
......@@ -157,6 +158,13 @@ class TestArchiveProcessing(test.MATTest):
unsupported_files = set(current_file.is_clean(list_unsupported=True))
self.assertEqual(unsupported_files, set(('mat.desktop', '', '')))
def test_archive_unwritable_content(self):
path = os.path.join(self.tmpdir, './')
shutil.copy2('./', self.tmpdir)
current_file = MAT.mat.create_class_file(path, False, add2archive=False)
current_file = MAT.mat.create_class_file(path, False, add2archive=False)
def get_tests():
''' Returns every libtests'''
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment