RHEL 9.0.0 Alpha bootstrap
The content of this branch was automatically imported from Fedora ELN with the following as its source: https://src.fedoraproject.org/rpms/zip#18b8781d257e4c480133dce701b6cac3614e25b3
This commit is contained in:
parent
01b0999ff5
commit
6340a63e76
1
.gitignore
vendored
1
.gitignore
vendored
@ -0,0 +1 @@
|
||||
zip30.tar.gz
|
40
man.patch
Normal file
40
man.patch
Normal file
@ -0,0 +1,40 @@
|
||||
--- ./man/zipsplit.1 2008-05-08 10:17:48.000000000 +0200
|
||||
+++ ./man/zipsplit.1 2013-04-26 18:33:12.492008280 +0200
|
||||
@@ -12,6 +12,7 @@
|
||||
.RB [ \-r\ room ]
|
||||
.RB [ \-b\ path ]
|
||||
.RB [ \-h ]
|
||||
+.RB [ \-q ]
|
||||
.RB [ \-v ]
|
||||
.RB [ \-L ]
|
||||
zipfile
|
||||
@@ -47,6 +48,9 @@
|
||||
.BI \-h
|
||||
Show a short help.
|
||||
.TP
|
||||
+.BI \-q
|
||||
+Suppress some informational messages.
|
||||
+.TP
|
||||
.BI \-v
|
||||
Show version information.
|
||||
.TP
|
||||
--- ./man/zipnote.1 2013-04-26 18:40:32.145018756 +0200
|
||||
+++ ./man/zipnote.1 2013-04-26 18:40:18.943018442 +0200
|
||||
@@ -7,6 +7,7 @@
|
||||
.RB [ \-w ]
|
||||
.RB [ \-b\ path ]
|
||||
.RB [ \-h ]
|
||||
+.RB [ \-q ]
|
||||
.RB [ \-v ]
|
||||
.RB [ \-L ]
|
||||
zipfile
|
||||
@@ -27,6 +28,9 @@
|
||||
.BI \-h
|
||||
Show a short help.
|
||||
.TP
|
||||
+.BI \-q
|
||||
+Suppress some informational messages.
|
||||
+.TP
|
||||
.BI \-v
|
||||
Show version information.
|
||||
.TP
|
47
tests/tests.yml
Normal file
47
tests/tests.yml
Normal file
@ -0,0 +1,47 @@
|
||||
---
|
||||
- hosts: localhost
|
||||
tags:
|
||||
- classic
|
||||
|
||||
tasks:
|
||||
- name: Define remote_artifacts if it is not already defined
|
||||
set_fact:
|
||||
artifacts: ${HOME}/artifacts
|
||||
when: artifacts is not defined
|
||||
|
||||
- name: Make artifacts directory
|
||||
file: path={{ artifacts }} state=directory recurse=yes
|
||||
|
||||
- block:
|
||||
- name: Execute tests
|
||||
shell: |
|
||||
logfile={{ artifacts }}/test.{{ item }}.log
|
||||
exec 2>>$logfile 1>>$logfile
|
||||
cd tests
|
||||
#make script executable
|
||||
chmod 0775 {{ item }}
|
||||
#execute the test
|
||||
python2 {{ item }}.py
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "PASS {{ item }}" >> {{ artifacts }}/test.log
|
||||
else
|
||||
echo "FAIL {{ item }}" >> {{ artifacts }}/test.log
|
||||
fi
|
||||
with_items:
|
||||
- "test_4GBsegfault"
|
||||
- "test_big_file_in_archive"
|
||||
- "test_long_path_in_archive"
|
||||
- "test_many_files_in_archive"
|
||||
- "test_umask"
|
||||
- "test_umask_when_creating"
|
||||
- "test_zipnote_fails_to_update_the_archive"
|
||||
|
||||
# Can't go in block. See
|
||||
# https://github.com/ansible/ansible/issues/20736
|
||||
- name: Check the results
|
||||
shell: grep "^FAIL" {{ artifacts }}/test.log
|
||||
register: test_fails
|
||||
failed_when: test_fails.stdout or test_fails.stderr
|
||||
|
||||
|
||||
|
154
tests/tests/__init__.py
Executable file
154
tests/tests/__init__.py
Executable file
@ -0,0 +1,154 @@
|
||||
'''
|
||||
author = esakaiev@redhat.com
|
||||
'''
|
||||
import logging
|
||||
import sys
|
||||
import subprocess
|
||||
import os
|
||||
import shutil
|
||||
|
||||
|
||||
def decorated_message(message):
|
||||
"""
|
||||
This decorator is used for providing logging header for different sections in the scripts
|
||||
:param message: (`STRING`)
|
||||
:return: decorated_function
|
||||
"""
|
||||
|
||||
def decorated_function(func):
|
||||
"""
|
||||
|
||||
:param func:
|
||||
:return:
|
||||
"""
|
||||
|
||||
def wrapper(self):
|
||||
"""
|
||||
|
||||
:param self:
|
||||
:return:
|
||||
"""
|
||||
print " "
|
||||
print ("::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
|
||||
print (":: {0}".format(message))
|
||||
print ("::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
|
||||
|
||||
func(self)
|
||||
|
||||
return wrapper
|
||||
|
||||
return decorated_function
|
||||
|
||||
|
||||
class BaseZipTests(object):
|
||||
"""
|
||||
This is a Base class for zip tests
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
self._set_logger()
|
||||
self._purpose = ""
|
||||
self.print_test_purpose()
|
||||
|
||||
def _set_logger(self):
|
||||
"""
|
||||
This method is used for instantiating of logger
|
||||
:return:
|
||||
- None
|
||||
"""
|
||||
self.logger = logging.getLogger()
|
||||
self.logger.setLevel(logging.DEBUG)
|
||||
|
||||
self.handler = logging.StreamHandler(sys.stdout)
|
||||
self.handler.setLevel(logging.DEBUG)
|
||||
formatter = logging.Formatter('[ %(asctime)s ] :: [ %(message)s ]')
|
||||
self.handler.setFormatter(formatter)
|
||||
self.logger.addHandler(self.handler)
|
||||
|
||||
@decorated_message("PURPOSE")
|
||||
def print_test_purpose(self):
|
||||
"""
|
||||
|
||||
:return:
|
||||
"""
|
||||
print self._purpose
|
||||
|
||||
def run_cmd(self, cmd, exp_err_code, message, cwd=None):
|
||||
"""
|
||||
This method is used for executing cmd, check output error code and
|
||||
add result in the logger
|
||||
:param cmd: ('STRING') - some command to execute
|
||||
:param exp_err_code: ('INTEGER') - expected error code
|
||||
:param message: ('STRING') - command description
|
||||
:param cwd: ('STRING') - path to directory, where need to execute cmd
|
||||
:return:
|
||||
- errcode ('INTEGER')
|
||||
"""
|
||||
try:
|
||||
errcode = subprocess.call(cmd, shell=True, cwd=cwd, stdout=sys.stderr.fileno())
|
||||
if errcode != exp_err_code:
|
||||
self.logger.debug("FAIL :: {0}".format(message))
|
||||
else:
|
||||
self.logger.debug("PASS ] :: [ {0}".format(message))
|
||||
return errcode
|
||||
except subprocess.CalledProcessError as exp:
|
||||
self.logger.error("Could not execute command {0}, e: {1}".format(cmd, exp))
|
||||
|
||||
def check_package(self):
|
||||
"""
|
||||
This method is used for checking, if zip package is installed
|
||||
:return: None
|
||||
"""
|
||||
assert self.run_cmd("dnf list installed zip", 0, "Dnf package should be installed") == 0
|
||||
|
||||
def check_output(self, cmd, exp_output, message, cwd=None):
|
||||
"""
|
||||
This method is used for executing cmd and compare output result with expected message
|
||||
:param cmd: (`STRING`) - some command to execute
|
||||
:param exp_err_code: (`INTEGER`) - expected error code
|
||||
:param message: (`STRING`) - command description
|
||||
:param cwd: (`STRING`) - path to directory, where need to execute cmd
|
||||
:return:
|
||||
- output message (`STRING`)
|
||||
"""
|
||||
try:
|
||||
output = self.execute_cmd(cmd, cwd)
|
||||
if output != exp_output:
|
||||
self.logger.debug("FAIL ]:: [ {}".format(message))
|
||||
else:
|
||||
self.logger.debug("PASS ] :: [ {}".format(message))
|
||||
return output
|
||||
except subprocess.CalledProcessError as exp:
|
||||
self.logger.error(r'FAIL ] :: [ Could not execute command: "{0}",\
|
||||
ex: {1}'.format(cmd, exp))
|
||||
|
||||
def execute_cmd(self, cmd, cwd=None):
|
||||
"""
|
||||
This method is used for executing cmd and return output message
|
||||
:param cmd: (`STRING`) - some command to execute
|
||||
:param cwd: (`STRING`) - path to directory, where need to execute cmd
|
||||
:return:
|
||||
- output message (`STRING`)
|
||||
"""
|
||||
try:
|
||||
output = subprocess.check_output(cmd, shell=True, cwd=cwd)
|
||||
return output
|
||||
except subprocess.CalledProcessError as exp:
|
||||
self.logger.error(r'FAIL ] :: [ Could not execute command: "{0}",\
|
||||
ex: {1}'.format(cmd, exp))
|
||||
|
||||
def remove_file(self, file_path, is_directory=False):
|
||||
"""
|
||||
This method is used for removing files or directories after execution of test cases
|
||||
:param file_path:(`STRING`) - path to file/folder
|
||||
:param is_directory: (`BOOLEAN`) - True for directories
|
||||
:return: None
|
||||
"""
|
||||
try:
|
||||
if is_directory:
|
||||
shutil.rmtree(file_path)
|
||||
else:
|
||||
os.remove(file_path)
|
||||
self.logger.debug("File {0} has been successfully removed".format(file_path))
|
||||
except OSError, exp:
|
||||
self.logger.debug("File {0} doesn't exists, e: {1}".format(file_path, exp))
|
89
tests/tests/test_4GBsegfault.py
Executable file
89
tests/tests/test_4GBsegfault.py
Executable file
@ -0,0 +1,89 @@
|
||||
# Copyright (c) 2018 Red Hat, Inc. All rights reserved. This copyrighted material
|
||||
# is made available to anyone wishing to use, modify, copy, or
|
||||
# redistribute it subject to the terms and conditions of the GNU General
|
||||
# Public License v.2.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# Author: Eduard Sakaiev <esakaiev@redhat.com>
|
||||
|
||||
import sys
|
||||
import uuid
|
||||
|
||||
sys.path.append("..")
|
||||
|
||||
from tests import BaseZipTests
|
||||
from tests import decorated_message
|
||||
|
||||
PURPOSE = '''zip mustn't segfault when packing files larger than 4 GB.
|
||||
|
||||
Note: this test can't run on RHEL 2.1 since the utilities used here
|
||||
in the test don't work there as expected. This test can't run on
|
||||
RHEL 5 either, but in this case, the reason is reworked zip which
|
||||
can't work with files larger than 4 GB at all.'''
|
||||
|
||||
|
||||
class Test4GBsegfault(BaseZipTests):
|
||||
"""
|
||||
This class is used for providing functionality
|
||||
for Test4GBsegfault test case
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
"""
|
||||
|
||||
"""
|
||||
self._purpose = PURPOSE
|
||||
super(Test4GBsegfault, self).__init__()
|
||||
|
||||
self._tmpdir = "/tmp/{}".format(uuid.uuid4())
|
||||
|
||||
@decorated_message("SETUP")
|
||||
def prepare_setup(self):
|
||||
"""
|
||||
|
||||
:return:
|
||||
"""
|
||||
self.check_package()
|
||||
|
||||
self.run_cmd("mkdir {}".format(self._tmpdir), 0,
|
||||
"Creating tmp directory {}".format(self._tmpdir))
|
||||
|
||||
@decorated_message("TEST")
|
||||
def start_test(self):
|
||||
"""
|
||||
|
||||
:return:
|
||||
"""
|
||||
self.run_cmd("dd if=/dev/zero of=testfile bs=1M count=4097", 0,
|
||||
"Creating of 4Gb file", self._tmpdir + "/")
|
||||
self.run_cmd("zip testfile.zip testfile", 0,
|
||||
"Archiving file with zip", self._tmpdir + "/")
|
||||
|
||||
@decorated_message("CLEANUP")
|
||||
def cleanup(self):
|
||||
"""
|
||||
|
||||
:return:
|
||||
"""
|
||||
self.run_cmd("rm -r {}".format(self._tmpdir), 0,
|
||||
"Removing tmp directory")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_4gb = Test4GBsegfault()
|
||||
try:
|
||||
test_4gb.prepare_setup()
|
||||
test_4gb.start_test()
|
||||
except AssertionError, exp:
|
||||
test_4gb.logger.debug("FAIL ] :: [ Assertion occurred {0}".format(exp))
|
||||
except Exception, exp:
|
||||
test_4gb.logger.debug("FAIL ] :: [ Exception occurred {0}".format(exp))
|
||||
finally:
|
||||
test_4gb.cleanup()
|
128
tests/tests/test_big_file_in_archive.py
Executable file
128
tests/tests/test_big_file_in_archive.py
Executable file
@ -0,0 +1,128 @@
|
||||
# python2 test_big_file_in_archive.py
|
||||
# Author: Josef Zila <jzila@redhat.com>
|
||||
# Location: CoreOS/zip/Functionality/stress-tests/big-file-in-archive/runtest.sh
|
||||
# Description: zip - tests handling large files (2GB,3MB,4GB)
|
||||
|
||||
# Copyright (c) 2008 Red Hat, Inc. All rights reserved. This copyrighted material
|
||||
# is made available to anyone wishing to use, modify, copy, or
|
||||
# redistribute it subject to the terms and conditions of the GNU General
|
||||
# Public License v.2.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
#
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
# Include rhts and rhtslib environment
|
||||
# rpm -q --quiet rhtslib || rpm -Uvh http://nest.test.redhat.com/mnt/qa/scratch/pmuller/rhtslib/rhtslib.rpm
|
||||
|
||||
import sys
|
||||
import uuid
|
||||
import platform
|
||||
|
||||
sys.path.append("..")
|
||||
|
||||
from tests import BaseZipTests
|
||||
from tests import decorated_message
|
||||
|
||||
PURPOSE = '''
|
||||
Test Name: Big file in archive
|
||||
Author: Josef Zila <jzila@redhat.com>
|
||||
Location: CoreOS/zip/Functionality/stress-tests/big-file-in-archive/PURPOSE
|
||||
|
||||
Short Description:
|
||||
Tests handling large files (2GB,3GB,4GB)
|
||||
|
||||
Long Description:
|
||||
Test creates three files (2GB, 3GB and 4GB large) and attempts to archive each of them using zip. Then original files are deleted
|
||||
and archives are unpacked, to check size of unpacked files. Current version of zip on all archs and distros in time of
|
||||
writing(2.31-1) passes test. Note: 4GB file is too large for zip to handle, so it is not supposed to be successfully archived
|
||||
or unpacked, test just checks for correct return codes.
|
||||
|
||||
|
||||
how to run it:
|
||||
python2 test_big_file_in_archive.py
|
||||
|
||||
TEST UPDATED (esakaiev)
|
||||
------------------------
|
||||
After rebase to zip-3.0-1 there is no 4GB limit. Patching the test accordingly.
|
||||
'''
|
||||
|
||||
|
||||
class TestBigFileInArchive(BaseZipTests):
|
||||
"""
|
||||
This class is used for providing functionality
|
||||
for TestBigFileInArchive test case
|
||||
"""
|
||||
def __init__(self):
|
||||
"""
|
||||
|
||||
"""
|
||||
self._purpose = PURPOSE
|
||||
super(TestBigFileInArchive, self).__init__()
|
||||
|
||||
self._files = ['/tmp/tmp.{}'.format(uuid.uuid4()) for x in xrange(3)]
|
||||
self._files_sizes = [2048, 3056, 4096]
|
||||
self._os_distribution = platform.linux_distribution()
|
||||
|
||||
@decorated_message("Preparing Setup")
|
||||
def prepare_setup(self):
|
||||
"""
|
||||
|
||||
:return:
|
||||
"""
|
||||
self.check_package()
|
||||
for i, file_name in enumerate(self._files):
|
||||
size = self._files_sizes[i]
|
||||
assert self.run_cmd("dd if=/dev/zero of={0} bs=1M count={1}".format(file_name, size), 0,
|
||||
"Creating {0} GB file".format(size / 1000), cwd="/tmp/") == 0
|
||||
|
||||
@decorated_message("Starting Test")
|
||||
def start_test(self):
|
||||
"""
|
||||
|
||||
:return:
|
||||
"""
|
||||
for i, file_name in enumerate(self._files):
|
||||
error_code = 0
|
||||
|
||||
self.remove_file(file_name + ".zip") # #remove archive temp files, we just need unused temp names
|
||||
size = self._files_sizes[i]
|
||||
|
||||
self.run_cmd("zip {0} {1}".format(file_name + ".zip", file_name), error_code,
|
||||
"Archiving {} Gb file".format(size / 1000), cwd="/tmp/")
|
||||
|
||||
self.remove_file(file_name) # Removing original files
|
||||
|
||||
self.run_cmd("unzip {0} -d /".format(file_name + ".zip"), error_code,
|
||||
"Unpacking {} Gb file".format(size / 1000), cwd="/tmp/")
|
||||
|
||||
# Checking new 2GB file size
|
||||
self.check_output("stat -c %s {0}".format(self._files[0]), "2147483648\n", "Checking new 2GB file size")
|
||||
|
||||
@decorated_message("Cleaning up")
|
||||
def cleanup(self):
|
||||
"""
|
||||
|
||||
:return:
|
||||
"""
|
||||
for file_name in self._files:
|
||||
self.remove_file(file_name)
|
||||
self.remove_file(file_name + ".zip")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
test = TestBigFileInArchive()
|
||||
try:
|
||||
test.prepare_setup()
|
||||
test.start_test()
|
||||
except AssertionError, exp:
|
||||
test.logger.debug("FAIL ] :: [ Assertion occurred {0}".format(exp))
|
||||
except Exception, exp:
|
||||
test.logger.debug("FAIL ] :: [ Exception occurred {0}".format(exp))
|
||||
finally:
|
||||
test.cleanup()
|
140
tests/tests/test_long_path_in_archive.py
Executable file
140
tests/tests/test_long_path_in_archive.py
Executable file
@ -0,0 +1,140 @@
|
||||
# Author: Josef Zila <jzila@redhat.com>
|
||||
# Location: CoreOS/zip/Functionality/stress-tests/long-path-in-archive/runtest.sh
|
||||
# Description: zip - tests handling very long paths within archive (15*256 characters long path)
|
||||
|
||||
# Copyright (c) 2008 Red Hat, Inc. All rights reserved. This copyrighted material
|
||||
# is made available to anyone wishing to use, modify, copy, or
|
||||
# redistribute it subject to the terms and conditions of the GNU General
|
||||
# Public License v.2.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
#
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
import sys
|
||||
import uuid
|
||||
import os
|
||||
from shutil import copyfile
|
||||
|
||||
sys.path.append("..")
|
||||
|
||||
from tests import BaseZipTests
|
||||
from tests import decorated_message
|
||||
|
||||
PURPOSE = '''
|
||||
Test Name:
|
||||
Author: Josef Zila <jzila@redhat.com>
|
||||
Location: CoreOS/zip/Functionality/stress-tests/long-path-in-archive/PURPOSE
|
||||
|
||||
Short Description:
|
||||
Tests handling very long paths within archive (15*256 characters long path)
|
||||
|
||||
Long Description:
|
||||
This test creates file with very long path of 15 directories, each 255 characters. This whole directory structure is then zipped and unzipped
|
||||
to determine if zip program handles paths this long correctly. Current version of zip on all archs and distros in time of writing(2.31-1) passes test.
|
||||
|
||||
|
||||
how to run it:
|
||||
choose arch and distro
|
||||
|
||||
|
||||
TEST UPDATED (esakaiev)
|
||||
'''
|
||||
|
||||
|
||||
class TestLongPathInArchive(BaseZipTests):
|
||||
"""
|
||||
This class is used for providing functionality
|
||||
for TestLongPathInArchive test case
|
||||
"""
|
||||
def __init__(self):
|
||||
self._purpose = PURPOSE
|
||||
super(TestLongPathInArchive, self).__init__()
|
||||
|
||||
self._tmpdir = "/tmp/{}".format(uuid.uuid4())
|
||||
self._file_under_test = "/proc/version"
|
||||
|
||||
self._long_name = "".join(["aaaaa" for i in xrange(51)])
|
||||
self._long_path = "/".join([self._long_name for x in xrange(15)])
|
||||
self._test_file_path = self._tmpdir + "/" + self._long_path + "/" + "testfile"
|
||||
self._package_ver = ""
|
||||
self._package_release = ""
|
||||
|
||||
@decorated_message("Prepare setup")
|
||||
def prepare_setup(self):
|
||||
"""
|
||||
|
||||
:return:
|
||||
"""
|
||||
self.check_package()
|
||||
|
||||
self.run_cmd("mkdir {}".format(self._tmpdir), 0, "Creating tmp directory {}".format(self._tmpdir))
|
||||
self._package_ver = self.execute_cmd("rpm -q zip --queryformat %{version}")
|
||||
self._package_release = self.execute_cmd("rpm -q zip --queryformat %{version}")
|
||||
|
||||
self.logger.debug("Running zip.{0}.{1} package".format(self._package_ver, self._package_release))
|
||||
# creating folders structure:
|
||||
try:
|
||||
|
||||
os.makedirs(self._tmpdir + "/" + self._long_path)
|
||||
self.logger.debug("PASS ] :: [ Test directory with long path has been successfully created")
|
||||
except OSError, exp:
|
||||
self.logger.debug("FAIL ] :: [ Could not create directories by path, e: {}".format(exp))
|
||||
raise
|
||||
|
||||
copyfile(self._file_under_test, self._test_file_path)
|
||||
|
||||
@decorated_message("Starting Test cases")
|
||||
def start_test(self):
|
||||
"""
|
||||
|
||||
:return:
|
||||
"""
|
||||
|
||||
self.run_cmd("zip -r test {0} -q".format(self._long_name), 0,
|
||||
"Zipping test file",
|
||||
cwd=self._tmpdir)
|
||||
|
||||
self.remove_file(self._tmpdir + "/" + self._long_name, True)
|
||||
self.run_cmd("unzip -qq test.zip", 0,
|
||||
"Unzipping test file",
|
||||
cwd=self._tmpdir)
|
||||
|
||||
content_init = None
|
||||
with open(self._file_under_test) as fp_init:
|
||||
content_init = fp_init.read().replace('\n', '')
|
||||
|
||||
content_fut = None
|
||||
with open(self._test_file_path) as fp_fut:
|
||||
content_fut = fp_fut.read().replace('\n', '')
|
||||
|
||||
if content_init == content_fut:
|
||||
self.logger.debug("PASS ] :: [ {}".format("Content of the initial file and file under test was matched"))
|
||||
else:
|
||||
self.logger.debug("FAIL ] :: [ {}".format("Content of the initial file and file under test wasn't matched"))
|
||||
|
||||
@decorated_message("Cleaning up")
|
||||
def cleanup(self):
|
||||
"""
|
||||
|
||||
:return:
|
||||
"""
|
||||
self.remove_file(self._tmpdir, True)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
test = TestLongPathInArchive()
|
||||
try:
|
||||
test.prepare_setup()
|
||||
test.start_test()
|
||||
except AssertionError, exp:
|
||||
test.logger.debug("FAIL ] :: [ Assertion occurred {0}".format(exp))
|
||||
except Exception, exp:
|
||||
test.logger.debug("FAIL ] :: [ Exception occurred {0}".format(exp))
|
||||
finally:
|
||||
test.cleanup()
|
140
tests/tests/test_many_files_in_archive.py
Executable file
140
tests/tests/test_many_files_in_archive.py
Executable file
@ -0,0 +1,140 @@
|
||||
# Author: Josef Zila <jzila@redhat.com>
|
||||
# Location: CoreOS/zip/Functionality/stress-tests/many-files-in-archive/runtest.sh
|
||||
# Description: zip - Tests behaviour with many files in archive (1048578 files)
|
||||
|
||||
# Copyright (c) 2008 Red Hat, Inc. All rights reserved. This copyrighted material
|
||||
# is made available to anyone wishing to use, modify, copy, or
|
||||
# redistribute it subject to the terms and conditions of the GNU General
|
||||
# Public License v.2.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
#
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
import sys
|
||||
import uuid
|
||||
|
||||
sys.path.append("..")
|
||||
|
||||
from tests import BaseZipTests
|
||||
from tests import decorated_message
|
||||
|
||||
PURPOSE = '''
|
||||
Test Name:
|
||||
Author: Josef Zila <jzila@redhat.com>
|
||||
Location: CoreOS/zip/Functionality/stress-tests/many-files-in-archive/PURPOSE
|
||||
|
||||
Short Description:
|
||||
Tests behaviour with many files in archive (1048577 files)
|
||||
|
||||
Long Description:
|
||||
This test creates 1048576 empty files and one non-empty file. Then zips and unzips directory containing all those files and tests content of
|
||||
non-empty file and count of unzipped files. This test is very time-consuming. Current version of zip on all archs and distros in time of writing
|
||||
(2.31-1) passes test.
|
||||
|
||||
|
||||
how to run it:
|
||||
choose arch and distro
|
||||
|
||||
|
||||
TEST UPDATED (esakaiev)
|
||||
'''
|
||||
|
||||
|
||||
class TestManyFilesInArchive(BaseZipTests):
|
||||
"""
|
||||
This class is used for providing functionality
|
||||
for TestManyFilesInArchive test case
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
self._purpose = PURPOSE
|
||||
super(TestManyFilesInArchive, self).__init__()
|
||||
|
||||
self._tmpdir = "/tmp/{}".format(uuid.uuid4())
|
||||
self._files_number = 1048576
|
||||
self._package_ver = ""
|
||||
self._package_release = ""
|
||||
|
||||
@decorated_message("Prepare setup")
|
||||
def prepare_setup(self):
|
||||
"""
|
||||
|
||||
:return:
|
||||
"""
|
||||
self.check_package()
|
||||
|
||||
self.run_cmd("mkdir {}".format(self._tmpdir), 0,
|
||||
"Creating tmp directory {}".format(self._tmpdir))
|
||||
self._package_ver = self.execute_cmd("rpm -q zip --queryformat %{version}")
|
||||
self._package_release = self.execute_cmd("rpm -q zip --queryformat %{version}")
|
||||
|
||||
self.logger.debug("Running zip.{0}.{1} package".format(self._package_ver, self._package_release))
|
||||
self.logger.debug("Creating {0} files".format(self._files_number))
|
||||
|
||||
[open("{0}/{1}".format(self._tmpdir, i), "w").close() for i in xrange(self._files_number)]
|
||||
self.logger.debug("Creating test file")
|
||||
with open("{0}/test.txt".format(self._tmpdir), "w") as fp:
|
||||
fp.write("12345")
|
||||
|
||||
@decorated_message("Starting Test cases")
|
||||
def start_test(self):
|
||||
"""
|
||||
|
||||
:return:
|
||||
"""
|
||||
|
||||
self.run_cmd("zip -r test {0} -q".format(self._tmpdir.split('/')[-1]), 0,
|
||||
"Zipping test files",
|
||||
cwd='/tmp')
|
||||
|
||||
self.remove_file(self._tmpdir, True)
|
||||
self.run_cmd("unzip -qq test.zip", 0,
|
||||
"Unzipping test files",
|
||||
cwd='/tmp')
|
||||
|
||||
test_file_content = None
|
||||
with open("{0}/test.txt".format(self._tmpdir)) as fp:
|
||||
test_file_content = fp.read().replace('/n', '')
|
||||
|
||||
if test_file_content == "12345":
|
||||
self.logger.debug("PASS ] :: [ {}".format("Unpacked content matches original"))
|
||||
else:
|
||||
self.logger.debug("FAIL ] :: [ {}".format("Unpacked content does not match original!"))
|
||||
|
||||
files_count = self.execute_cmd("ls {0} | wc -l".format(self._tmpdir)).replace("\n", "")
|
||||
|
||||
if files_count == str(self._files_number + 1):
|
||||
self.logger.debug(
|
||||
"PASS ] :: [ {}".format("All {0} files present after unpacking".format(self._files_number + 1)))
|
||||
else:
|
||||
self.logger.debug(r"FAIL ] :: [ File count changed after unpacking! \
|
||||
Before zipping there was {0} files. \
|
||||
After unzip there is {1} files.".format(self._files_number + 1, files_count))
|
||||
|
||||
@decorated_message("Cleaning up")
|
||||
def cleanup(self):
|
||||
"""
|
||||
|
||||
:return:
|
||||
"""
|
||||
self.remove_file(self._tmpdir, True)
|
||||
self.remove_file("/tmp/test.zip")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
test = TestManyFilesInArchive()
|
||||
try:
|
||||
test.prepare_setup()
|
||||
test.start_test()
|
||||
except AssertionError, exp:
|
||||
test.logger.debug("FAIL ] :: [ Assertion occurred {0}".format(exp))
|
||||
except Exception, exp:
|
||||
test.logger.debug("FAIL ] :: [ Exception occurred {0}".format(exp))
|
||||
finally:
|
||||
test.cleanup()
|
106
tests/tests/test_umask.py
Executable file
106
tests/tests/test_umask.py
Executable file
@ -0,0 +1,106 @@
|
||||
# Copyright (c) 2006 Red Hat, Inc. All rights reserved. This copyrighted material
|
||||
# is made available to anyone wishing to use, modify, copy, or
|
||||
# redistribute it subject to the terms and conditions of the GNU General
|
||||
# Public License v.2.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# Author: Radek Biba <rbiba@redhat.com>
|
||||
|
||||
import sys
|
||||
import uuid
|
||||
|
||||
UMASK = "Running umask"
|
||||
|
||||
sys.path.append("..")
|
||||
|
||||
from tests import BaseZipTests
|
||||
from tests import decorated_message
|
||||
|
||||
PURPOSE = '''
|
||||
zip is supposed to honor umask settings when creating archives.
|
||||
This test case just checks if it really does
|
||||
|
||||
TEST UPDATED (esakaiev)
|
||||
'''
|
||||
|
||||
|
||||
class TestUmask(BaseZipTests):
|
||||
"""
|
||||
This class is used for providing functionality
|
||||
for TestUmask test case
|
||||
"""
|
||||
def __init__(self):
|
||||
self._purpose = PURPOSE
|
||||
super(TestUmask, self).__init__()
|
||||
|
||||
self._tmpdir = "/tmp/{}".format(uuid.uuid4())
|
||||
self._mask_list = ["0", "2", "20", "22", "200", "202", "220", "222", "6", "60"]
|
||||
self._package_ver = ""
|
||||
self._package_release = ""
|
||||
|
||||
@decorated_message("Prepare setup")
|
||||
def prepare_setup(self):
|
||||
"""
|
||||
|
||||
:return:
|
||||
"""
|
||||
self.check_package()
|
||||
|
||||
self.run_cmd("mkdir {}".format(self._tmpdir), 0, "Creating tmp directory {}".format(self._tmpdir))
|
||||
self._package_ver = self.execute_cmd("rpm -q zip --queryformat %{version}")
|
||||
self._package_release = self.execute_cmd("rpm -q zip --queryformat %{version}")
|
||||
|
||||
self.logger.debug("Running zip.{0}.{1} package".format(self._package_ver, self._package_release))
|
||||
|
||||
# Trying to verify that zip honors umask. Trying with various combinations
|
||||
# of 'w's and 'r's for User, Group, and Others.
|
||||
@decorated_message("Starting Test cases")
|
||||
def start_test(self):
|
||||
"""
|
||||
|
||||
:return:
|
||||
"""
|
||||
for mask in self._mask_list:
|
||||
self.logger.debug("Running umask and zipping file {0}".format(mask))
|
||||
self.execute_cmd("umask {0}; touch {0}; zip -q {0}.zip {0}".format(mask), cwd=self._tmpdir)
|
||||
|
||||
stat_test_zip = self.execute_cmd("stat -c %a {0}.zip".format(mask), cwd=self._tmpdir).replace("\n", "")
|
||||
stat_test = self.execute_cmd("stat -c %a {0}".format(mask), cwd=self._tmpdir).replace("\n", "")
|
||||
|
||||
print stat_test_zip, stat_test
|
||||
if stat_test_zip == stat_test:
|
||||
self.logger.debug(
|
||||
"PASS ] :: [ permissions for {0}.zip match to {0}, {1} == {2}".format(mask, stat_test_zip,
|
||||
stat_test))
|
||||
else:
|
||||
self.logger.debug(
|
||||
"FAIL ] :: [ permissions for {0}.zip doesn't match to {0}, {1} != {2}".format(mask, stat_test_zip,
|
||||
stat_test))
|
||||
|
||||
@decorated_message("Cleaning up")
|
||||
def cleanup(self):
|
||||
"""
|
||||
|
||||
:return:
|
||||
"""
|
||||
self.remove_file(self._tmpdir, True)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
test = TestUmask()
|
||||
try:
|
||||
test.prepare_setup()
|
||||
test.start_test()
|
||||
except AssertionError, exp:
|
||||
test.logger.debug("FAIL ] :: [ Assertion occurred {0}".format(exp))
|
||||
except Exception, exp:
|
||||
test.logger.debug("FAIL ] :: [ Exception occurred {0}".format(exp))
|
||||
finally:
|
||||
test.cleanup()
|
105
tests/tests/test_umask_when_creating.py
Executable file
105
tests/tests/test_umask_when_creating.py
Executable file
@ -0,0 +1,105 @@
|
||||
# Author: Josef Zila <jzila@redhat.com>
|
||||
|
||||
# Description: Zip did not honor umask setting when creating archives.
|
||||
|
||||
# Copyright (c) 2008 Red Hat, Inc. All rights reserved. This copyrighted material
|
||||
# is made available to anyone wishing to use, modify, copy, or
|
||||
# redistribute it subject to the terms and conditions of the GNU General
|
||||
# Public License v.2.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
#
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
import sys
|
||||
import uuid
|
||||
|
||||
UMASK = "Running umask"
|
||||
|
||||
sys.path.append("..")
|
||||
|
||||
from tests import BaseZipTests
|
||||
from tests import decorated_message
|
||||
|
||||
PURPOSE = '''
|
||||
Test Name: umask-when-creating
|
||||
Author: Josef Zila <jzila@redhat.com>
|
||||
|
||||
Short Description:
|
||||
zip does not honor umaks setting when creating archive
|
||||
|
||||
Long Description:
|
||||
|
||||
zip appears to have a built-in umask of 0022 regardless of the global umask.
|
||||
With umask set to 0000, zip-2.3-27 creates zip files with permissions of
|
||||
0644 instead of 0666. Previous versions created files with correct permissions.
|
||||
|
||||
|
||||
TEST UPDATED (esakaiev)
|
||||
'''
|
||||
|
||||
|
||||
class TestUmaskWhenCreating(BaseZipTests):
|
||||
"""
|
||||
This class is used for providing functionality
|
||||
for TestUmaskWhenCreating test case
|
||||
"""
|
||||
def __init__(self):
|
||||
self._purpose = PURPOSE
|
||||
super(TestUmaskWhenCreating, self).__init__()
|
||||
|
||||
self._tmpdir = "/tmp/{}".format(uuid.uuid4())
|
||||
self._mask_list = ["777", "000", "027"]
|
||||
self._expected_results = ["----------", "-rw-rw-rw-", "-rw-r-----"]
|
||||
self._package_ver = ""
|
||||
self._package_release = ""
|
||||
|
||||
@decorated_message("Prepare setup")
|
||||
def prepare_setup(self):
|
||||
self.check_package()
|
||||
|
||||
self.run_cmd("mkdir {}".format(self._tmpdir), 0, "Creating tmp directory {}".format(self._tmpdir))
|
||||
self._package_ver = self.execute_cmd("rpm -q zip --queryformat %{version}")
|
||||
self._package_release = self.execute_cmd("rpm -q zip --queryformat %{version}")
|
||||
|
||||
self.logger.debug("Running zip.{0}.{1} package".format(self._package_ver, self._package_release))
|
||||
|
||||
@decorated_message("Starting Test cases")
|
||||
def start_test(self):
|
||||
for i, mask in enumerate(self._mask_list):
|
||||
self.logger.debug("Running umask and zipping file {0}".format(mask))
|
||||
self.execute_cmd("umask -S {0} >> /dev/null; zip test /etc/services >> /dev/null".format(mask),
|
||||
cwd=self._tmpdir)
|
||||
|
||||
result = self.execute_cmd("ls -l test.zip | cut -b 1-10", cwd=self._tmpdir).replace("\n", "")
|
||||
|
||||
if result == self._expected_results[i]:
|
||||
self.logger.debug(
|
||||
"PASS ] :: [ file permissions match to {0}".format(self._expected_results[i]))
|
||||
else:
|
||||
self.logger.debug(
|
||||
"FAIL ] :: [ file permissions don't match to {0}".format(self._expected_results[i]))
|
||||
|
||||
self.remove_file(self._tmpdir + "/" + "test.zip")
|
||||
|
||||
@decorated_message("Cleaning up")
|
||||
def cleanup(self):
|
||||
self.remove_file(self._tmpdir, True)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
test = TestUmaskWhenCreating()
|
||||
try:
|
||||
test.prepare_setup()
|
||||
test.start_test()
|
||||
except AssertionError, exp:
|
||||
test.logger.debug("FAIL ] :: [ Assertion occurred {0}".format(exp))
|
||||
except Exception, exp:
|
||||
test.logger.debug("FAIL ] :: [ Exception occurred {0}".format(exp))
|
||||
finally:
|
||||
test.cleanup()
|
105
tests/tests/test_zipnote_fails_to_update_the_archive.py
Executable file
105
tests/tests/test_zipnote_fails_to_update_the_archive.py
Executable file
@ -0,0 +1,105 @@
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Description: zipnote fails to update the archive
|
||||
# Author: Karel Volny <kvolny@redhat.com>
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Copyright (c) 2015 Red Hat, Inc.
|
||||
#
|
||||
# This copyrighted material is made available to anyone wishing
|
||||
# to use, modify, copy, or redistribute it subject to the terms
|
||||
# and conditions of the GNU General Public License version 2.
|
||||
#
|
||||
# This program is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
# PURPOSE. See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public
|
||||
# License along with this program; if not, write to the Free
|
||||
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
import sys
|
||||
import uuid
|
||||
|
||||
sys.path.append("..")
|
||||
|
||||
from tests import BaseZipTests
|
||||
from tests import decorated_message
|
||||
|
||||
PURPOSE = '''
|
||||
PURPOSE of zipnote-fails-to-update-the-archive
|
||||
Description: zipnote fails to update the archive
|
||||
Author: Karel Volny <kvolny@redhat.com>
|
||||
|
||||
|
||||
TEST UPDATED (esakaiev)
|
||||
'''
|
||||
|
||||
|
||||
class TestZipnoteFailsToUpdateTheArchive(BaseZipTests):
|
||||
"""
|
||||
This class is used for providing functionality
|
||||
for TestZipnoteFailsToUpdateTheArchive test case
|
||||
"""
|
||||
def __init__(self):
|
||||
self._purpose = PURPOSE
|
||||
super(TestZipnoteFailsToUpdateTheArchive, self).__init__()
|
||||
|
||||
self._tmpdir = '/tmp/tmp.{}'.format(uuid.uuid4())
|
||||
|
||||
@decorated_message("Preparing setup")
|
||||
def prepare_setup(self):
|
||||
"""
|
||||
|
||||
:return:
|
||||
"""
|
||||
self.check_package()
|
||||
self.run_cmd("mkdir {}".format(self._tmpdir), 0, "Creating tmp directory {}".format(self._tmpdir))
|
||||
|
||||
@decorated_message("Starting Test")
|
||||
def start_test(self):
|
||||
"""
|
||||
|
||||
:return:
|
||||
"""
|
||||
self.run_cmd("touch file", 0, "Creating the Demo file", cwd=self._tmpdir)
|
||||
self.run_cmd("zip archive.zip file", 0, "Creating the archive including the file", cwd=self._tmpdir)
|
||||
self.run_cmd("zipnote archive.zip > info.txt", 0, "Reading the archive comments", cwd=self._tmpdir)
|
||||
## bad - e.g. zip-3.0-1.el6.i686:
|
||||
# zipnote error: Interrupted (aborting)
|
||||
# Segmentation fault
|
||||
## good: no output
|
||||
self.run_cmd("zipnote -w archive.zip < info.txt > output_file.txt 2>&1", 0, "Writing comments to the archive",
|
||||
cwd=self._tmpdir)
|
||||
|
||||
if 'error' in open(self._tmpdir + '/output_file.txt').read():
|
||||
self.logger.debug("FAIL ] :: [ File shouldn't contain an error pattern")
|
||||
else:
|
||||
self.logger.debug("PASS ] :: [ File doesn't contain an error pattern")
|
||||
|
||||
@decorated_message("Cleaning up")
|
||||
def cleanup(self):
|
||||
"""
|
||||
|
||||
:return:
|
||||
"""
|
||||
self.run_cmd("rm -r {}".format(self._tmpdir), 0,
|
||||
"Removing tmp directory")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
test = TestZipnoteFailsToUpdateTheArchive()
|
||||
try:
|
||||
test.prepare_setup()
|
||||
test.start_test()
|
||||
except AssertionError, exp:
|
||||
test.logger.debug("FAIL ] :: [ Assertion occurred {0}".format(exp))
|
||||
except Exception, exp:
|
||||
test.logger.debug("FAIL ] :: [ Exception occurred {0}".format(exp))
|
||||
finally:
|
||||
test.cleanup()
|
12
zip-3.0-currdir.patch
Normal file
12
zip-3.0-currdir.patch
Normal file
@ -0,0 +1,12 @@
|
||||
diff -up zip30/util.c.currdir zip30/util.c
|
||||
--- zip30/util.c.currdir 2009-11-16 12:42:17.783961701 +0100
|
||||
+++ zip30/util.c 2009-11-16 12:42:58.185960707 +0100
|
||||
@@ -493,6 +493,8 @@ int cs; /* force case-se
|
||||
/* Compare the sh pattern p with the string s and return true if they match,
|
||||
false if they don't or if there is a syntax error in the pattern. */
|
||||
{
|
||||
+ while (s[0] == '.' && s[1] == '/')
|
||||
+ s += 2; /* strip redundant leading "./" sections */
|
||||
return recmatch(p, s, cs) == 1;
|
||||
}
|
||||
|
20
zip-3.0-exec-shield.patch
Normal file
20
zip-3.0-exec-shield.patch
Normal file
@ -0,0 +1,20 @@
|
||||
diff -up zip30/crc_i386.S.exec_shield zip30/crc_i386.S
|
||||
--- zip30/crc_i386.S.exec_shield 2009-11-13 18:37:45.000000000 +0100
|
||||
+++ zip30/crc_i386.S 2009-11-13 18:39:54.435390166 +0100
|
||||
@@ -302,3 +302,6 @@ _crc32: /* ulg c
|
||||
#endif /* i386 || _i386 || _I386 || __i386 */
|
||||
|
||||
#endif /* !USE_ZLIB && !CRC_TABLE_ONLY */
|
||||
+
|
||||
+.section .note.GNU-stack, "", @progbits
|
||||
+.previous
|
||||
diff -up zip30/match.S.exec_shield zip30/match.S
|
||||
--- zip30/match.S.exec_shield 2005-01-28 10:40:14.000000000 +0100
|
||||
+++ zip30/match.S 2009-11-13 18:39:48.570389058 +0100
|
||||
@@ -405,3 +405,6 @@ L__return:
|
||||
#endif /* i386 || _I386 || _i386 || __i386 */
|
||||
|
||||
#endif /* !USE_ZLIB */
|
||||
+
|
||||
+.section .note.GNU-stack, "", @progbits
|
||||
+.previous
|
20
zip-3.0-format-security.patch
Normal file
20
zip-3.0-format-security.patch
Normal file
@ -0,0 +1,20 @@
|
||||
--- a/zip.c
|
||||
+++ a/zip.c
|
||||
@@ -1028,7 +1028,7 @@ local void help_extended()
|
||||
|
||||
for (i = 0; i < sizeof(text)/sizeof(char *); i++)
|
||||
{
|
||||
- printf(text[i]);
|
||||
+ printf("%s", text[i]);
|
||||
putchar('\n');
|
||||
}
|
||||
#ifdef DOS
|
||||
@@ -1225,7 +1225,7 @@ local void version_info()
|
||||
CR_MAJORVER, CR_MINORVER, CR_BETA_VER, CR_VERSION_DATE);
|
||||
for (i = 0; i < sizeof(cryptnote)/sizeof(char *); i++)
|
||||
{
|
||||
- printf(cryptnote[i]);
|
||||
+ printf("%s", cryptnote[i]);
|
||||
putchar('\n');
|
||||
}
|
||||
++i; /* crypt support means there IS at least one compilation option */
|
11
zip-3.0-time.patch
Normal file
11
zip-3.0-time.patch
Normal file
@ -0,0 +1,11 @@
|
||||
--- zip-2.31/unix/Makefile.time 2007-02-07 09:36:30.000000000 +0100
|
||||
+++ zip-2.31/unix/Makefile 2007-02-07 09:38:42.000000000 +0100
|
||||
@@ -24,7 +24,7 @@
|
||||
E =
|
||||
|
||||
# probably can change this to 'install' if you have it
|
||||
-INSTALL_PROGRAM = cp
|
||||
+INSTALL_PROGRAM = cp -p
|
||||
# probably can change this to 'install -d' if you have it
|
||||
# XXX NextStep 3.3 and Openstep 4.x don't know about -p !
|
||||
INSTALL_D = mkdir -p
|
293
zip.spec
Normal file
293
zip.spec
Normal file
@ -0,0 +1,293 @@
|
||||
Summary: A file compression and packaging utility compatible with PKZIP
|
||||
Name: zip
|
||||
Version: 3.0
|
||||
Release: 27%{?dist}
|
||||
License: BSD
|
||||
Source: http://downloads.sourceforge.net/infozip/zip30.tar.gz
|
||||
URL: http://www.info-zip.org/Zip.html
|
||||
|
||||
# This patch will probably be merged to zip 3.1
|
||||
# http://www.info-zip.org/board/board.pl?m-1249408491/
|
||||
Patch1: zip-3.0-exec-shield.patch
|
||||
# Not upstreamed.
|
||||
Patch2: zip-3.0-currdir.patch
|
||||
# Not upstreamed.
|
||||
Patch3: zip-3.0-time.patch
|
||||
Patch4: man.patch
|
||||
Patch5: zip-3.0-format-security.patch
|
||||
Patch6: zipnote.patch
|
||||
BuildRequires: bzip2-devel, gcc
|
||||
Requires: unzip
|
||||
|
||||
%description
|
||||
The zip program is a compression and file packaging utility. Zip is
|
||||
analogous to a combination of the UNIX tar and compress commands and
|
||||
is compatible with PKZIP (a compression and file packaging utility for
|
||||
MS-DOS systems).
|
||||
|
||||
Install the zip package if you need to compress files using the zip
|
||||
program.
|
||||
|
||||
%prep
|
||||
%setup -q -n zip30
|
||||
%patch1 -p1 -b .exec-shield
|
||||
%patch2 -p1 -b .currdir
|
||||
%patch3 -p1 -b .time
|
||||
%patch4 -p1 -b .man
|
||||
%patch5 -p1 -b .format-security
|
||||
%patch6 -p1 -b .zipnote
|
||||
|
||||
%build
|
||||
make -f unix/Makefile prefix=%{_prefix} "CFLAGS_NOOPT=-I. -DUNIX $RPM_OPT_FLAGS" generic_gcc %{?_smp_mflags}
|
||||
|
||||
%install
|
||||
mkdir -p $RPM_BUILD_ROOT%{_bindir}
|
||||
mkdir -p $RPM_BULD_ROOT%{_mandir}/man1
|
||||
|
||||
make -f unix/Makefile prefix=$RPM_BUILD_ROOT%{_prefix} \
|
||||
MANDIR=$RPM_BUILD_ROOT%{_mandir}/man1 install
|
||||
|
||||
%files
|
||||
%license LICENSE
|
||||
%doc README CHANGES TODO WHATSNEW WHERE README.CR
|
||||
%doc proginfo/algorith.txt
|
||||
%{_bindir}/zipnote
|
||||
%{_bindir}/zipsplit
|
||||
%{_bindir}/zip
|
||||
%{_bindir}/zipcloak
|
||||
%{_mandir}/man1/zip.1*
|
||||
%{_mandir}/man1/zipcloak.1*
|
||||
%{_mandir}/man1/zipnote.1*
|
||||
%{_mandir}/man1/zipsplit.1*
|
||||
|
||||
%changelog
|
||||
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.0-27
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
|
||||
|
||||
* Fri Jan 31 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.0-26
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
|
||||
|
||||
* Sat Jul 27 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.0-25
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
|
||||
|
||||
* Sun Feb 03 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.0-24
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
|
||||
|
||||
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.0-23
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
|
||||
|
||||
* Thu Mar 01 2018 Jakub Martisko <jamartis@redhat.com> - 3.0-22
|
||||
- Add gcc to buildrequires
|
||||
|
||||
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.0-21
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
|
||||
|
||||
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.0-20
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
|
||||
|
||||
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.0-19
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
|
||||
|
||||
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.0-18
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
|
||||
|
||||
* Wed Feb 01 2017 Stephen Gallagher <sgallagh@redhat.com> - 3.0-17
|
||||
- Add missing %%license macro
|
||||
|
||||
* Fri Feb 05 2016 Fedora Release Engineering <releng@fedoraproject.org> - 3.0-16
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
|
||||
|
||||
* Fri Jun 26 2015 Petr Stodulka <pstodulk@redhat.com> - 3.0-15
|
||||
- Added requirement for unzip (#1235956)
|
||||
|
||||
* Fri Jun 19 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0-14
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
|
||||
|
||||
* Wed Jan 28 2015 Petr Stodulka <pstodulk@redhat.com> - 3.0-13
|
||||
- fix crashing zipnote when editing .zip files (#1179420)
|
||||
|
||||
* Mon Aug 18 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0-12
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
|
||||
|
||||
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0-11
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
|
||||
|
||||
* Tue Apr 1 2014 Peter Robinson <pbrobinson@fedoraproject.org> 3.0-10
|
||||
- Add patch to fix format-security FTBFS (RHBZ 1037412)
|
||||
|
||||
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0-9
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
|
||||
|
||||
* Fri Apr 26 2013 Michal Luscon <mluscon@redhat.com> - 3.0-8
|
||||
- Fix missing -q option in zipsplit and zipnote man pages
|
||||
|
||||
* Sat Feb 23 2013 Ville Skyttä <ville.skytta@iki.fi> - 3.0-7
|
||||
- Enable bzip2 support.
|
||||
- Fix bogus date in %%changelog.
|
||||
|
||||
* Fri Feb 15 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0-6
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
|
||||
|
||||
* Sun Jul 22 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0-5
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
|
||||
|
||||
* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
|
||||
|
||||
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
|
||||
|
||||
* Mon May 24 2010 Karel Klic <kklic@redhat.com> - 3.0-2
|
||||
- Removed BuildRoot tag
|
||||
- Removed %%clean section
|
||||
- Removed trailing whitespaces in the spec file
|
||||
|
||||
* Fri Nov 13 2009 Karel Klic <kklic@redhat.com> - 3.0-1
|
||||
- New upstream version
|
||||
- Removed zip23.patch, because ZMEM is not used anyway
|
||||
- Removed zip-2.31-install.patch, problem solved in upstream
|
||||
- Removed zip23-umask.patch, upstream uses mkstemp which solves the problem
|
||||
- Removed zip-2.31-near-4GB.patch, because upstream version
|
||||
handles large files well
|
||||
- Removed zip-2.31-configure.patch, configure is better in the current version
|
||||
- Removed zip-2.3-sf.patch, the error message doesn't exist in upstream anymore
|
||||
- Removed zip-2.31-umask_mode.patch, which fixes also removed near-4GB patch
|
||||
- Updated zip-2.31-time.patch for zip 3.0
|
||||
- Updated exec-shield.patch for zip 3.0
|
||||
- Updated zip-2.3-currdir.patch for zip 3.0
|
||||
|
||||
* Mon Jul 27 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.31-8
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
|
||||
|
||||
* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.31-7
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
|
||||
|
||||
* Wed Feb 20 2008 Fedora Release Engineering <rel-eng@fedoraproject.org> - 2.31-6
|
||||
- Autorebuild for GCC 4.3
|
||||
|
||||
* Wed Nov 14 2007 Ivana Varekova <varekova@redhat.com> - 2.31-5
|
||||
- add S_IWOTH option
|
||||
|
||||
* Mon Nov 5 2007 Ivana Varekova <varekova@redhat.com> - 2.31-4
|
||||
- fix "zip does not honor umask setting when creating archives"
|
||||
- fix "zip segfaults by attempt to archive big file"
|
||||
- spec file cleanup
|
||||
|
||||
* Wed Feb 7 2007 Ivana Varekova <varekova@redhat.com> - 2.31-3
|
||||
- incorporate the next peckage review comment
|
||||
|
||||
* Tue Feb 6 2007 Ivana Varekova <varekova@redhat.com> - 2.31-2
|
||||
- incorporate the package review
|
||||
|
||||
* Wed Jul 12 2006 Jesse Keating <jkeating@redhat.com> - 2.31-1.2.2
|
||||
- rebuild
|
||||
|
||||
* Fri Feb 10 2006 Jesse Keating <jkeating@redhat.com> - 2.31-1.2.1
|
||||
- bump again for double-long bug on ppc(64)
|
||||
|
||||
* Tue Feb 07 2006 Jesse Keating <jkeating@redhat.com> - 2.31-1.2
|
||||
- rebuilt for new gcc4.1 snapshot and glibc changes
|
||||
|
||||
* Fri Dec 09 2005 Jesse Keating <jkeating@redhat.com>
|
||||
- rebuilt
|
||||
|
||||
* Thu Nov 10 2005 Ivana Varekova <varekova@redhat.com> 2.31-1
|
||||
- update to 2.31
|
||||
|
||||
* Mon Mar 7 2005 Ivana Varekova <varekova@redhat.com> 2.3-30
|
||||
- rebuilt
|
||||
|
||||
* Mon Jan 17 2005 Ivana Varekova <varekova@redhat.com> 2.3-29
|
||||
- Fix bug #142237 - problem with -d and ./files containing archives
|
||||
|
||||
* Mon Jun 21 2004 Lon Hohberger <lhh@redhat.com> 2.3-24
|
||||
- Extend max file/archive size to 2^32-8193 (4294959103) bytes
|
||||
- Include better debugging output for configure script
|
||||
|
||||
* Tue Jun 15 2004 Elliot Lee <sopwith@redhat.com>
|
||||
- rebuilt
|
||||
|
||||
* Fri Mar 19 2004 Lon Hohberger <lhh@redhat.com> 2.3-22
|
||||
- Fix typos
|
||||
|
||||
* Tue Feb 17 2004 Lon Hohberger <lhh@redhat.com> 2.3-21
|
||||
- Include LICENSE file per bugzilla #116004
|
||||
|
||||
* Fri Feb 13 2004 Elliot Lee <sopwith@redhat.com>
|
||||
- rebuilt
|
||||
|
||||
* Mon Dec 22 2003 Lon Hohberger <lhh@redhat.com> 2.3-19
|
||||
- Make temp file have umask 0066 mode (#112516)
|
||||
|
||||
* Fri Oct 24 2003 Lon Hohberger <lhh@redhat.com> 2.3-18
|
||||
- Incorporate Arjan's exec-shield patch for i386
|
||||
|
||||
* Wed Jun 04 2003 Elliot Lee <sopwith@redhat.com>
|
||||
- rebuilt
|
||||
|
||||
* Wed Jan 22 2003 Tim Powers <timp@redhat.com>
|
||||
- rebuilt
|
||||
|
||||
* Thu Dec 19 2002 Tim Powers <timp@redhat.com>
|
||||
- bump and rebuild
|
||||
|
||||
* Fri Jun 21 2002 Tim Powers <timp@redhat.com>
|
||||
- automated rebuild
|
||||
|
||||
* Thu May 23 2002 Tim Powers <timp@redhat.com>
|
||||
- automated rebuild
|
||||
|
||||
* Tue Apr 2 2002 Trond Eivind Glomsrød <teg@redhat.com>
|
||||
- Don't strip explicitly
|
||||
|
||||
* Wed Mar 13 2002 Trond Eivind Glomsrød <teg@redhat.com> 2.3-11
|
||||
- Add URL
|
||||
|
||||
* Sun Jun 24 2001 Elliot Lee <sopwith@redhat.com>
|
||||
- Bump release + rebuild.
|
||||
|
||||
* Fri Aug 25 2000 Bill Nottingham <notting@redhat.com>
|
||||
- add encryption code (#16878)
|
||||
|
||||
* Thu Jul 13 2000 Prospector <bugzilla@redhat.com>
|
||||
- automatic rebuild
|
||||
|
||||
* Sun Jun 11 2000 Bill Nottingham <notting@redhat.com>
|
||||
- rebuild in new environment
|
||||
|
||||
* Mon Mar 13 2000 Bill Nottingham <notting@redhat.com>
|
||||
- spec file cleanups (#10143)
|
||||
|
||||
* Mon Feb 7 2000 Bill Nottingham <notting@redhat.com>
|
||||
- fix some perms
|
||||
|
||||
* Wed Feb 02 2000 Cristian Gafton <gafton@redhat.com>
|
||||
- fix description
|
||||
- man pages are compressed
|
||||
|
||||
* Tue Jan 11 2000 Bill Nottingham <notting@redhat.com>
|
||||
- update to 2.3
|
||||
|
||||
* Fri Jul 30 1999 Bill Nottingham <notting@redhat.com>
|
||||
- update to 2.2
|
||||
|
||||
* Sun Mar 21 1999 Cristian Gafton <gafton@redhat.com>
|
||||
- auto rebuild in the new build environment (release 8)
|
||||
|
||||
* Thu Mar 18 1999 Cristian Gafton <gafton@redhat.com>
|
||||
- updated text in the spec file
|
||||
|
||||
* Fri Jan 15 1999 Cristian Gafton <gafton@redhat.com>
|
||||
- patch top build on the arm
|
||||
|
||||
* Mon Dec 21 1998 Michael Maher <mike@redhat.com>
|
||||
- built package for 6.0
|
||||
|
||||
* Mon Aug 10 1998 Jeff Johnson <jbj@redhat.com>
|
||||
- build root
|
||||
|
||||
* Fri May 08 1998 Prospector System <bugs@redhat.com>
|
||||
- translations modified for de, fr, tr
|
||||
|
||||
* Thu Jul 10 1997 Erik Troan <ewt@redhat.com>
|
||||
- built against glibc
|
13
zipnote.patch
Normal file
13
zipnote.patch
Normal file
@ -0,0 +1,13 @@
|
||||
diff --git a/zipnote.c b/zipnote.c
|
||||
index 5e02cb6..996f012 100644
|
||||
--- a/zipnote.c
|
||||
+++ b/zipnote.c
|
||||
@@ -661,7 +661,7 @@ char **argv; /* command line tokens */
|
||||
if ((r = zipcopy(z)) != ZE_OK)
|
||||
ziperr(r, "was copying an entry");
|
||||
}
|
||||
- fclose(x);
|
||||
+ fclose(in_file);
|
||||
|
||||
/* Write central directory and end of central directory with new comments */
|
||||
if ((c = zftello(y)) == (zoff_t)-1) /* get start of central */
|
Loading…
Reference in New Issue
Block a user