Hi Pádraig,

Pádraig Brady <p...@draigbrady.com> writes:

> That looks like a more general issue.
> Shouldn't the (exit $1) in Exit() set $? to $fail ?
> Perhaps remove_tmp_() is triggered too early or something?

Thanks for checking. Here is what the full log is before the test exits,
without my patch:

    + :
    ./tests/cksum/md5sum-bsd.sh: line 73: backslash\is\not\dir\sep: No such 
file or directory
    + remove_tmp_
    + __st=1
    + cleanup_
    + :
    + test '' = yes
    + cd /home/collin/coreutils-9.7.186-fc7f2
    + chmod -R u+rwx /home/collin/coreutils-9.7.186-fc7f2/gt-md5sum-bsd.sh.Y0VS
    + rm -rf /home/collin/coreutils-9.7.186-fc7f2/gt-md5sum-bsd.sh.Y0VS
    + exit 1
    FAIL tests/cksum/md5sum-bsd.sh (exit status: 1)

As we can see, 'Exit' is actually never called for some reason. I have
pushed the simpler patch to call 'echo' with fixes this. Here is the
log:

    + echo.exe ''
    ./tests/cksum/md5sum-bsd.sh: line 73: backslash\is\not\dir\sep: No such 
file or directory
    + Exit 0
    + set +e
    + exit 0
    + exit 0
    + remove_tmp_
    + __st=0
    + cleanup_
    + :
    + test '' = yes
    + cd /home/collin/coreutils-9.7.186-fc7f2
    + chmod -R u+rwx /home/collin/coreutils-9.7.186-fc7f2/gt-md5sum-bsd.sh.BdoX
    + rm -rf /home/collin/coreutils-9.7.186-fc7f2/gt-md5sum-bsd.sh.BdoX
    + exit 0
    PASS tests/cksum/md5sum-bsd.sh (exit status: 0)

So I guess we can't redirect ':'.

Collin

>From 93304acc1063b760c3e3fe229bd972749d055533 Mon Sep 17 00:00:00 2001
Message-ID: <93304acc1063b760c3e3fe229bd972749d055533.1753555163.git.collin.fu...@gmail.com>
From: Collin Funk <collin.fu...@gmail.com>
Date: Sat, 26 Jul 2025 11:29:02 -0700
Subject: [PATCH] tests: avoid a false failure on Cygwin

* tests/cksum/md5sum-bsd.sh: Use 'echo' instead of ':' to redirect to
the file. Otherwise 'Exit $fail' is not called on Cygwin.
---
 tests/cksum/md5sum-bsd.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/cksum/md5sum-bsd.sh b/tests/cksum/md5sum-bsd.sh
index aa2d24d89..1f80ccbe1 100755
--- a/tests/cksum/md5sum-bsd.sh
+++ b/tests/cksum/md5sum-bsd.sh
@@ -70,7 +70,7 @@ 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
   # Ensure we can --check BSD traditional format we produce
   # with the GNU extension of escaped newlines
   nl='
-- 
2.50.1

Reply via email to