On Cygwin tests/cksum/md5sum-bsd.sh fails with the following logged:

    + :
    ./tests/cksum/md5sum-bsd.sh: line 73: backslash\is\not\dir\sep: No such 
file or directory
    + remove_tmp_
    + __st=1
    + cleanup_
    [...]
    exit 0

After checking if backslash is a directory seperator, $? is set to 1 on
Cygwin. Since we don't have anything after this 'Exit' is called and
__st is set to $? which is 1. This value of __st is what init.sh
actually calls 'exit' with.

The fix is to reset $? with ':'. Will push in a bit.

Collin

>From 192bcefdc9f3a0b29e3a9d057cae06ecf1af3189 Mon Sep 17 00:00:00 2001
Message-ID: <192bcefdc9f3a0b29e3a9d057cae06ecf1af3189.1753515191.git.collin.fu...@gmail.com>
From: Collin Funk <collin.fu...@gmail.com>
Date: Sat, 26 Jul 2025 00:30:51 -0700
Subject: [PATCH] tests: avoid a false failure on Cygwin

* tests/cksum/md5sum-bsd.sh: Make sure that $? is 0 before calling
'Exit'.
---
 tests/cksum/md5sum-bsd.sh | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tests/cksum/md5sum-bsd.sh b/tests/cksum/md5sum-bsd.sh
index aa2d24d89..5092a4eb4 100755
--- a/tests/cksum/md5sum-bsd.sh
+++ b/tests/cksum/md5sum-bsd.sh
@@ -70,7 +70,11 @@ for i in 'a' ' b' '*c' 'dd' ' '; do
 done
 md5sum --strict -c check.md5 || fail=1
 
-if : > 'backslash\is\not\dir\sep'; then
+if ! echo '' > 'backslash\is\not\dir\sep'; then
+  # Make sure our exit status is 0 so the above line does not cause 'Exit'
+  # to fail.
+  :
+else
   # Ensure we can --check BSD traditional format we produce
   # with the GNU extension of escaped newlines
   nl='
-- 
2.50.1

Reply via email to