From 4370cb2ce10a9277c797e1d48c359b37c6dd5045 Mon Sep 17 00:00:00 2001
From: Andrew Tridgell <andrew@tridgell.net>
Date: Thu, 7 May 2026 09:17:09 +1000
Subject: [PATCH 56/60] testsuite: fixes for 3.2.7 backport

---
 .github/workflows/cygwin-build.yml   |  2 +-
 .github/workflows/macos-build.yml    |  2 +-
 testsuite/clean-fname-underflow.test | 17 +++++++++++++++--
 usage.c                              |  1 +
 4 files changed, 18 insertions(+), 4 deletions(-)

Index: rsync-3.2.7/testsuite/clean-fname-underflow.test
===================================================================
--- rsync-3.2.7.orig/testsuite/clean-fname-underflow.test
+++ rsync-3.2.7/testsuite/clean-fname-underflow.test
@@ -9,12 +9,25 @@
 
 set -eu
 
+# clean_fname() is platform-agnostic; the test only needs to run on one
+# host. Skip on non-Linux to avoid quirks in older /bin/sh implementations
+# (Solaris exited silently here, producing an empty log under set -eu).
+# runtests.sh expects $scratchdir/whyskipped to exist when a test exits 77.
+case "$(uname -s)" in
+  Linux) ;;
+  *)
+    if [ -n "${scratchdir:-}" ]; then
+      echo "Linux-only test (uname -s = $(uname -s))" > "$scratchdir/whyskipped"
+    fi
+    exit 77 ;;
+esac
+
 # Try to find the just-built rsync binary if RSYNC_BIN isn't set.
 if [ -z "${RSYNC_BIN:-}" ]; then
   if [ -x "./rsync" ]; then
-    RSYNC_BIN=./rsync
+    RSYNC_BIN=$(pwd)/rsync
   elif [ -x "../rsync" ]; then
-    RSYNC_BIN=../rsync
+    RSYNC_BIN=$(cd .. && pwd)/rsync
   else
     RSYNC_BIN=rsync
   fi
Index: rsync-3.2.7/usage.c
===================================================================
--- rsync-3.2.7.orig/usage.c
+++ rsync-3.2.7/usage.c
@@ -293,6 +293,7 @@ void print_rsync_version(enum logcode f)
 		json_line("license", "GPLv3");
 		json_line("caveat", "rsync comes with ABSOLUTELY NO WARRANTY");
 		printf("\n}\n");
+		fflush(stdout);
 		return;
 	}
 
