summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* tests: Fix a test failure.HEADmasterBruno Haible2023-04-111-2/+6
| | | | * tests/write-error: Make executable. Skip the test if we're running as root.
* gzip: improve a write-failure diagnosticJim Meyering2023-04-072-0/+31
| | | | | | | | | | | * gzip.c (create_outfile): Call write_error, not progerror, so failure to open for writing gives a better diagnostic: gzip: failed to write d/f.gz: Permission denied rather than this: gzip: d/f.gz: Permission denied * tests/write-error: New file, to test for this. * tests/Makefile.am (TESTS): Add the file name. Reported in https://bugs.gnu.org/16876.
* gzip: fix exit status on broken pipePaul Eggert2023-02-032-0/+47
| | | | | | | | | | | | | | | | | | | | | | | Fix gzip to behave like cat etc. when outputting to a broken pipe: i.e., exit with nonzero status if SIGPIPE is ignored, and be terminated by SIGPIPE otherwise. * NEWS: Mention this. * gzip.c: Do not install signal handlers unless creating an output file, for which signal handlers are needed. This avoids gzip having to deal with signal handlers when outputting to stdout. (exiting_signal): Remove. All uses removed. (main): Do not install signal handlers at first. (create_outfile): Instead, install them only when needed. (finish_up_gzip): New function, which generalizes abort_gzip. (abort_gzip): Use it. * tests/pipe-output: New test. * tests/Makefile.am (TESTS): Add it. * util.c (EPIPE): Default to 0. (write_error): Just warn if it is a pipe error, and suppress that warning if quiet. In any event exit with status 2 (warning), not status 1 (error). * zgrep.in: Treat gzip status 141 like status 2; it is a broken pipe either way.
* maint: update copyright datesJim Meyering2023-01-0128-28/+28
|
* gzip: test invalid-input bugPaul Eggert2022-06-281-0/+1
| | | | | * NEWS: Mention the bug. * tests/unpack-invalid: Test for the bug.
* zgrep: fix "binary file matches" mislabelingPaul Eggert2022-04-072-0/+31
| | | | | | | | | | | | | | | | | | Problem reported by Jim Avera (Bug#31280). This became more of an issue when GNU grep 3.5 (2020) started sending "binary file matches" diagnostics to stderr instead of to stdout. * tests/Makefile.am (TESTS): Add zgrep-binary. * tests/zgrep-binary: New test. * zgrep.in (args): New var, to accumulate args separately from grep command, so we can prepend args if need be. Most uses of 'grep' changed to use 'args' instead, or also. (with_filename): Set to 1 if more than one file and -h not given; this simplifies later code. (gnuish_grep): New var; evaluates to true if grep supports -H and --label options, as is true for GNU and FreeBSD grep. Append -H to 'grep' if outputting file names with GNUish grep, and use --label with GNUish grep unless reading from stdin, as that’s safer and more efficient than relabeling with 'sed'.
* zgrep: add NEWS and tests for this exploitable bugJim Meyering2022-04-072-0/+42
| | | | | | | * tests/zgrep-abuse: New file, based on PoC by cleemy desu wayo. * tests/Makefile.am (TESTS): Add it. * NEWS: Mention the exploit. The bug appears to have been present since the beginning.
* maint: update from GnulibPaul Eggert2022-04-041-19/+24
| | | | | * bootstrap, tests/init.sh: Copy manually from current Gnulib. * lib/.gitignore, m4/.gitignore: Update as per current Gnulib.
* tests: port list-big test to macOS 12.1Paul Eggert2022-03-311-1/+1
| | | | * tests/list-big: Use dd, not truncate, to create a big file.
* zmore: don't assume benign PAGER in testingPaul Eggert2022-03-311-1/+1
| | | | | | | * tests/help-version (zmore_setup): Unset PAGER so that we test 'more', not whatever the tester has in its PAGER environment variable. This works around a problem I found when I ran 'PAGER=less make check' on a platform that lacked 'less'.
* zless: install only on platforms with 'less'Paul Eggert2022-03-311-1/+7
| | | | | | | | | Problem reported by Michael Felt (Bug#30029). * Makefile.am (ZLESS_MAN, ZLESS_PROG): New macros. (man_MANS, bin_SCRIPTS): Use them. * configure.ac: Check for 'less'. * tests/Makefile.am (ZLESS_PROG): New macro. (built_programs): Use it.
* maint: make update-copyrightJim Meyering2022-01-0325-25/+25
|
* build: update gnulib to latest; also bootstrap and init.shJim Meyering2022-01-031-1/+18
|
* gzip: gzip -l now outputs accurate sizePaul Eggert2021-12-152-0/+32
| | | | | | | | | | | | | | | | | | gzip -l now decompresses to see how long the uncompressed file was. This fixes what is by far the most common bug report for gzip. It has a significant performance cost, but it’s worth it nowadays. * gzip.c (main): -l now sets 'test' too. All uses of 'test' changed. (treat_stdin, treat_file): Call do_list after decompressing, so that the length is known. (do_list): Omit arg IFD, since it is no longer needed. All callers changed. Get the CRC and uncompressed size from input_crc and bytes_out instead of using lseek. * tests/list-big: New test. * unzip.c (unzip): Set unzip_crc before returning. * util.c (write_buf): If 'test', output nothing. Update bytes_out with output byte count, regardless of 'test'. All callers changed.
* tests: port still better to NetBSDPaul Eggert2021-08-311-5/+9
| | | | * tests/hufts: Ignore more lines starting with ‘+’ in stderr.
* tests: port better to NetBSDPaul Eggert2021-08-312-4/+8
| | | | | | * tests/hufts, tests/zdiff: Ignore lines starting with ‘+’ in stderr. The NetBSD shell outputs them after set -x.
* tests: update help-version from coreutilsPaul Eggert2021-08-311-59/+61
| | | | | | | This merges coreutils/tests/misc/help-version.sh into gzip/tests/help-version; they're now identical except for the initial init.sh configuration line. This should port better to NetBSD.
* tests: port two-files to IRIX 6.5Paul Eggert2021-08-311-0/+2
| | | | | Problem reported by Nelson H. F. Beebe. * tests/two-files: Skip test if /dev/urandom is not readable.
* maint: update all copyright year number rangesJim Meyering2021-01-0125-26/+26
| | | | | | | Run "make update-copyright" and then... * gnulib: Update to latest with copyright year adjusted. * tests/init.sh: Sync with gnulib to pick up copyright year. * bootstrap: Likewise.
* Add a test for compressing and decompressing two filesIlya Leoshkevich2020-09-242-0/+32
| | | | | It ensures that compression and decompression state of the first file does not affect the second file.
* IBM Z DFLTCC: fix three data corruption issuesIlya Leoshkevich2020-01-101-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | SUSE maintainers have found an issue related to building zlib in 31-bit mode, which also applies to gzip: STFLE instruction can be used only in z/Architecture mode: https://build.opensuse.org/request/show/708284 -- I have integrated the fix into this patch. * configure.ac (AC_CHECK_HEADERS_ONCE): Add feature detection for sys/sdt.h probes. * dfltcc.c (dfltcc_cc): Minor formatting improvements. (HB_BITS): Remove. (HB_SIZE): Likewise. (is_dfltcc_enabled): Fix buffer overrun on newer models and incomplete initialization on older models. Add machine mode hint. (dfltcc): Use sys/sdt.h feature detection. (bi_load): New function. (bi_close_block): Use bi_load. (close_stream): Fix overwriting the End-of-block Symbol. (dfltcc_deflate): Fix losing partial byte on flush. Fix setting Block-Continuation Flag when DFLTCC-CMPR outputs 0 bits and requests a retry. Minor formatting improvements. (dfltcc_inflate): Retry immediately if requested. Print the hardware error code and flush the output buffer on error. Minor formatting improvements. * tests/hufts: Ignore the hardware error code.
* maint: update all copyright year number rangesJim Meyering2020-01-0124-249/+314
| | | | | | | Run "make update-copyright" and then... * gnulib: Update to latest with copyright year adjusted. * tests/init.sh: Sync with gnulib to pick up copyright year. * bootstrap: Likewise.
* bug#34918: [PATCH] Add support for IBM Z hardware-accelerated deflateIlya Leoshkevich2019-04-021-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Future versions of IBM Z mainframes will provide DFLTCC instruction, which implements deflate algorithm in hardware with estimated compression and decompression performance orders of magnitude faster than the current gzip and ratio comparable with that of level 1. This patch adds DFLTCC support to gzip. In order to enable it, the following build commands should be used: $ ./configure --enable-dfltcc $ make When built like this, gzip would compress in hardware on level 1, and in software on all other levels. Decompression will always happen in hardware. In order to enable DFLTCC compression for levels 1-6 (i.e. to make it used by default) one could either add -DDFLTCC_LEVEL_MASK=0x7e at compile time, or set the environment variable DFLTCC_LEVEL_MASK to 0x7e at run time. Two DFLTCC compression calls produce the same results only when they both are made on machines of the same generation, and when the respective buffers have the same offset relative to the start of the page. Therefore care should be taken when using hardware compression when reproducible results are desired. One such use case - reproducible software builds - is handled explicitly: when SOURCE_DATE_EPOCH environment variable is set, the hardware compression is disabled. This patch tries to add DFLTCC support in a least intrusive way. All SystemZ-specific code was placed into a separate file, but unfortunately there is still a noticeable amount of changes in the main gzip code. Below is the summary of those changes. DFLTCC will refuse to write an End-of-block Symbol if there is no input data, thus in some cases it is necessary to do this manually. In order to achieve this, bi_buf and bi_valid were promoted to extern variables. lm_init() function moves the input buffer into the window, which is not desirable for DFLTCC. Therefore, its invocation was moved to software-only deflate(). In addition to initializing the window, this function also used to convert compression level to flags, which is still needed for DFLTCC. This responsibility was handed off to zip() function. To achieve maximum performance with DFLTCC, inbuf and outbuf must be 256k big and page-aligned. Additionally, for DFLTCC to work at all, the window must be page-aligned. In addition to compression, DFLTCC computes CRC-32 checksum, therefore, whenever it's used, software checksumming needs to be suppressed and its results replaced by those of dfltcc. This is achieved by introducing the new getcrc() and setcrc() functions. Unlike the current software implementation, DFLTCC decompresses data into the output buffer, and not the window. Therefore, just like flushing the window, flushing the output buffer must honor the test flag. Finally, znew-k test assumes that "znew -K" would not convert the test .Z file to .gz, which is not the case with DFLTCC. Since this is not the main point of the test, this assumption was relaxed.
* maint: update all copyright dates via "make update-copyright"Jim Meyering2019-01-0124-24/+24
| | | | * gnulib: Also update submodule for its copyright updates.
* gzip: fix use of uninitialized memoryPaul Eggert2018-11-301-1/+8
| | | | | | | | Problem reported by Hanno Böck (Bug#33501). * NEWS: Mention this. * inflate.c (inflate_dynamic): Return if code is invalid. Fix by Mark Adler. * tests/hufts: Add test case for the bug.
* gzip: make the output more reproduciblePaul Eggert2018-08-022-0/+29
| | | | | | | | | | | Problem reported by Bernhard M. Wiedemann (Bug#32342). * NEWS: Mention this. * doc/gzip.texi (Overview, Invoking gzip): Document this. * gzip.c (get_input_size_and_time): New function, which implements the change. (treat_stdin, treat_file): Use it. * tests/reproducible: New test. * tests/Makefile.am (TESTS): Add it.
* maint: update gnulib to latest; also update bootstrap and init.shJim Meyering2018-07-011-1/+1
|
* maint: update gnulib and copyright dates for 2018Jim Meyering2018-01-0323-23/+23
| | | | | | * gnulib: Update to latest. * bootstrap: Update from gnulib. * all files: Run "make update-copyright".
* tests: don’t be so strict about timestampsPaul Eggert2017-11-121-11/+38
| | | | | | | * tests/timestamp: We’ve had many false alarms about timestamps that are not gzip problems, but instead are problems with ‘touch’. Attempt to work around them by not trusting ‘touch’ so much. Problems and parts of solutions proposed by Bruno Haible.
* tests: unpack-invalid: correct and clean up a testJim Meyering2017-11-091-6/+2
| | | | | | | * tests/unpack-invalid: There was a logic error that would have caused this test to ignore a failure if first iteration of the loop set fail=1 and the second one reset it to 0. Also, use "returns_ 1 ...", to require an exit status of 1.
* tests/unpack-valid: port to printf that do not grok hexJim Meyering2017-10-292-2/+12
| | | | | | | | Many versions of printf do not handle hexadecimal in a format string, so this test would fail. * tests/init.cfg (hex_printf_): Copied from grep's tests/init.cfg. * tests/unpack-valid: Use hex_printf_. Reported by Bruno Haible in https://bugs.gnu.org/29033#26
* gnulib: update to latest; also update tests/init.sh from gnulibJim Meyering2017-10-291-4/+17
|
* gzip: fix bug with any upper case custom ('-S'-specified) suffixJim Meyering2017-10-292-0/+34
| | | | | | | | | | | | Any user-specified suffix with an upper case letter would fail to match desired file. * gzip.c (get_suffix): First, arrange to have only one return point rather than two. Put a lower-cased (just-malloc'd) copy of z_suffix in the suffix vector, and free it before returning. * tests/upper-suffix: New file. * tests/Makefile.am (TESTS): Add it. * NEWS: Mention it. Reported by meo@xenialab.it in https://bugs.gnu.org/29006
* gzip: fix bug in unpack EOB checkPaul Eggert2017-10-162-0/+33
| | | | | | | | | | | Problem reported by Vidar Holen (Bug#28861). * NEWS: Mention fix. * tests/unpack-valid: New test. * tests/Makefile.am (TESTS): Add it. * unpack.c (build_tree): Report an error if Huffman tree has too few leaves. * unpack.c (unpack): Fix check for EOB. Remove now-unnecessary check for code out of range.
* maint: prefer HTTPS to HTTP, FTP in URLsPaul Eggert2017-09-1921-21/+21
|
* gzip: port zdiff, zless to BusyboxPaul Eggert2017-03-131-1/+3
| | | | | | | | | Problem reported by Denys Zagorui (Bug#26088). * tests/zdiff: Check that diff uses POSIX-format output. * zless.in (less_version): Don't exit merely because 'less -V' fails; instead, assume 'less' is compatible with an old version of the original 'less'. Busybox 'less -V' fails, but apparently its 'less' works anyway somehow.
* tests: avoid failure when running with no ttyJim Meyering2017-02-061-1/+1
| | | | | * tests/help-version (zcat_setup): Export TERM=dumb, to avoid zless malfunction. Reported by Assaf Gordon in https://bugs.gnu.org/25636#8
* gnulib: update to latest; and tests/init.sh and bootstrapJim Meyering2017-02-061-44/+33
|
* maint: change "time stamp" to "timestamp" globallyJim Meyering2017-02-061-4/+4
| | | | | | | | | | | | | | | | | | | This avoids a new syntax-check failure. * ChangeLog-2007: Perform that change. * NEWS: Likewise. * algorithm.doc: Likewise. * doc/gzip.texi: Likewise. * gunzip.in: Likewise. * gzip.1: Likewise. * gzip.c: Likewise. * gzip.h: Likewise. * m4/.gitignore: Likewise. * sample/ztouch: Likewise. * tests/timestamp: Likewise. * unzip.c: Likewise. * zip.c: Likewise. * znew.1: Likewise. * cfg.mk: Update the old news hash accordingly.
* maint: update gnulib and copyright dates for 2017Jim Meyering2017-01-0121-21/+21
| | | | | * gnulib: Update to latest. * all files: Run "make update-copyright".
* maint: use "returns_" rather than explicit comparison with "$?"Jim Meyering2016-11-083-8/+4
| | | | | | * tests/zdiff: Use "returns_ 1" rather than testing $? = 1. * tests/hufts: Likewise. * tests/timestamp: Likewise, but s/1/2/.
* gzip --no-name: avoid spurious warningPaul Eggert2016-11-041-0/+3
| | | | | | Problem reported by Jim Meyering (Bug#24826). * tests/timestamp: Add a test from Jim Meyering to exercise the fix * zip.c (zip): Treat unknown time stamps as 0.
* maint: avoid unwarranted "make syntax-check" failureJim Meyering2016-10-021-2/+2
| | | | | * tests/timestamp: Reorder "rm" arguments so the doubled-word syntax-check rule does not detect a false positive "in in" here.
* gzip: fix some Y2038 etc. bugsPaul Eggert2016-09-062-0/+53
| | | | | | | | | * NEWS: Document this. * gzip.c (get_method): Warn about out-of-range MTIME, and ignore it instead of relying on possibly-undefined behavior. * tests/Makefile.am (TESTS): Add timestamp. * tests/timestamp: New test. * zip.c (zip): Warn about out-of-range file time stamp.
* gzip: fix bug with -l output to pipesPaul Eggert2016-04-192-0/+32
| | | | | | | | | | | Problem reported by Christian Franke via Eric Blake in: http://bugs.gnu.org/23314 * NEWS: Mention this. * gzip.c (main): Do not close stdout twice when given -l. Instead, -l now just fflushes stdout, so that fdatasync can synchronize it if --synchronize is also specified. * tests/list: New test case. * tests/Makefile.am (TESTS): Add it.
* * tests/init.sh: Sync from Gnulib.Paul Eggert2016-03-261-14/+17
|
* zgrep: with -f SPECIAL, read SPECIAL just oncePaul Eggert2016-03-181-2/+10
| | | | | | | | | Problem reported by Fulvio Scapin in: http://bugs.gnu.org/22945 * NEWS: Document this. * tests/zgrep-f: Add a test. Adjust a test to cover the case of more than one line in -f's input. * zgrep.in (with_filename): With -f FILE, if FILE is stdin or not a regular file, copy it into a temporary and use the temporary.
* gzip: remove --__bindirPaul Eggert2016-03-061-25/+7
| | | | | | | | | | | | | | | | | | | * NEWS: Document this. * gzexe.in, gunzip.in, zcat.in, zcmp.in, zdiff.in, zegrep.in: * zfgrep.in, zforce.in, zgrep.in, zless.in, zmore.in, znew.in: Remove support for undocumented --__bindir option. Callers can set PATH instead; that's less error-prone. This fixes some 'make check' failures on my Solaris 11 box, which occurred because the test scripts were mistakenly testing the installed gzip rather than the gzip in the working directory. * Makefile.am (.in): Don't replace bindir. (check-local): Set PATH instead of using --__bindir. * tests/help-version (gunzip_setuphelp, gzexe_setuphelp) (zcat_setuphelp, zcmp_setuphelp, zdiff_setuphelp) (zegrep_setuphelp, zfgrep_setuphelp, zforce_setuphelp) (zgrep_setuphelp, zless_setuphelp, zmore_setuphelp) (znew_setuphelp): Remove. All uses removed. (lbracket_setup): Default args to empty.
* tests: fix "make check" failure on AIX 7.1Jim Meyering2016-03-041-36/+39
| | | | | | | | * tests/Makefile.am (TESTS_ENVIRONMENT): Modernize: remove unused shell_or_perl_ function, and use an export_with_values function as grep does, to remove a lot of duplication. Reported by Assaf Gordon in http://debbugs.gnu.org/22900
* maint: update copyright year, bootstrap, init.shJim Meyering2016-01-0119-20/+44
| | | | | | | | | Run "make update-copyright" and then... * gzip.c: Transform the copyright notice via s/2015/2016/. * gnulib: Update to latest. * tests/init.sh: Update from gnulib. * bootstrap: Likewise.