[zipios++] Add patch for bug in opening zip streams (BZ#834975).
Richard Shaw
hobbes1069 at fedoraproject.org
Wed Jun 27 15:41:32 UTC 2012
commit fd9cba7383d9f931df1cd17b81ea4904e5ae159a
Author: Richard M. Shaw <hobbes1069 at gmail.com>
Date: Wed Jun 27 10:41:32 2012 -0500
Add patch for bug in opening zip streams (BZ#834975).
zipios++-appendzip.cstdlib.patch | 7 ---
zipios++-cstdlib.patch | 18 ++++++++
zipios++-zipinputstreambuff.patch | 79 +++++++++++++++++++++++++++++++++++++
zipios++.spec | 11 ++++-
4 files changed, 106 insertions(+), 9 deletions(-)
---
diff --git a/zipios++-cstdlib.patch b/zipios++-cstdlib.patch
new file mode 100644
index 0000000..45ac387
--- /dev/null
+++ b/zipios++-cstdlib.patch
@@ -0,0 +1,18 @@
+--- zipios++-0.1.5/src/appendzip.cpp~ 2000-08-25 14:12:53.000000000 -0500
++++ zipios++-0.1.5/src/appendzip.cpp 2011-07-12 09:53:13.824178438 -0500
+@@ -1,3 +1,4 @@
++#include <cstdlib>
+ #include "zipios++/zipios-config.h"
+
+ #include "zipios++/meta-iostreams.h"
+diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' zipios++~/src/directory.h zipios++/src/directory.h
+--- zipios++~/src/directory.h 2011-08-24 16:01:00.000000000 +0200
++++ zipios++/src/directory.h 2011-08-24 16:04:56.503892154 +0200
+@@ -31,6 +31,7 @@
+ #include <string>
+ #include <ctime>
+ #include <stdexcept>
++#include <cstddef>
+
+ // #include <boost.h> Contents of boost.h
+
diff --git a/zipios++-zipinputstreambuff.patch b/zipios++-zipinputstreambuff.patch
new file mode 100644
index 0000000..9ff54e8
--- /dev/null
+++ b/zipios++-zipinputstreambuff.patch
@@ -0,0 +1,79 @@
+diff -Naur zipios++-0.1.5.9+cvs.2007.04.28.orig/src/zipinputstreambuf.cpp zipios++-0.1.5.9+cvs.2007.04.28/src/zipinputstreambuf.cpp
+--- zipios++-0.1.5.9+cvs.2007.04.28.orig/src/zipinputstreambuf.cpp 2007-01-28 18:08:47.000000000 -0600
++++ zipios++-0.1.5.9+cvs.2007.04.28/src/zipinputstreambuf.cpp 2012-06-27 10:21:24.767156783 -0500
+@@ -18,7 +18,13 @@
+ ZipInputStreambuf::ZipInputStreambuf( streambuf *inbuf, int s_pos, bool del_inbuf )
+ : InflateInputStreambuf( inbuf, s_pos, del_inbuf ),
+ _open_entry( false )
+-{}
++{
++ ConstEntryPointer entry = getNextEntry() ;
++
++ if ( ! entry->isValid() ) {
++ ; // FIXME: throw something?
++ }
++}
+
+ void ZipInputStreambuf::closeEntry() {
+ if ( ! _open_entry )
+@@ -42,30 +48,28 @@
+
+ // read the zip local header
+ istream is( _inbuf ) ; // istream does not destroy the streambuf.
+- is.exceptions( ios::eofbit | ios::failbit | ios::badbit );
+-
+- try {
+- is >> _curr_entry ;
+- if ( _curr_entry.isValid() ) {
+- _data_start = _inbuf->pubseekoff(0, ios::cur, ios::in);
+- if ( _curr_entry.getMethod() == DEFLATED ) {
+- _open_entry = true ;
+- reset() ; // reset inflatestream data structures
+- // cerr << "deflated" << endl ;
+- } else if ( _curr_entry.getMethod() == STORED ) {
+- _open_entry = true ;
+- _remain = _curr_entry.getSize() ;
+- // Force underflow on first read:
+- setg( &( _outvec[ 0 ] ),
+- &( _outvec[ 0 ] ) + _outvecsize,
+- &( _outvec[ 0 ] ) + _outvecsize );
+- // cerr << "stored" << endl ;
+- } else {
+- _open_entry = false ; // Unsupported compression format.
+- throw FCollException( "Unsupported compression format" ) ;
+- }
++ is.exceptions(istream::eofbit | istream::failbit | istream::badbit);
++ is >> _curr_entry ;
++ if ( _curr_entry.isValid() ) {
++ _data_start = _inbuf->pubseekoff(0, ios::cur,
++ ios::in);
++ if ( _curr_entry.getMethod() == DEFLATED ) {
++ _open_entry = true ;
++ reset() ; // reset inflatestream data structures
++// cerr << "deflated" << endl ;
++ } else if ( _curr_entry.getMethod() == STORED ) {
++ _open_entry = true ;
++ _remain = _curr_entry.getSize() ;
++ // Force underflow on first read:
++ setg( &( _outvec[ 0 ] ),
++ &( _outvec[ 0 ] ) + _outvecsize,
++ &( _outvec[ 0 ] ) + _outvecsize ) ;
++// cerr << "stored" << endl ;
++ } else {
++ _open_entry = false ; // Unsupported compression format.
++ throw FCollException( "Unsupported compression format" ) ;
+ }
+- } catch (...) {
++ } else {
+ _open_entry = false ;
+ }
+
+@@ -119,7 +123,7 @@
+
+ /*
+ Zipios++ - a small C++ library that provides easy access to .zip files.
+- Copyright (C) 2000 Thomas Søndergaard
++ Copyright (C) 2000 Thomas Søndergaard
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
diff --git a/zipios++.spec b/zipios++.spec
index b859425..1083c1e 100644
--- a/zipios++.spec
+++ b/zipios++.spec
@@ -4,7 +4,7 @@
Name: zipios++
Version: 0.1.5.9
-Release: 6%{dist}
+Release: 7%{dist}
License: LGPLv2+
Summary: C++ library for reading and writing Zip files
Summary(pl.UTF-8): Biblioteka C++ do odczytu i zapisu plików Zip
@@ -13,9 +13,12 @@ URL: http://zipios.sourceforge.net/
# Upstream is dead. Using updated Debian source as they are fixing FTBFS issues.
Source0: ftp://ftp.debian.org/debian/pool/main/z/%{name}/%{name}_%{version}%{cvs_ver}.orig.tar.gz
-Patch0: zipios++-appendzip.cstdlib.patch
+# Patches extracted from debian diff
+# ftp://ftp.debian.org/debian/pool/main/z/zipios++
+Patch0: zipios++-cstdlib.patch
Patch1: zipios++-amd64_fix.patch
Patch2: zipios++-fc16-ptrdiff_t.patch
+Patch3: zipios++-zipinputstreambuff.patch
BuildRequires: automake
BuildRequires: autoconf
@@ -65,6 +68,7 @@ programistów używających bibliotek zipios++.
%patch0 -p1 -b .cstdlib
%patch1 -p1 -b .amd64
%patch2 -p1 -b .ptrdiff_t
+%patch3 -p1 -b .zipinput
chmod 0644 COPYING
@@ -98,6 +102,9 @@ rm -f %{buildroot}%{_libdir}/*.{a,la}
%changelog
+* Wed Jun 27 2012 Richard Shaw <hobbes1069 at gmail.com> - 0.1.5.9-7
+- Add patch for bug in opening zip streams (BZ#834975).
+
* Tue Apr 10 2012 Richard Shaw <hobbes1069 at gmail.com> - 0.1.5.9-5
- Cleanup spec file for submission to Fedora.
- Reference Debian source since upstream is dead.
More information about the scm-commits
mailing list