From 6f99bb2d78d6c38d1fb1a369cbb8530fb080f85a Mon Sep 17 00:00:00 2001 From: Toni Bergholm Date: Mon, 19 Oct 2026 15:37:58 +0300 Subject: [PATCH] fix(demo): read file modes with GNU stat first The comment said portable across BSD and GNU, but on GNU stat 'stat -f' means filesystem status and succeeds, so the %Lp form never failed over to -c and the mode check saw filesystem info. Try the GNU form first; on macOS 'stat -c' is invalid and falls through to 'stat -f %Lp'. Co-Authored-By: Claude Sonnet 5.5 --- demo/run_tls_demo.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/demo/run_tls_demo.sh b/demo/run_tls_demo.sh index 6e3de6ec..5c261bd2 100755 --- a/demo/run_tls_demo.sh +++ b/demo/run_tls_demo.sh @@ -78,7 +78,9 @@ wait_for_line() { # --- File mode, portable across BSD (macOS) and GNU stat. --- file_mode() { - stat -f "%Lp" "$1" 2>/dev/null || stat -c "%a" "$1" + # GNU form first: on GNU stat `-f` means "filesystem status" and succeeds, + # so trying the BSD form first never reaches the fallback. + stat -c "%a" "$1" 2>/dev/null || stat -f "%Lp" "$1" } check_no_tmp_residue() {