Patch gzip from upstream bug report
This commit is contained in:
parent
efad2fcffe
commit
a9fb7eb79e
@ -1,43 +1,38 @@
|
||||
diff -up octave-4.2.0/libinterp/dldfcn/gzip.cc.gzip octave-4.2.0/libinterp/dldfcn/gzip.cc
|
||||
--- octave-4.2.0/libinterp/dldfcn/gzip.cc.gzip 2016-11-13 08:16:10.000000000 -0700
|
||||
+++ octave-4.2.0/libinterp/dldfcn/gzip.cc 2016-12-08 20:59:14.216903463 -0700
|
||||
@@ -376,15 +376,18 @@ namespace octave
|
||||
--- libinterp/dldfcn/gzip.cc.orig 2016-11-13 08:16:10.000000000 -0700
|
||||
+++ libinterp/dldfcn/gzip.cc 2016-12-03 07:30:58.000000000 -0700
|
||||
@@ -348,14 +348,18 @@
|
||||
unsigned char buf_in[buf_len];
|
||||
unsigned char buf_out[buf_len];
|
||||
|
||||
- while ((strm->avail_in = std::fread (buf_in, sizeof (buf_in[0]),
|
||||
- buf_len, source.fp)) != 0)
|
||||
+ int flush;
|
||||
+
|
||||
+ do
|
||||
{
|
||||
+ strm->avail_in = std::fread (buf_in, sizeof (buf_in[0]),
|
||||
+ buf_len, source.fp);
|
||||
+
|
||||
if (std::ferror (source.fp))
|
||||
throw std::runtime_error ("failed to read source file");
|
||||
|
||||
strm->next_in = buf_in;
|
||||
- const int flush = std::feof (source.fp) ? Z_FINISH : Z_NO_FLUSH;
|
||||
+ flush = std::feof (source.fp) ? Z_FINISH : Z_NO_FLUSH;
|
||||
|
||||
// If deflate returns Z_OK and with zero avail_out, it must be
|
||||
// called again after making room in the output buffer because
|
||||
@@ -376,8 +380,11 @@
|
||||
while (strm->avail_out == 0);
|
||||
|
||||
if (strm->avail_in != 0)
|
||||
- throw std::runtime_error ("failed to wrote file");
|
||||
- }
|
||||
+ throw std::runtime_error ("failed to write file");
|
||||
}
|
||||
+ } while (flush != Z_FINISH);
|
||||
+
|
||||
+ if (status != Z_STREAM_END)
|
||||
+ throw std::runtime_error ("failed to write file");
|
||||
}
|
||||
|
||||
void
|
||||
close (void)
|
||||
{
|
||||
- if (deflateEnd (strm) != Z_OK)
|
||||
- throw std::runtime_error ("failed to close zlib stream");
|
||||
+ if (deflateEnd (strm) != Z_OK) {
|
||||
+ char msg[256];
|
||||
+ snprintf(msg, 255, "failed to close zlib stream: %s", strm->msg);
|
||||
+ throw std::runtime_error (msg);
|
||||
+ }
|
||||
strm = nullptr;
|
||||
|
||||
// We have no error handling for failing to close source, let
|
||||
@@ -449,14 +452,15 @@ namespace octave
|
||||
{
|
||||
X::zip (path, dest_path);
|
||||
}
|
||||
- catch (...)
|
||||
+ catch ( const std::exception & ex )
|
||||
{
|
||||
+ warning ("gzip: zip threw exception: %s", ex.what());
|
||||
// Error "handling" is not including filename on the output list.
|
||||
// Also remove created file which maybe was not even created
|
||||
// in the first place. Note that it is possible for the file
|
||||
// to exist in the first place and for X::zip to not have
|
||||
// clobber it yet but we remove it anyway by design.
|
||||
- octave::sys::unlink (dest_path);
|
||||
+ //octave::sys::unlink (dest_path);
|
||||
return;
|
||||
}
|
||||
dest_paths.push_front (dest_path);
|
||||
|
@ -33,7 +33,8 @@ Patch1: octave-implicit.patch
|
||||
# Remove project_group from appdata.xml file
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=1293561
|
||||
Patch2: octave-appdata.patch
|
||||
# Do not have gzip delete target file, emit warning message
|
||||
# Fix gzip
|
||||
# https://savannah.gnu.org/bugs/?49760
|
||||
Patch3: octave-gzip.patch
|
||||
# Add needed #include <math.h> to bring in gnulib
|
||||
Patch4: octave-gnulib.patch
|
||||
@ -186,7 +187,7 @@ This package contains documentation for Octave.
|
||||
%setup -q -n %{name}-%{version}%{?rctag}
|
||||
%patch1 -p1 -b .implicit
|
||||
%patch2 -p1 -b .appdata
|
||||
%patch3 -p1 -b .gzip
|
||||
%patch3 -p0 -b .gzip
|
||||
%patch4 -p1 -b .gnulib
|
||||
# __osmesa_print__ test is triggering a crash in libgcc, disable it
|
||||
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78409
|
||||
@ -430,8 +431,8 @@ fi
|
||||
%{_pkgdocdir}/refcard*.pdf
|
||||
|
||||
%changelog
|
||||
* Thu Dec 08 2016 Orion Poplawski <orion@cora.nwra.com> - 6:4.2.0-10
|
||||
- Try to get more info from gzip failure
|
||||
* Fri Dec 09 2016 Orion Poplawski <orion@cora.nwra.com> - 6:4.2.0-10
|
||||
- Patch gzip from upstream bug report
|
||||
|
||||
* Thu Dec 08 2016 Orion Poplawski <orion@cora.nwra.com> - 6:4.2.0-9
|
||||
- Disable more segfaulting tests
|
||||
|
Loading…
Reference in New Issue
Block a user