Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package libdeflate for openSUSE:Factory 
checked in at 2022-08-09 15:27:50
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libdeflate (Old)
 and      /work/SRC/openSUSE:Factory/.libdeflate.new.1521 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "libdeflate"

Tue Aug  9 15:27:50 2022 rev:6 rq:993864 version:1.13

Changes:
--------
--- /work/SRC/openSUSE:Factory/libdeflate/libdeflate.changes    2022-07-13 
13:45:41.850058154 +0200
+++ /work/SRC/openSUSE:Factory/.libdeflate.new.1521/libdeflate.changes  
2022-08-09 15:28:22.937630315 +0200
@@ -1,0 +2,8 @@
+Mon Aug  8 20:57:28 UTC 2022 - Dirk M??ller <[email protected]>
+
+- update to 1.13:
+  * Changed the 32-bit Windows build of the library to use the default calling
+    convention (cdecl) instead of stdcall, reverting a change from libdeflate 
1.4.
+  * Fixed a couple macOS compatibility issues with the gzip program. 
+
+-------------------------------------------------------------------

Old:
----
  libdeflate-1.12.tar.gz

New:
----
  libdeflate-1.13.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ libdeflate.spec ++++++
--- /var/tmp/diff_new_pack.bjpZn8/_old  2022-08-09 15:28:23.497631915 +0200
+++ /var/tmp/diff_new_pack.bjpZn8/_new  2022-08-09 15:28:23.501631926 +0200
@@ -19,7 +19,7 @@
 %define major 0
 %define libname %{name}%{major}
 Name:           libdeflate
-Version:        1.12
+Version:        1.13
 Release:        0
 Summary:        Library for DEFLATE/zlib/gzip compression and decompression
 License:        BSD-2-Clause

++++++ libdeflate-1.12.tar.gz -> libdeflate-1.13.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libdeflate-1.12/.github/workflows/ci.yml 
new/libdeflate-1.13/.github/workflows/ci.yml
--- old/libdeflate-1.12/.github/workflows/ci.yml        2022-06-12 
21:52:59.000000000 +0200
+++ new/libdeflate-1.13/.github/workflows/ci.yml        2022-08-05 
08:21:51.000000000 +0200
@@ -22,7 +22,7 @@
     - run: scripts/run_tests.sh
 
   other-arch-build-and-test:
-    name: Build and test (${{ matrix.arch }}, Debian Buster, ${{ 
matrix.compiler }})
+    name: Build and test (${{ matrix.arch }}, Debian Bullseye, ${{ 
matrix.compiler }})
     strategy:
       matrix:
         arch: [armv6, armv7, aarch64, s390x, ppc64le]
@@ -30,10 +30,10 @@
     runs-on: ubuntu-latest
     steps:
       - uses: actions/checkout@v2
-      - uses: uraimo/[email protected]
+      - uses: uraimo/[email protected]
         with:
           arch: ${{ matrix.arch }}
-          distro: buster
+          distro: bullseye
           githubToken: ${{ github.token }}
           install: |
             apt-get update
@@ -70,14 +70,24 @@
     - run: make all check
 
   windows-msys2-build-and-test:
-    name: Build and test (Windows, MSYS2)
+    name: Build and test (Windows, MSYS2, ${{matrix.sys}})
     runs-on: windows-latest
+    strategy:
+      matrix:
+        include:
+        - { sys: mingw64, env: x86_64 }
+        - { sys: mingw32, env: i686 }
+    defaults:
+      run:
+        shell: msys2 {0}
     steps:
     - uses: actions/checkout@v2
-    - shell: bash
-      run: |
-        PATH="C:\\msys64\\mingw64\\bin:C:\\msys64\\usr\\bin:$PATH" \
-          make CC=gcc all check
+    - uses: msys2/setup-msys2@v2
+      with:
+        msystem: ${{matrix.sys}}
+        update: true
+        install: make mingw-w64-${{matrix.env}}-cc 
mingw-w64-${{matrix.env}}-zlib
+    - run: make all check
 
   windows-msvc-build:
     name: Build (Windows, Visual Studio)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libdeflate-1.12/Makefile new/libdeflate-1.13/Makefile
