commit 990d5fe5df03e552154ac03c519f3f19359f7afa
Author: Hans de Goede <hdegoede(a)redhat.com>
Date: Wed Feb 1 00:51:51 2012 +0100
Fix ZipArchive not recognising dirs as such in some zips
ZipArchive-4.1.1-file-attr-fix.patch | 31 +++++++++++++++++++++++++++++++
ZipArchive.spec | 8 +++++++-
2 files changed, 38 insertions(+), 1 deletions(-)
---
diff --git a/ZipArchive-4.1.1-file-attr-fix.patch b/ZipArchive-4.1.1-file-attr-fix.patch
new file mode 100644
index 0000000..914da59
--- /dev/null
+++ b/ZipArchive-4.1.1-file-attr-fix.patch
@@ -0,0 +1,31 @@
+diff -up ZipArchive-4.1.1/ZipArchive/ZipFileHeader.cpp~ ZipArchive-4.1.1/ZipArchive/ZipFileHeader.cpp
+--- ZipArchive-4.1.1/ZipArchive/ZipFileHeader.cpp~ 2012-02-01 00:44:35.000000000 +0100
++++ ZipArchive-4.1.1/ZipArchive/ZipFileHeader.cpp 2012-02-01 00:44:51.214910040 +0100
+@@ -866,26 +866,7 @@ bool CZipFileHeader::IsDirectory()
+
+ DWORD CZipFileHeader::GetSystemAttr()
+ {
+- if (ZipCompatibility::IsPlatformSupported(GetSystemCompatibility()))
+- {
+- DWORD uAttr = GetSystemCompatibility() == ZipCompatibility::zcUnix ? (m_uExternalAttr >> 16) : (m_uExternalAttr & 0xFFFF);
+- DWORD uConvertedAttr = ZipCompatibility::ConvertToSystem(uAttr, GetSystemCompatibility(), ZipPlatform::GetSystemID());
+- if (m_uComprSize == 0 && !ZipPlatform::IsDirectory(uConvertedAttr) && CZipPathComponent::HasEndingSeparator(GetFileName()))
+- // can happen, a folder can have attributes set and no dir attribute (Python modules)
+- // TODO: [postponed] fix and cache after reading from central dir, but avoid calling GetFileName() there to keep lazy name conversion
+- return ZipPlatform::GetDefaultDirAttributes() | uConvertedAttr;
+- else
+- {
+-#ifdef _ZIP_SYSTEM_LINUX
+- // converting from Windows attributes may create a not readable linux directory
+- if (GetSystemCompatibility() != ZipCompatibility::zcUnix && ZipPlatform::IsDirectory(uConvertedAttr))
+- return ZipPlatform::GetDefaultDirAttributes();
+-#endif
+- return uConvertedAttr;
+- }
+- }
+- else
+- return CZipPathComponent::HasEndingSeparator(GetFileName()) ? ZipPlatform::GetDefaultDirAttributes() : ZipPlatform::GetDefaultAttributes();
++ return CZipPathComponent::HasEndingSeparator(GetFileName()) ? ZipPlatform::GetDefaultDirAttributes() : ZipPlatform::GetDefaultAttributes();
+ }
+
+ bool CZipFileHeader::SetSystemAttr(DWORD uAttr)
diff --git a/ZipArchive.spec b/ZipArchive.spec
index e13ca0b..8401f27 100644
--- a/ZipArchive.spec
+++ b/ZipArchive.spec
@@ -1,6 +1,6 @@
Name: ZipArchive
Version: 4.1.1
-Release: 6%{?dist}
+Release: 7%{?dist}
Summary: Library for accessing zip files
Group: System Environment/Libraries
@@ -15,6 +15,8 @@ Patch1: %{name}-autotools.patch
Patch2: %{name}-system-zlib.patch
# Fix building with gcc-4.7
Patch3: %{name}-gcc-4.7.patch
+# Fix ZipArchive not recognising dirs as such in some zips
+Patch4: %{name}-4.1.1-file-attr-fix.patch
BuildRequires: libtool
BuildRequires: zlib-devel
@@ -45,6 +47,7 @@ developing applications that use %{name}.
%patch1 -p1 -b .autotools
%patch2 -p1 -b .system-zlib
%patch3 -p1 -b .gcc47
+%patch4 -p1
for i in ZipArchive/*.txt; do
sed -i.old 's/\r//' "$i"
@@ -88,6 +91,9 @@ install -p -m 644 %{name}.pc $RPM_BUILD_ROOT%{_libdir}/pkgconfig
%changelog
+* Tue Jan 31 2012 Hans de Goede <hdegoede(a)redhat.com> - 4.1.1-7
+- Fix ZipArchive not recognising dirs as such in some zips
+
* Mon Jan 23 2012 Hans de Goede <hdegoede(a)redhat.com> - 4.1.1-6
- Improve package description (rhbz#773313)