Subject: Re: bug#75405: gzip --synchronous doesn't work with musl

From: Lasse Collin <[email-masked]>
Date: Thu, 9 Jan 2025 09:43:58 +0200

On 2025-01-08 Lasse Collin wrote:
> On 2025-01-08 Paul Eggert wrote:
> > On 2025-01-07 10:22, Lasse Collin wrote:
> > > It could be useful to add a test for gzip --synchronous.    
> > 
> > Feel free....  
> 
> Attached. It's based on z-suffix.

Syncing is the same in compression and decompression modes, so it's
reduntant to test --synchronous with both. Since my previous patch
wasn't committed yet, I attached a patch that is three lines shorter.

-- 
Lasse Collin
From b9e177b5ea10df9377361d3815636fc9357747ba Mon Sep 17 00:00:00 2001
From: Lasse Collin <[email-masked]>
Date: Thu, 9 Jan 2025 09:35:58 +0200
Subject: [PATCH] tests: synchronous: new test

* tests/synchronous: Test that --synchronous works. This
failed with musl 1.2.5 before the Gnulib commit 0fb185b7cd5e
("fcntl-h: port better to musl on GNU/Linux").
* tests/Makefile.am (TESTS): Add it.
---
 tests/Makefile.am |  1 +
 tests/synchronous | 27 +++++++++++++++++++++++++++
 2 files changed, 28 insertions(+)
 create mode 100755 tests/synchronous

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 4c10a71..d86cfb0 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -29,6 +29,7 @@ TESTS =					\
   pipe-output				\
   reproducible				\
   stdin					\
+  synchronous				\
   timestamp				\
   two-files				\
   trailing-nul				\
diff --git a/tests/synchronous b/tests/synchronous
new file mode 100755
index 0000000..9c030ce
--- /dev/null
+++ b/tests/synchronous
@@ -0,0 +1,27 @@
+#!/bin/sh
+# Check that --synchronous works.
+
+# Copyright 2014-2025 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
+# limit so don't run it by default.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ..
+
+printf anything > F || framework_failure_
+gzip --synchronous F || fail=1
+test ! -f F || fail=1
+test -f F.gz || fail=1
+
+Exit $fail
-- 
2.47.1