--- old/libdeflate-1.12/Makefile        2022-06-12 21:52:59.000000000 +0200
+++ new/libdeflate-1.13/Makefile        2022-08-05 08:21:51.000000000 +0200
@@ -99,11 +99,6 @@
     SHARED_LIB_CFLAGS  :=
     SHARED_LIB_LDFLAGS := -Wl,--out-implib,libdeflate.lib \
                           -Wl,--output-def,libdeflate.def
-    # Only if not LLVM
-    ifeq ($(findstring -windows-gnu,$(TARGET_MACHINE)),)
-        SHARED_LIB_LDFLAGS += -Wl,--add-stdcall-alias
-    endif
-
     PROG_SUFFIX        := .exe
     PROG_CFLAGS        := -static -municode
     HARD_LINKS         :=
@@ -383,15 +378,7 @@
 # A minimal 'make check' target.  This only runs some quick tests;
 # use scripts/run_tests.sh if you want to run the full tests.
 check:test_programs
-       LD_LIBRARY_PATH=. ./benchmark$(PROG_SUFFIX) \
-                       < ./benchmark$(PROG_SUFFIX) > /dev/null
-       LD_LIBRARY_PATH=. ./benchmark$(PROG_SUFFIX) -C libz \
-                       < ./benchmark$(PROG_SUFFIX) > /dev/null
-       LD_LIBRARY_PATH=. ./benchmark$(PROG_SUFFIX) -D libz \
-                       < ./benchmark$(PROG_SUFFIX) > /dev/null
-       for prog in test_*; do          \
-               LD_LIBRARY_PATH=. ./$$prog || exit 1;   \
-       done
+       ./scripts/check.sh
 
 # Run the clang static analyzer.
 scan-build:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libdeflate-1.12/NEWS.md new/libdeflate-1.13/NEWS.md
--- old/libdeflate-1.12/NEWS.md 2022-06-12 21:52:59.000000000 +0200
+++ new/libdeflate-1.13/NEWS.md 2022-08-05 08:21:51.000000000 +0200
@@ -1,5 +1,12 @@
 # libdeflate release notes
 
+## Version 1.13
+
+* Changed the 32-bit Windows build of the library to use the default calling
+  convention (cdecl) instead of stdcall, reverting a change from libdeflate 
1.4.
+
+* Fixed a couple macOS compatibility issues with the gzip program.
+
 ## Version 1.12
 
 This release focuses on improving the performance of the CRC-32 and Adler-32
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libdeflate-1.12/README.md 
new/libdeflate-1.13/README.md
--- old/libdeflate-1.12/README.md       2022-06-12 21:52:59.000000000 +0200
+++ new/libdeflate-1.13/README.md       2022-08-05 08:21:51.000000000 +0200
@@ -183,10 +183,7 @@
 the actual number of output bytes in case you need it.
 
 Windows developers: note that the calling convention of libdeflate.dll is
-"stdcall" -- the same as the Win32 API.  If you call into libdeflate.dll using 
a
-non-C/C++ language, or dynamically using LoadLibrary(), make sure to use the
-stdcall convention.  Using the wrong convention may crash your application.
-(Note: older versions of libdeflate used the "cdecl" convention instead.)
+"cdecl".  (libdeflate v1.4 through v1.12 used "stdcall" instead.)
 
 # Bindings for other programming languages
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libdeflate-1.12/lib/arm/cpu_features.h 
new/libdeflate-1.13/lib/arm/cpu_features.h
--- old/libdeflate-1.12/lib/arm/cpu_features.h  2022-06-12 21:52:59.000000000 
+0200
+++ new/libdeflate-1.13/lib/arm/cpu_features.h  2022-08-05 08:21:51.000000000 
+0200
@@ -82,9 +82,9 @@
  */
 #if HAVE_NEON_NATIVE || \
        (HAVE_NEON_TARGET && GCC_PREREQ(6, 1) && defined(__ARM_FP))
-#  define HAVE_NEON_INTRIN 1
+#  define HAVE_NEON_INTRIN     1
 #else
-#  define HAVE_NEON_INTRIN 0
+#  define HAVE_NEON_INTRIN     0
 #endif
 
 /* PMULL */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libdeflate-1.12/lib/arm/crc32_impl.h 
