Compare commits

...

No commits in common. 'epel8' and 'i9ce' have entirely different histories.
epel8 ... i9ce

5
.gitignore vendored

@ -1,4 +1 @@
/zipp-*.tar.gz
/zipp-*/
/results_python-zipp/
*.rpm
SOURCES/zipp-3.20.1.tar.gz

@ -0,0 +1 @@
c248a524edfd9eded061aa2cc484430ba788fc51 SOURCES/zipp-3.20.1.tar.gz

@ -1,104 +0,0 @@
diff -ur zipp-0.5.1.orig/test_zipp.py zipp-0.5.1/test_zipp.py
--- zipp-0.5.1.orig/test_zipp.py 2019-05-17 01:34:53.000000000 +1000
+++ zipp-0.5.1/test_zipp.py 2024-09-22 18:45:15.000000000 +1000
@@ -170,3 +170,20 @@
root = zipp.Path(zipfile_abcde)
assert (root / 'a').parent.at == ''
assert (root / 'a' / 'b').parent.at == 'a/'
+
+ def test_malformed_paths(self):
+ """
+ Path should handle malformed paths.
+ """
+ data = io.BytesIO()
+ zf = zipfile.ZipFile(data, "w")
+ zf.writestr("/one-slash.txt", b"content")
+ zf.writestr("//two-slash.txt", b"content")
+ zf.writestr("../parent.txt", b"content")
+ zf.filename = ''
+ root = zipp.Path(zf)
+ assert list(map(str, root.iterdir())) == [
+ 'one-slash.txt',
+ 'two-slash.txt',
+ 'parent.txt',
+ ]
diff -ur zipp-0.5.1.orig/zipp.py zipp-0.5.1/zipp.py
--- zipp-0.5.1.orig/zipp.py 2019-05-17 01:34:53.000000000 +1000
+++ zipp-0.5.1/zipp.py 2024-09-22 16:33:44.000000000 +1000
@@ -7,10 +7,67 @@
import posixpath
import zipfile
import functools
+import re
__metaclass__ = type
+class SanitizedNames:
+ """
+ ZipFile mix-in to ensure names are sanitized.
+ """
+
+ def namelist(self):
+ return list(map(self._sanitize, super().namelist()))
+
+ @staticmethod
+ def _sanitize(name):
+ r"""
+ Ensure a relative path with posix separators and no dot names.
+ Modeled after
+ https://github.com/python/cpython/blob/bcc1be39cb1d04ad9fc0bd1b9193d3972835a57c/Lib/zipfile/__init__.py#L1799-L1813
+ but provides consistent cross-platform behavior.
+ >>> san = SanitizedNames._sanitize
+ >>> san('/foo/bar')
+ 'foo/bar'
+ >>> san('//foo.txt')
+ 'foo.txt'
+ >>> san('foo/.././bar.txt')
+ 'foo/bar.txt'
+ >>> san('foo../.bar.txt')
+ 'foo../.bar.txt'
+ >>> san('\\foo\\bar.txt')
+ 'foo/bar.txt'
+ >>> san('D:\\foo.txt')
+ 'D/foo.txt'
+ >>> san('\\\\server\\share\\file.txt')
+ 'server/share/file.txt'
+ >>> san('\\\\?\\GLOBALROOT\\Volume3')
+ '?/GLOBALROOT/Volume3'
+ >>> san('\\\\.\\PhysicalDrive1\\root')
+ 'PhysicalDrive1/root'
+ Retain any trailing slash.
+ >>> san('abc/')
+ 'abc/'
+ Raises a ValueError if the result is empty.
+ >>> san('../..')
+ Traceback (most recent call last):
+ ...
+ ValueError: Empty filename
+ """
+
+ def allowed(part):
+ return part and part not in {'..', '.'}
+ # Remove the drive letter.
+ # Don't use ntpath.splitdrive, because that also strips UNC paths
+ bare = re.sub('^([A-Z]):', r'\1', name, flags=re.IGNORECASE)
+ clean = bare.replace('\\', '/')
+ parts = clean.split('/')
+ joined = '/'.join(filter(allowed, parts))
+ if not joined:
+ raise ValueError("Empty filename")
+ return joined + '/' * name.endswith('/')
+
class Path:
"""
A pathlib-compatible interface for zip files.
@@ -165,7 +222,7 @@
return self._next(parent_at)
def _names(self):
- return self._add_implied_dirs(self.root.namelist())
+ return self._add_implied_dirs(list(map(SanitizedNames._sanitize, self.root.namelist())))
if sys.version_info < (3,):
__div__ = __truediv__

@ -0,0 +1,205 @@
## START: Set by rpmautospec
## (rpmautospec version 0.7.2)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
release_number = 2;
base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec
%global pypi_name zipp
Name: python-%{pypi_name}
Version: 3.20.1
Release: %autorelease
Summary: Backport of pathlib-compatible object wrapper for zip files
# SPDX
License: MIT
URL: https://github.com/jaraco/zipp
Source0: %{pypi_source}
BuildArch: noarch
BuildRequires: python3-devel
BuildRequires: pyproject-rpm-macros
# Not using test dependencies because the list
# is full of linters and static code checkers
BuildRequires: python3dist(pytest)
BuildRequires: python3dist(jaraco-functools)
BuildRequires: python3dist(jaraco-test)
%if 0%{?epel} == 9
# Change the build backend in EPEL9 because `setuptools>=61.2` is needed for PEP621
BuildRequires: tomcli
%endif
%description
A pathlib-compatible Zipfile object wrapper. A backport of the Path object.
%package -n python3-%{pypi_name}
Summary: %{summary}
%description -n python3-%{pypi_name}
A pathlib-compatible Zipfile object wrapper. A backport of the Path object.
%prep
%autosetup -n %{pypi_name}-%{version}
# jaraco.itertools and func_timeout are not available in Fedora yet
sed -i "/import jaraco.itertools/d" tests/test_path.py
%if 0%{?epel} == 9
tomcli set pyproject.toml lists str "build-system.requires" "hatchling" "hatch-vcs"
tomcli set pyproject.toml str "build-system.build-backend" "hatchling.build"
tomcli set pyproject.toml str "tool.hatch.version.source" "vcs"
%endif
%generate_buildrequires
%pyproject_buildrequires -r
%build
%pyproject_wheel
%install
%pyproject_install
%pyproject_save_files %{pypi_name}
%check
# Skipped test needs jaraco.itertools
%pytest -k "not test_joinpath_constant_time" %{?el9:--import-mode prepend}
%files -n python3-%{pypi_name} -f %{pyproject_files}
%license LICENSE
%doc README.rst
%changelog
## START: Generated by rpmautospec
* Tue Sep 17 2024 Cristian Le <cristian.le@mpsd.mpg.de> - 3.20.1-2
- Make package buildable for epel>=9
* Tue Aug 27 2024 Lumir Balhar <lbalhar@redhat.com> - 3.20.1-1
- Update to 3.20.1 (rhbz#2307990)
* Mon Aug 12 2024 Lumir Balhar <lbalhar@redhat.com> - 3.20.0-1
- Update to 3.20.0 (rhbz#2304028)
* Fri Jul 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 3.19.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild
* Sat Jun 08 2024 Python Maint <python-maint@redhat.com> - 3.19.2-2
- Rebuilt for Python 3.13
* Tue Jun 04 2024 Lumir Balhar <lbalhar@redhat.com> - 3.19.2-1
- Update to 3.19.2 (rhbz#2290429)
* Fri May 31 2024 Lumir Balhar <lbalhar@redhat.com> - 3.19.1-1
- Update to 3.19.1 (rhbz#2284137)
* Sun May 26 2024 Lumir Balhar <lbalhar@redhat.com> - 3.19.0-1
- Update to 3.19.0 (rhbz#2283322)
* Fri Mar 15 2024 Lumir Balhar <lbalhar@redhat.com> - 3.18.1-1
- Update to 3.18.1 (rhbz#2269634)
* Wed Mar 13 2024 Lumir Balhar <lbalhar@redhat.com> - 3.18.0-1
- Update to 3.18.0 (rhbz#2269300)
* Fri Jan 26 2024 Fedora Release Engineering <releng@fedoraproject.org> - 3.17.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Mon Jan 22 2024 Fedora Release Engineering <releng@fedoraproject.org> - 3.17.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Wed Jan 10 2024 MSVSphere Packaging Team <packager@msvsphere-os.ru> - 3.17.0-1
- Rebuilt for MSVSphere 9.3
* Tue Sep 19 2023 Lumir Balhar <lbalhar@redhat.com> - 3.17.0-1
- Update to 3.17.0 (rhbz#2239492)
* Fri Jul 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 3.16.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Mon Jul 17 2023 Lumir Balhar <lbalhar@redhat.com> - 3.16.2-1
- Update to 3.16.2 (rhbz#2221413), SPDX license
* Tue Jun 13 2023 Python Maint <python-maint@redhat.com> - 3.15.0-2
- Rebuilt for Python 3.12
* Mon Feb 27 2023 Lumir Balhar <lbalhar@redhat.com> - 3.15.0-1
- Update to 3.15.0 (rhbz#2173260)
* Sat Feb 18 2023 Lumír Balhar <lbalhar@redhat.com> - 3.14.0-1
- Update to 3.14.0 (rhbz#2171124)
* Fri Feb 10 2023 Lumír Balhar <lbalhar@redhat.com> - 3.13.0-1
- Update to 3.13.0 (rhbz#2168671)
* Thu Feb 09 2023 Lumír Balhar <lbalhar@redhat.com> - 3.12.1-1
- Update to 3.12.1 (rhbz#2167196)
* Mon Jan 30 2023 Lumír Balhar <lbalhar@redhat.com> - 3.12.0-1
- Update to 3.12.0 (rhbz#2165156)
* Fri Jan 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 3.11.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Mon Nov 28 2022 Lumír Balhar <lbalhar@redhat.com> - 3.11.0-1
- Update to 3.11.0 (rhbz#2148541)
* Mon Oct 24 2022 Lumír Balhar <lbalhar@redhat.com> - 3.10.0-1
- Update to 3.10.0
Resolves: rhbz#2137172
* Mon Oct 24 2022 Lumír Balhar <lbalhar@redhat.com> - 3.9.1-1
- Update to 3.9.1
Resolves: rhbz#2137172
* Sun Oct 09 2022 Lumír Balhar <lbalhar@redhat.com> - 3.9.0-1
- Update to 3.9.0
Resolves: rhbz#2133213
* Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 3.8.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Tue Jul 12 2022 Lumír Balhar <lbalhar@redhat.com> - 3.8.1-1
- Update to 3.8.1
Resolves: rhbz#2106391
* Mon Jun 13 2022 Python Maint <python-maint@redhat.com> - 3.8.0-2
- Rebuilt for Python 3.11
* Mon Apr 04 2022 Lumír Balhar <lbalhar@redhat.com> - 3.8.0-1
- Update to 3.8.0
Resolves: rhbz#2071401
* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 3.7.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Mon Jan 03 2022 Lumír Balhar <lbalhar@redhat.com> - 3.7.0-1
- Update to 3.7.0
Resolves: rhbz#2036287
* Tue Oct 05 2021 Lumír Balhar <lbalhar@redhat.com> - 3.6.0-1
- Update to 3.6.0
Resolves: rhbz#2008627
* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 3.5.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Wed Jul 07 2021 Lumír Balhar <lbalhar@redhat.com> - 3.5.0-1
- Update to 3.5.0
Resolves: rhbz#1978839
* Wed Jun 30 2021 Lumír Balhar <lbalhar@redhat.com> - 3.4.1-1
- Unretired package with new upstream version
* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 0.5.1-3
- Rebuilt for Python 3.8
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Wed Jun 26 2019 Miro Hrončok <mhroncok@redhat.com> - 0.5.1-1
- Initial package
## END: Generated by rpmautospec

@ -1,61 +0,0 @@
%global pypi_name zipp
Name: python-%{pypi_name}
Version: 0.5.1
Release: 4%{?dist}
Summary: Backport of pathlib-compatible object wrapper for zip files
License: MIT
URL: https://github.com/jaraco/zipp
Source0: %{pypi_source}
# Backported from https://github.com/jaraco/zipp/pull/120
Patch: CVE-2024-5569_EPEL8.patch
BuildArch: noarch
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-setuptools_scm >= 1.15.0
%description
A pathlib-compatible Zipfile object wrapper. A backport of the Path object.
%package -n python3-%{pypi_name}
Summary: %{summary}
%{?python_provide:%python_provide python3-%{pypi_name}}
%description -n python3-%{pypi_name}
A pathlib-compatible Zipfile object wrapper. A backport of the Path object.
%prep
%autosetup -p1 -n %{pypi_name}-%{version}
%build
%py3_build
%install
%py3_install
%check
%{__python3} setup.py test
%files -n python3-%{pypi_name}
%license LICENSE
%doc README.rst
%{python3_sitelib}/%{pypi_name}.py
%{python3_sitelib}/__pycache__/%{pypi_name}.*
%{python3_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info/
%changelog
* Sun Sep 22 2024 Frank Crawford <frank@crawford.emu.id.au> - 0.5.1-4
- Security fix for CVE-2024-5569 (rhbz#2297119)
* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 0.5.1-3
- Rebuilt for Python 3.8
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Wed Jun 26 2019 Miro Hrončok <mhroncok@redhat.com> - 0.5.1-1
- Initial package

@ -1 +0,0 @@
SHA512 (zipp-0.5.1.tar.gz) = d4486ae98159677cd481cddb3bd00d5d2237dc94f0f3129b03994800b0e136c12b05e02d2ca7d628043dabce323f34dd919b9ba731549656802527abdcfea120
Loading…
Cancel
Save