From e65fd0f0d4045f1f71ee30666309a0acf236a5ca96ff1851ff5d69cd7058433b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ismail=20D=C3=B6nmez?= Date: Wed, 6 Aug 2014 10:54:02 +0000 Subject: [PATCH 1/3] Accepting request 243672 from home:vitezslav_cizek:branches:Archiving - handle pipe input with the -f option (bnc#884004) * added bzip2-handle_pipe_input_with-f_option.patch OBS-URL: https://build.opensuse.org/request/show/243672 OBS-URL: https://build.opensuse.org/package/show/Archiving/bzip2?expand=0&rev=40 --- bzip2-handle_pipe_input_with-f_option.patch | 38 +++++++++++++++++++++ bzip2.changes | 6 ++++ bzip2.spec | 3 ++ 3 files changed, 47 insertions(+) create mode 100644 bzip2-handle_pipe_input_with-f_option.patch diff --git a/bzip2-handle_pipe_input_with-f_option.patch b/bzip2-handle_pipe_input_with-f_option.patch new file mode 100644 index 0000000..ee997ba --- /dev/null +++ b/bzip2-handle_pipe_input_with-f_option.patch @@ -0,0 +1,38 @@ +Index: bzip2-1.0.6/bzip2.c +=================================================================== +--- bzip2-1.0.6.orig/bzip2.c 2010-09-11 01:04:53.000000000 +0200 ++++ bzip2-1.0.6/bzip2.c 2014-07-31 16:23:22.366495659 +0200 +@@ -504,6 +504,11 @@ Bool uncompressStream ( FILE *zStream, F + trycat: + if (forceOverwrite) { + rewind(zStream); ++ if (errno == EBADF || errno == ESPIPE) { ++ /* zStream is not seekable, probably a pipe, ++ so we print what we already have in the obuf buffer */ ++ fwrite ( obuf, sizeof(UChar), nread, stream ); ++ } + while (True) { + if (myfeof(zStream)) break; + nread = fread ( obuf, sizeof(UChar), 5000, zStream ); +Index: bzip2-1.0.6/bzlib.c +=================================================================== +--- bzip2-1.0.6.orig/bzlib.c 2014-07-31 14:50:19.492469544 +0200 ++++ bzip2-1.0.6/bzlib.c 2014-07-31 16:25:28.271012325 +0200 +@@ -1198,6 +1198,17 @@ int BZ_API(BZ2_bzRead) + + ret = BZ2_bzDecompress ( &(bzf->strm) ); + ++ /* Unknown format. If the -f option was specified, ++ we want to write out the input data as it is. ++ However, as we can't rewind the stream in pipe, ++ we have to copy to the output buf the data ++ which were already read */ ++ if (ret == BZ_DATA_ERROR_MAGIC) { ++ strncpy(buf, bzf->buf, n); ++ BZ_SETERR(BZ_DATA_ERROR_MAGIC); ++ return n; ++ } ++ + if (ret != BZ_OK && ret != BZ_STREAM_END) + { BZ_SETERR(ret); return 0; }; + diff --git a/bzip2.changes b/bzip2.changes index d7191d0..5b29ea1 100644 --- a/bzip2.changes +++ b/bzip2.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue Aug 5 10:39:56 UTC 2014 - vcizek@suse.com + +- handle pipe input with the -f option (bnc#884004) + * added bzip2-handle_pipe_input_with-f_option.patch + ------------------------------------------------------------------- Thu Jul 31 12:39:28 UTC 2014 - dimstar@opensuse.org diff --git a/bzip2.spec b/bzip2.spec index 4e4258c..a1554a9 100644 --- a/bzip2.spec +++ b/bzip2.spec @@ -34,6 +34,8 @@ Patch3: bzip2-faster.patch Patch5: bzip2-unsafe_strcpy.patch Patch6: bzip2-point-to-doc-pkg.patch Patch7: bzip2-ocloexec.patch +# PATCH-FIX-SUSE bzip2-handle_pipe_input_with-f_option.patch +Patch8: bzip2-handle_pipe_input_with-f_option.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: autoconf >= 2.57 BuildRequires: libtool @@ -83,6 +85,7 @@ The bzip2 runtime library development files. %patch5 %patch6 -p1 %patch7 +%patch8 -p1 %build profile_bzip2() From 18f23bf66b4e99e74954bb4de889452ed48d4c22c7f19cd1007ac27b0c4409bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ismail=20D=C3=B6nmez?= Date: Wed, 6 Aug 2014 10:55:04 +0000 Subject: [PATCH 2/3] - Implement %check OBS-URL: https://build.opensuse.org/package/show/Archiving/bzip2?expand=0&rev=41 --- bzip2.changes | 5 +++++ bzip2.spec | 3 +++ 2 files changed, 8 insertions(+) diff --git a/bzip2.changes b/bzip2.changes index 5b29ea1..f3233e9 100644 --- a/bzip2.changes +++ b/bzip2.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Wed Aug 6 10:51:03 UTC 2014 - idonmez@suse.com + +- Implement %check + ------------------------------------------------------------------- Tue Aug 5 10:39:56 UTC 2014 - vcizek@suse.com diff --git a/bzip2.spec b/bzip2.spec index a1554a9..756f671 100644 --- a/bzip2.spec +++ b/bzip2.spec @@ -125,6 +125,9 @@ rm -vf %{buildroot}%{_libdir}/*.la %postun -n libbz2-1 -p /sbin/ldconfig +%check +make test + %files %defattr(-,root,root) %doc %{_mandir}/man1/* From d75ae6640c763aeab1ad1d2df611ad214d96ffb568c671e2e1946d7b285a7dbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ismail=20D=C3=B6nmez?= Date: Tue, 2 Sep 2014 17:36:25 +0000 Subject: [PATCH 3/3] Accepting request 247243 from home:vitezslav_cizek:branches:Archiving - revert the bzip2-handle_pipe_input_with-f_option.patch because it breaks other programs using the bzip2 library OBS-URL: https://build.opensuse.org/request/show/247243 OBS-URL: https://build.opensuse.org/package/show/Archiving/bzip2?expand=0&rev=42 --- bzip2-handle_pipe_input_with-f_option.patch | 38 --------------------- bzip2.changes | 6 ++++ bzip2.spec | 3 -- 3 files changed, 6 insertions(+), 41 deletions(-) delete mode 100644 bzip2-handle_pipe_input_with-f_option.patch diff --git a/bzip2-handle_pipe_input_with-f_option.patch b/bzip2-handle_pipe_input_with-f_option.patch deleted file mode 100644 index ee997ba..0000000 --- a/bzip2-handle_pipe_input_with-f_option.patch +++ /dev/null @@ -1,38 +0,0 @@ -Index: bzip2-1.0.6/bzip2.c -=================================================================== ---- bzip2-1.0.6.orig/bzip2.c 2010-09-11 01:04:53.000000000 +0200 -+++ bzip2-1.0.6/bzip2.c 2014-07-31 16:23:22.366495659 +0200 -@@ -504,6 +504,11 @@ Bool uncompressStream ( FILE *zStream, F - trycat: - if (forceOverwrite) { - rewind(zStream); -+ if (errno == EBADF || errno == ESPIPE) { -+ /* zStream is not seekable, probably a pipe, -+ so we print what we already have in the obuf buffer */ -+ fwrite ( obuf, sizeof(UChar), nread, stream ); -+ } - while (True) { - if (myfeof(zStream)) break; - nread = fread ( obuf, sizeof(UChar), 5000, zStream ); -Index: bzip2-1.0.6/bzlib.c -=================================================================== ---- bzip2-1.0.6.orig/bzlib.c 2014-07-31 14:50:19.492469544 +0200 -+++ bzip2-1.0.6/bzlib.c 2014-07-31 16:25:28.271012325 +0200 -@@ -1198,6 +1198,17 @@ int BZ_API(BZ2_bzRead) - - ret = BZ2_bzDecompress ( &(bzf->strm) ); - -+ /* Unknown format. If the -f option was specified, -+ we want to write out the input data as it is. -+ However, as we can't rewind the stream in pipe, -+ we have to copy to the output buf the data -+ which were already read */ -+ if (ret == BZ_DATA_ERROR_MAGIC) { -+ strncpy(buf, bzf->buf, n); -+ BZ_SETERR(BZ_DATA_ERROR_MAGIC); -+ return n; -+ } -+ - if (ret != BZ_OK && ret != BZ_STREAM_END) - { BZ_SETERR(ret); return 0; }; - diff --git a/bzip2.changes b/bzip2.changes index f3233e9..09ca464 100644 --- a/bzip2.changes +++ b/bzip2.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue Sep 2 15:16:50 UTC 2014 - vcizek@suse.com + +- revert the bzip2-handle_pipe_input_with-f_option.patch because it + breaks other programs using the bzip2 library + ------------------------------------------------------------------- Wed Aug 6 10:51:03 UTC 2014 - idonmez@suse.com diff --git a/bzip2.spec b/bzip2.spec index 756f671..ab0bc31 100644 --- a/bzip2.spec +++ b/bzip2.spec @@ -34,8 +34,6 @@ Patch3: bzip2-faster.patch Patch5: bzip2-unsafe_strcpy.patch Patch6: bzip2-point-to-doc-pkg.patch Patch7: bzip2-ocloexec.patch -# PATCH-FIX-SUSE bzip2-handle_pipe_input_with-f_option.patch -Patch8: bzip2-handle_pipe_input_with-f_option.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: autoconf >= 2.57 BuildRequires: libtool @@ -85,7 +83,6 @@ The bzip2 runtime library development files. %patch5 %patch6 -p1 %patch7 -%patch8 -p1 %build profile_bzip2()