new/libdeflate-1.13/lib/arm/crc32_impl.h
--- old/libdeflate-1.12/lib/arm/crc32_impl.h    2022-06-12 21:52:59.000000000 
+0200
+++ new/libdeflate-1.13/lib/arm/crc32_impl.h    2022-08-05 08:21:51.000000000 
+0200
@@ -166,8 +166,8 @@
                                wp0++;
                        } while (wp0 != wp0_end);
                        crc = combine_crcs_slow(crc, crc1, crc2, crc3);
-                       len -= CRC32_NUM_CHUNKS * CRC32_FIXED_CHUNK_LEN;
                        p += CRC32_NUM_CHUNKS * CRC32_FIXED_CHUNK_LEN;
+                       len -= CRC32_NUM_CHUNKS * CRC32_FIXED_CHUNK_LEN;
                }
                /*
                 * Due to the large fixed chunk length used above, there might
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libdeflate-1.12/lib/arm/crc32_pmull_helpers.h 
new/libdeflate-1.13/lib/arm/crc32_pmull_helpers.h
--- old/libdeflate-1.12/lib/arm/crc32_pmull_helpers.h   2022-06-12 
21:52:59.000000000 +0200
+++ new/libdeflate-1.13/lib/arm/crc32_pmull_helpers.h   2022-08-05 
08:21:51.000000000 +0200
@@ -129,25 +129,28 @@
         * vtbl(v, shift_tab[len+16..len+31]) right shifts v by len bytes.
         */
        static const u8 shift_tab[48] = {
-               0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
-               0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
+               0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+               0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
                0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
-               0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
-               0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
+               0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+               0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
        };
        const uint8x16_t lshift = vld1q_u8(&shift_tab[len]);
        const uint8x16_t rshift = vld1q_u8(&shift_tab[len + 16]);
-       uint8x16_t x0, x1;
+       uint8x16_t x0, x1, bsl_mask;
 
        /* x0 = v left-shifted by '16 - len' bytes */
        x0 = vtbl(v, lshift);
 
+       /* Create a vector of '16 - len' 0x00 bytes, then 'len' 0xff bytes. */
+       bsl_mask = (uint8x16_t)vshrq_n_s8((int8x16_t)rshift, 7);
+
        /*
         * x1 = the last '16 - len' bytes from v (i.e. v right-shifted by 'len'
         * bytes) followed by the remaining data.
         */
