SHA256
3
0
forked from pool/zstd

Accepting request 620417 from Archiving

OBS-URL: https://build.opensuse.org/request/show/620417
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/zstd?expand=0&rev=8
This commit is contained in:
Dominique Leuenberger 2018-07-04 21:54:08 +00:00 committed by Git OBS Bridge
commit d23f305c31
5 changed files with 132 additions and 15 deletions

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:92e41b6e8dd26bbd46248e8aa1d86f1551bc221a796277ae9362954f26d605a9
size 2059958

View File

@ -0,0 +1,103 @@
From 712a9fd9721c314f4b0238577d803b012845f6d2 Mon Sep 17 00:00:00 2001
From: "W. Felix Handte" <w@felixhandte.com>
Date: Fri, 29 Jun 2018 15:33:44 -0400
Subject: [PATCH 1/2] Allow Invoking `zstd --list` When `stdin` is not a `tty`
Also now returns an error when no inputs are given.
New proposed behavior:
```
felix@odin:~/prog/zstd (list-stdin-check)$ ./zstd -l; echo $?
No files given
1
felix@odin:~/prog/zstd (list-stdin-check)$ ./zstd -l Makefile.zst; echo $?
Frames Skips Compressed Uncompressed Ratio Check Filename
1 0 3.08 KB 10.92 KB 3.544 XXH64 Makefile.zst
0
felix@odin:~/prog/zstd (list-stdin-check)$ ./zstd -l <Makefile.zst; echo $?
zstd: --list does not support reading from standard input
No files given
1
felix@odin:~/prog/zstd (list-stdin-check)$ ./zstd -l Makefile.zst <Makefile.zst; echo $?
Frames Skips Compressed Uncompressed Ratio Check Filename
1 0 3.08 KB 10.92 KB 3.544 XXH64 Makefile.zst
0
felix@odin:~/prog/zstd (list-stdin-check)$
```
---
programs/fileio.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/programs/fileio.c b/programs/fileio.c
index 0175b316..b4eed28d 100644
--- a/programs/fileio.c
+++ b/programs/fileio.c
@@ -2017,21 +2017,25 @@ static int FIO_listFile(fileInfo_t* total, const char* inFileName, int displayLe
}
int FIO_listMultipleFiles(unsigned numFiles, const char** filenameTable, int displayLevel){
-
- if (!IS_CONSOLE(stdin)) {
- DISPLAYOUT("zstd: --list does not support reading from standard input\n");
- return 1;
+ unsigned u;
+ for (u=0; u<numFiles;u++) {
+ if (!strcmp (filenameTable[u], stdinmark)) {
+ DISPLAYOUT("zstd: --list does not support reading from standard input\n");
+ return 1;
+ }
}
if (numFiles == 0) {
+ if (!IS_CONSOLE(stdin)) {
+ DISPLAYOUT("zstd: --list does not support reading from standard input\n");
+ }
DISPLAYOUT("No files given\n");
- return 0;
+ return 1;
}
if (displayLevel <= 2) {
DISPLAYOUT("Frames Skips Compressed Uncompressed Ratio Check Filename\n");
}
{ int error = 0;
- unsigned u;
fileInfo_t total;
memset(&total, 0, sizeof(total));
total.usesCheck = 1;
--
2.16.4
From 8e7bdc18d62632adcee029b2f8f5013d11549dd7 Mon Sep 17 00:00:00 2001
From: "W. Felix Handte" <w@felixhandte.com>
Date: Fri, 29 Jun 2018 16:31:22 -0400
Subject: [PATCH 2/2] Fix Tests of `--list` Behavior with `stdin`
---
tests/playTests.sh | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/tests/playTests.sh b/tests/playTests.sh
index 09a7377f..aa5535d5 100755
--- a/tests/playTests.sh
+++ b/tests/playTests.sh
@@ -731,8 +731,14 @@ $ECHO "\n===> zstd --list/-l error detection tests "
! $ZSTD -lv tmp1*
! $ZSTD --list -v tmp2 tmp12.zst
-$ECHO "\n===> zstd --list/-l exits 1 when stdin is piped in"
-! echo "piped STDIN" | $ZSTD --list
+$ECHO "\n===> zstd --list/-l errors when presented with stdin / no files"
+! $ZSTD -l
+! $ZSTD -l -
+! $ZSTD -l < tmp1.zst
+! $ZSTD -l - < tmp1.zst
+! $ZSTD -l - tmp1.zst
+! $ZSTD -l - tmp1.zst < tmp1.zst
+$ZSTD -l tmp1.zst < tmp1.zst # but doesn't error just because stdin is not a tty
$ECHO "\n===> zstd --list/-l test with null files "
./datagen -g0 > tmp5
--
2.16.4

3
zstd-1.3.5.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d6e1559e4cdb7c4226767d4ddc990bff5f9aab77085ff0d0490c828b025e2eea
size 1706005

View File

@ -1,3 +1,19 @@
-------------------------------------------------------------------
Tue Jul 3 08:13:06 UTC 2018 - astieger@suse.com
- update to 1.3.5:
* much faster dictionary compression
* small quality improvement for dictionary generation
* slightly improved performance at high compression levels
* automatic memory release for long duration contexts
* fix overlapLog can be manually set
* fix decoding invalid lz4 frames
* fix performance degradation for dictionary compression when
using advanced API
- add zstd-1.3.5-fix-list-stdin.patch to avoid test issues with
--list when stdin is not a tty, patch from upstream
- disable failing pzstd tests
-------------------------------------------------------------------
Thu Jun 14 11:56:45 UTC 2018 - sweet_f_a@gmx.de

View File

@ -15,24 +15,25 @@
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%define major 1
%define libname lib%{name}%{major}
Name: zstd
Version: %{major}.3.4
Version: %{major}.3.5
Release: 0
Summary: Zstandard compression tools
License: BSD-3-Clause AND GPL-2.0-only
Group: Productivity/Archiving/Compression
Url: https://github.com/facebook/zstd
URL: https://github.com/facebook/zstd
Source0: https://github.com/facebook/zstd/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Patch1: pzstd.1.patch
Patch2: pzstd-global-gtest.patch
Patch3: zstd-1.3.5-fix-list-stdin.patch
BuildRequires: gcc
# C++ is needed for pzstd only
BuildRequires: gcc-c++
BuildRequires: googletest-devel
BuildRequires: pkgconfig
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
Zstd, short for Zstandard, is a lossless compression algorithm,
@ -82,6 +83,7 @@ Needed for compiling programs that link with the library.
%setup -q
%patch1 -p1
%patch2 -p1
%patch3 -p1
%build
export CFLAGS="%{optflags}"
@ -94,7 +96,7 @@ done
export CFLAGS="%{optflags}"
export CXXFLAGS="%{optflags} -std=c++11"
make %{?_smp_mflags} -C tests test-zstd
make -C contrib/pzstd test-pzstd
#make %{?_smp_mflags} -C contrib/pzstd test-pzstd
%install
%make_install PREFIX=%{_prefix} LIBDIR=%{_libdir}
@ -102,7 +104,6 @@ install -D -m755 contrib/pzstd/pzstd %{buildroot}%{_bindir}/pzstd
install -D -m644 programs/zstd.1 %{buildroot}%{_mandir}/man1/pzstd.1
%files
%defattr(-,root,root,-)
%doc NEWS README.md
%{_bindir}/zstd
%{_bindir}/zstdcat
@ -111,19 +112,17 @@ install -D -m644 programs/zstd.1 %{buildroot}%{_mandir}/man1/pzstd.1
%{_bindir}/zstdmt
%{_bindir}/unzstd
%{_bindir}/pzstd
%{_mandir}/man1/zstd.1*
%{_mandir}/man1/unzstd.1*
%{_mandir}/man1/zstdcat.1*
%{_mandir}/man1/pzstd.1*
%{_mandir}/man1/zstd.1%{?ext_man}
%{_mandir}/man1/unzstd.1%{?ext_man}
%{_mandir}/man1/zstdcat.1%{?ext_man}
%{_mandir}/man1/pzstd.1%{?ext_man}
%license COPYING LICENSE
%files -n %{libname}
%defattr(-,root,root,-)
%{_libdir}/libzstd.so.*
%license COPYING LICENSE
%files -n lib%{name}-devel
%defattr(-,root,root,-)
%license COPYING LICENSE
%{_includedir}/zbuff.h
%{_includedir}/zdict.h
@ -133,7 +132,6 @@ install -D -m644 programs/zstd.1 %{buildroot}%{_mandir}/man1/pzstd.1
%{_libdir}/libzstd.so
%files -n lib%{name}-devel-static
%defattr(-,root,root,-)
%{_libdir}/libzstd.a
%post -n %{libname} -p /sbin/ldconfig