-       x1 = vbslq_u8((uint8x16_t)vshrq_n_s8((int8x16_t)rshift, 7),
+       x1 = vbslq_u8(bsl_mask /* 0 bits select from arg3, 1 bits from arg2 */,
                      vld1q_u8(p + len - 16), vtbl(v, rshift));
 
        return fold_vec(x0, x1, multipliers_1);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libdeflate-1.12/lib/matchfinder_common.h 
new/libdeflate-1.13/lib/matchfinder_common.h
--- old/libdeflate-1.12/lib/matchfinder_common.h        2022-06-12 
21:52:59.000000000 +0200
+++ new/libdeflate-1.13/lib/matchfinder_common.h        2022-08-05 
08:21:51.000000000 +0200
@@ -27,19 +27,16 @@
 }
 
 /*
- * Load the next 3 bytes from the memory location @p into the 24 low-order bits
- * of a 32-bit value.  The order in which the 3 bytes will be arranged as 
octets
- * in the 24 bits is platform-dependent.  At least LOAD_U24_REQUIRED_NBYTES
- * bytes must be available at @p; note that this may be more than 3.
+ * Load the next 3 bytes from @p into the 24 low-order bits of a 32-bit value.
+ * The order in which the 3 bytes will be arranged as octets in the 24 bits is
+ * platform-dependent.  At least 4 bytes (not 3) must be available at @p.
  */
 static forceinline u32
 load_u24_unaligned(const u8 *p)
 {
 #if UNALIGNED_ACCESS_IS_FAST
-#  define LOAD_U24_REQUIRED_NBYTES 4
        return loaded_u32_to_u24(load_u32_unaligned(p));
 #else
-#  define LOAD_U24_REQUIRED_NBYTES 3
        if (CPU_IS_LITTLE_ENDIAN())
                return ((u32)p[0] << 0) | ((u32)p[1] << 8) | ((u32)p[2] << 16);
        else
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libdeflate-1.12/lib/x86/crc32_pclmul_template.h 
new/libdeflate-1.13/lib/x86/crc32_pclmul_template.h
--- old/libdeflate-1.12/lib/x86/crc32_pclmul_template.h 2022-06-12 
21:52:59.000000000 +0200
+++ new/libdeflate-1.13/lib/x86/crc32_pclmul_template.h 2022-08-05 
08:21:51.000000000 +0200
@@ -84,12 +84,12 @@
         * pshufb(v, shift_tab[len+16..len+31]) right shifts v by len bytes.
         */
        static const u8 shift_tab[48] = {
-               0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
-               0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
+               0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+               0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
                0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
-               0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
-               0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
+               0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+               0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
        };
        __m128i lshift = _mm_loadu_si128((const void *)&shift_tab[len]);
        __m128i rshift = _mm_loadu_si128((const void *)&shift_tab[len + 16]);
@@ -104,6 +104,7 @@
         */
        x1 = _mm_blendv_epi8(_mm_shuffle_epi8(v, rshift),
                             _mm_loadu_si128((const void *)(p + len - 16)),
+                            /* msb 0/1 of each byte selects byte from arg1/2 */
                             rshift);
 
        return fold_vec(x0, x1, multipliers_1);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libdeflate-1.12/libdeflate.h 
new/libdeflate-1.13/libdeflate.h
--- old/libdeflate-1.12/libdeflate.h    2022-06-12 21:52:59.000000000 +0200
+++ new/libdeflate-1.13/libdeflate.h    2022-08-05 08:21:51.000000000 +0200
@@ -10,15 +10,15 @@
 #endif
 
 #define LIBDEFLATE_VERSION_MAJOR       1
-#define LIBDEFLATE_VERSION_MINOR       12
-#define LIBDEFLATE_VERSION_STRING      "1.12"
+#define LIBDEFLATE_VERSION_MINOR       13
+#define LIBDEFLATE_VERSION_STRING      "1.13"
 
 #include <stddef.h>
 #include <stdint.h>
 
 /*
  * On Windows, if you want to link to the DLL version of libdeflate, then
- * #define LIBDEFLATE_DLL.  Note that the calling convention is "stdcall".
+ * #define LIBDEFLATE_DLL.  Note that the calling convention is "cdecl".
  */
 #ifdef LIBDEFLATE_DLL
 #  ifdef BUILDING_LIBDEFLATE
@@ -31,12 +31,6 @@
 #  define LIBDEFLATEEXPORT
 #endif
 
-#if defined(_WIN32) && !defined(_WIN64) && defined(LIBDEFLATE_DLL)
-#  define LIBDEFLATEAPI_ABI    __stdcall
-#else
-#  define LIBDEFLATEAPI_ABI
-#endif
-
 #if defined(BUILDING_LIBDEFLATE) && defined(__GNUC__) && \
        defined(_WIN32) && !defined(_WIN64)
     /*
@@ -44,13 +38,11 @@
      * Realign the stack when entering libdeflate to avoid crashing in SSE/AVX
      * code when called from an MSVC-compiled application.
      */
-#  define LIBDEFLATEAPI_STACKALIGN     __attribute__((force_align_arg_pointer))
+#  define LIBDEFLATEAPI        __attribute__((force_align_arg_pointer))
 #else
-#  define LIBDEFLATEAPI_STACKALIGN
+#  define LIBDEFLATEAPI
 #endif
 
-#define LIBDEFLATEAPI  LIBDEFLATEAPI_ABI LIBDEFLATEAPI_STACKALIGN
-
 /* ========================================================================== 
*/
 /*                             Compression                                    
*/
 /* ========================================================================== 
*/
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libdeflate-1.12/programs/prog_util.c 
new/libdeflate-1.13/programs/prog_util.c
--- old/libdeflate-1.12/programs/prog_util.c    2022-06-12 21:52:59.000000000 
+0200
+++ new/libdeflate-1.13/programs/prog_util.c    2022-08-05 08:21:51.000000000 
+0200
@@ -25,6 +25,12 @@
  * OTHER DEALINGS IN THE SOFTWARE.
  */
 
+#ifdef __APPLE__
+/* for O_NOFOLLOW */
+#  undef _POSIX_C_SOURCE
+#  define _DARWIN_C_SOURCE
+#endif
+
 #include "prog_util.h"
 
 #include <errno.h>
@@ -351,8 +357,11 @@
        strm->mmap_mem = mmap(NULL, size, PROT_READ, MAP_SHARED, strm->fd, 0);
        if (strm->mmap_mem == MAP_FAILED) {
                strm->mmap_mem = NULL;
-               if (errno == ENODEV) /* mmap isn't supported on this file */
+               if (errno == ENODEV /* standard */ ||
+                   errno == EINVAL /* macOS */) {
+                       /* mmap isn't supported on this file */
                        return read_full_contents(strm);
+               }
                if (errno == ENOMEM) {
                        msg("%"TS" is too large to be processed by this "
                            "program", strm->name);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libdeflate-1.12/scripts/check.sh 
new/libdeflate-1.13/scripts/check.sh
--- old/libdeflate-1.12/scripts/check.sh        1970-01-01 01:00:00.000000000 
+0100
+++ new/libdeflate-1.13/scripts/check.sh        2022-08-05 08:21:51.000000000 
+0200
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+# A minimal 'make check' target.  This only runs some quick tests;
+# use scripts/run_tests.sh if you want to run the full tests.
+
+set -e -u
+
+if [ "$(uname)" = Darwin ]; then
+       export DYLD_FALLBACK_LIBRARY_PATH=.
+else
+       export LD_LIBRARY_PATH=.
+fi
+cat lib/*.c | ./benchmark > /dev/null
+cat lib/*.c | ./benchmark -C libz > /dev/null
+cat lib/*.c | ./benchmark -D libz > /dev/null
+for prog in ./test_*; do
+       "$prog"
+done
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libdeflate-1.12/scripts/gzip_tests.sh 
new/libdeflate-1.13/scripts/gzip_tests.sh
--- old/libdeflate-1.12/scripts/gzip_tests.sh   2022-06-12 21:52:59.000000000 
+0200
+++ new/libdeflate-1.13/scripts/gzip_tests.sh   2022-08-05 08:21:51.000000000 
+0200
@@ -15,9 +15,15 @@
 
 export -n GZIP GUNZIP TESTDATA
 
+ORIG_PWD=$PWD
 TMPDIR="$(mktemp -d)"
 CURRENT_TEST=
 
+BSD_STAT=false
+if ! stat --version 2>&1 | grep -q coreutils; then
+       BSD_STAT=true
+fi
+
 cleanup() {
        if [ -n "$CURRENT_TEST" ]; then
                echo "TEST FAILED: \"$CURRENT_TEST\""
@@ -27,14 +33,13 @@
 
 trap cleanup EXIT
 
-TESTDATA="$(readlink -f "$TESTDATA")"
-cd "$TMPDIR"
-
 begin_test() {
        CURRENT_TEST="$1"
        rm -rf -- "${TMPDIR:?}"/*
-       cp "$TESTDATA" file
-       chmod +w file
+       cd "$ORIG_PWD"
+       cp "$TESTDATA" "$TMPDIR/file"
+       chmod +w "$TMPDIR/file"
+       cd "$TMPDIR"
 }
 
 gzip() {
@@ -45,6 +50,40 @@
        $GUNZIP "$@"
 }
 
+get_filesize() {
+       local file=$1
+
+       if $BSD_STAT; then
+               stat -f %z "$file"
+       else
+               stat -c %s "$file"
+       fi
+}
+
+get_linkcount() {
+       local file=$1
+
+       if $BSD_STAT; then
+               stat -f %l "$file"
+       else
+               stat -c %h "$file"
+       fi
+}
+
+get_modeandtimestamps() {
+       local file=$1
+
+       if $BSD_STAT; then
+               stat -f "%p;%a;%m" "$file"
+       elif [ "$(uname -m)" = s390x ]; then
+               # Use seconds precision instead of nanoseconds.
+               # TODO: why is this needed?  QEMU user mode emulation bug?
+               stat -c "%a;%X;%Y" "$file"
+       else
+               stat -c "%a;%x;%y" "$file"
+       fi
+}
+
 assert_status() {
        local expected_status="$1"
        local expected_msg="$2"
@@ -94,26 +133,6 @@
        fi
 }
 
-# Get the filesystem type.
-FSTYPE=$(df -T . | tail -1 | awk '{print $2}')
-
-# If gzip or gunzip is the GNU version, require that it supports the '-k'
-# option.  This option was added in v1.6, released in 2013.
-check_version_prereq() {
-       local prog=$1
-
-       if ! echo | { $prog -k || true; } |& grep -q 'invalid option'; then
-               return 0
-       fi
-       if ! $prog -V |& grep -q 'Free Software Foundation'; then
-               echo 1>&2 "Unexpected case: not GNU $prog, but -k option is 
invalid"
-               exit 1
-       fi
-       echo "GNU $prog is too old; skipping gzip/gunzip tests"
-       exit 0
-}
-check_version_prereq gzip
-check_version_prereq gunzip
 
 begin_test 'Basic compression and decompression works'
 cp file orig
@@ -179,7 +198,7 @@
 
 
 begin_test 'Compression levels'
-if [ "$GZIP" = /bin/gzip ]; then
+if [ "$GZIP" = /bin/gzip ] || [ "$GZIP" = /usr/bin/gzip ]; then
        assert_error '\<invalid option\>' gzip -10
        max_level=9
 else
@@ -333,13 +352,13 @@
 begin_test '(gzip) hard linked file skipped without -f or -c'
 cp file orig
 ln file link
-assert_equals 2 "$(stat -c %h file)"
+assert_equals 2 "$(get_linkcount file)"
 assert_skipped gzip file
 gzip -c file > /dev/null
-assert_equals 2 "$(stat -c %h file)"
+assert_equals 2 "$(get_linkcount file)"
 gzip -f file
-assert_equals 1 "$(stat -c %h link)"
-assert_equals 1 "$(stat -c %h file.gz)"
+assert_equals 1 "$(get_linkcount link)"
+assert_equals 1 "$(get_linkcount file.gz)"
 cmp link orig
 # XXX: GNU gzip skips hard linked files with -k, libdeflate's doesn't
 
@@ -348,13 +367,13 @@
 gzip file
 ln file.gz link.gz
 cp file.gz orig.gz
-assert_equals 2 "$(stat -c %h file.gz)"
+assert_equals 2 "$(get_linkcount file.gz)"
 assert_skipped gunzip file.gz
 gunzip -c file.gz > /dev/null
-assert_equals 2 "$(stat -c %h file.gz)"
+assert_equals 2 "$(get_linkcount file.gz)"
 gunzip -f file
-assert_equals 1 "$(stat -c %h link.gz)"
-assert_equals 1 "$(stat -c %h file)"
+assert_equals 1 "$(get_linkcount link.gz)"
+assert_equals 1 "$(get_linkcount file)"
 cmp link.gz orig.gz
 
 
@@ -433,20 +452,12 @@
 
 
 begin_test 'Timestamps and mode are preserved'
-if [ "$FSTYPE" = shiftfs ]; then
-       # In Travis CI, the filesystem (shiftfs) only supports seconds precision
-       # timestamps.  Nanosecond precision still sometimes seems to work,
-       # probably due to caching, but it is unreliable.
-       format='%a;%X;%Y'
-else
-       format='%a;%x;%y'
-fi
 chmod 777 file
-orig_stat="$(stat -c "$format" file)"
+orig_stat=$(get_modeandtimestamps file)
 gzip file
 sleep 1
 gunzip file.gz
-assert_equals "$orig_stat" "$(stat -c "$format" file)"
+assert_equals "$orig_stat" "$(get_modeandtimestamps file)"
 
 
 begin_test 'Decompressing multi-member gzip file'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libdeflate-1.12/scripts/run_tests.sh 
new/libdeflate-1.13/scripts/run_tests.sh
--- old/libdeflate-1.12/scripts/run_tests.sh    2022-06-12 21:52:59.000000000 
+0200
+++ new/libdeflate-1.13/scripts/run_tests.sh    2022-08-05 08:21:51.000000000 
+0200
@@ -41,8 +41,14 @@
 
 CC_VERSION=$($CC --version | head -1)
 
+UNAME=$(uname)
 ARCH=$(uname -m)
 
+SHLIB=libdeflate.so
+if [ "$UNAME" = Darwin ]; then
+       SHLIB=libdeflate.dylib
+fi
+
 for skip in SKIP_FREESTANDING SKIP_VALGRIND SKIP_UBSAN SKIP_ASAN SKIP_CFI \
            SKIP_SHARED_LIB; do
        if [ "${!skip:-}" = "1" ]; then
@@ -58,7 +64,9 @@
 
 log() {
        echo -n "[$(date)] "
-       head -c $(( INDENT * 4 )) /dev/zero | tr '\0' ' '
+       if (( INDENT != 0 )); then
+               head -c $(( INDENT * 4 )) /dev/zero | tr '\0' ' '
+       fi
        echo "$@"
 }
 
@@ -98,6 +106,10 @@
        local want_vers=$1
        local vers
 
+       if ! type -P valgrind &> /dev/null; then
+               return 1
+       fi
+
        vers=$(valgrind --version | grep -E -o '[0-9\.]+' | head -1)
 
        [ "$want_vers" = "$(echo -e "$vers\n$want_vers" | sort -V | head -1)" ]
@@ -170,12 +182,38 @@
        fi
 }
 
+is_compatible_system_gzip() {
+       local prog=$1
+
+       # Needs to exist.
+       if ! [ -e "$prog" ]; then
+               return 1
+       fi
+       # Needs to be GNU gzip.
+       if ! "$prog" -V 2>&1 | grep -q 'Free Software Foundation'; then
+               return 1
+       fi
+       # Needs to support the -k option, i.e. be v1.6 or later.
+       if echo | { "$prog" -k 2>&1 >/dev/null || true; } \
+                               | grep -q 'invalid option'; then
+               return 1
+       fi
+       return 0
+}
+
 gzip_tests() {
        local gzips=("$PWD/gzip")
        local gunzips=("$PWD/gunzip")
        if [ "${1:-}" != "--quick" ]; then
-               gzips+=(/bin/gzip)
-               gunzips+=(/bin/gunzip)
+               if is_compatible_system_gzip /bin/gzip; then
+                       gzips+=(/bin/gzip)
+                       gunzips+=(/bin/gunzip)
+               elif is_compatible_system_gzip /usr/bin/gzip; then
+                       gzips+=(/usr/bin/gzip)
+                       gunzips+=(/usr/bin/gunzip)
+               else
+                       log "Unsupported system gzip; skipping comparison with 
system gzip"
+               fi
        fi
        local gzip gunzip
 
@@ -196,6 +234,8 @@
        if [ "${1:-}" != "--quick" ]; then
                if $SKIP_FREESTANDING; then
                        log "Skipping freestanding build tests due to 
SKIP_FREESTANDING=1"
+               elif [ "$UNAME" = Darwin ]; then
+                       log "Skipping freestanding build tests due to 
unsupported OS"
                else
                        build_and_run_tests FREESTANDING=1
                        verify_freestanding_build
@@ -211,13 +251,23 @@
                fail "Some global symbols aren't prefixed with \"libdeflate_\""
        fi
        log "Checking that all exported symbols are prefixed with 
\"libdeflate\""
-       $MAKE libdeflate.so > /dev/null
-       if nm libdeflate.so | grep ' T ' \
-                       | grep -E -v " (libdeflate_|_init\>|_fini\>)"; then
+       $MAKE $SHLIB > /dev/null
+       if nm $SHLIB | grep ' T ' \
+                       | grep -E -v " _?(libdeflate_|_init\>|_fini\>)"; then
                fail "Some exported symbols aren't prefixed with 
\"libdeflate_\""
        fi
 }
 
+is_dynamically_linked() {
+       local prog=$1
+
+       if [ "$UNAME" = Darwin ]; then
+               otool -L "$prog" | grep -q libdeflate
+       else
+               ldd "$prog" | grep -q libdeflate
+       fi
+}
+
 test_use_shared_lib() {
        if $SKIP_SHARED_LIB; then
                log "Skipping USE_SHARED_LIB=1 tests due to SKIP_SHARED_LIB=1"
@@ -225,16 +275,13 @@
        fi
        log "Testing USE_SHARED_LIB=1"
        $MAKE gzip > /dev/null
-       if ldd gzip | grep -q 'libdeflate.so'; then
+       if is_dynamically_linked gzip; then
                fail "Binary should be statically linked by default"
        fi
        $MAKE USE_SHARED_LIB=1 all check > /dev/null
-       ldd gzip > "$TMPDIR/ldd.out"
-       if ! grep -q 'libdeflate.so' "$TMPDIR/ldd.out"; then
-               cat 1>&2 "$TMPDIR/ldd.out"
+       if ! is_dynamically_linked gzip; then
                fail "Binary isn't dynamically linked"
        fi
-       rm "$TMPDIR/ldd.out"
 }
 
 install_uninstall_tests() {

Reply via email to