rsync: fix tests in Darwin sandbox (#431202)

authored by

Emily and committed by
GitHub
d121fa83 e040363e

+63
+7
pkgs/applications/networking/sync/rsync/default.nix
··· 31 31 hash = "sha256-KSS8s6Hti1UfwQH3QLnw/gogKxFQJ2R89phQ1l/YjFI="; 32 32 }; 33 33 34 + patches = [ 35 + # See: <https://github.com/RsyncProject/rsync/pull/790> 36 + ./fix-tests-in-darwin-sandbox.patch 37 + ]; 38 + 34 39 nativeBuildInputs = [ 35 40 updateAutotoolsGnuConfigScriptsHook 36 41 perl ··· 74 79 passthru.tests = { inherit (nixosTests) rsyncd; }; 75 80 76 81 doCheck = true; 82 + 83 + __darwinAllowLocalNetworking = true; 77 84 78 85 meta = with lib; { 79 86 description = "Fast incremental file transfer utility";
+56
pkgs/applications/networking/sync/rsync/fix-tests-in-darwin-sandbox.patch
··· 1 + From 9b104ed9859f17b6ed4c4ad01806c75a0c197dd7 Mon Sep 17 00:00:00 2001 2 + From: Emily <hello@emily.moe> 3 + Date: Tue, 5 Aug 2025 15:55:24 +0100 4 + Subject: [PATCH] Allow `ls(1)` to fail in test setup 5 + 6 + This can happen when the tests are unable to `stat(2)` some files in 7 + `/etc`, `/bin`, or `/`, due to Unix permissions or other sandboxing. We 8 + still guard against serious errors, which use exit code 2. 9 + --- 10 + testsuite/longdir.test | 4 ++-- 11 + testsuite/rsync.fns | 8 ++++---- 12 + 2 files changed, 6 insertions(+), 6 deletions(-) 13 + 14 + diff --git a/testsuite/longdir.test b/testsuite/longdir.test 15 + index 8d66bb5f..26747292 100644 16 + --- a/testsuite/longdir.test 17 + +++ b/testsuite/longdir.test 18 + @@ -16,9 +16,9 @@ makepath "$longdir" || test_skipped "unable to create long directory" 19 + touch "$longdir/1" || test_skipped "unable to create files in long directory" 20 + date > "$longdir/1" 21 + if [ -r /etc ]; then 22 + - ls -la /etc >"$longdir/2" 23 + + ls -la /etc >"$longdir/2" || [ $? -eq 1 ] 24 + else 25 + - ls -la / >"$longdir/2" 26 + + ls -la / >"$longdir/2" || [ $? -eq 1 ] 27 + fi 28 + checkit "$RSYNC --delete -avH '$fromdir/' '$todir'" "$fromdir/" "$todir" 29 + 30 + diff --git a/testsuite/rsync.fns b/testsuite/rsync.fns 31 + index 2ab97b69..f7da363f 100644 32 + --- a/testsuite/rsync.fns 33 + +++ b/testsuite/rsync.fns 34 + @@ -195,15 +195,15 @@ hands_setup() { 35 + echo some data > "$fromdir/dir/subdir/foobar.baz" 36 + mkdir "$fromdir/dir/subdir/subsubdir" 37 + if [ -r /etc ]; then 38 + - ls -ltr /etc > "$fromdir/dir/subdir/subsubdir/etc-ltr-list" 39 + + ls -ltr /etc > "$fromdir/dir/subdir/subsubdir/etc-ltr-list" || [ $? -eq 1 ] 40 + else 41 + - ls -ltr / > "$fromdir/dir/subdir/subsubdir/etc-ltr-list" 42 + + ls -ltr / > "$fromdir/dir/subdir/subsubdir/etc-ltr-list" || [ $? -eq 1 ] 43 + fi 44 + mkdir "$fromdir/dir/subdir/subsubdir2" 45 + if [ -r /bin ]; then 46 + - ls -lt /bin > "$fromdir/dir/subdir/subsubdir2/bin-lt-list" 47 + + ls -lt /bin > "$fromdir/dir/subdir/subsubdir2/bin-lt-list" || [ $? -eq 1 ] 48 + else 49 + - ls -lt / > "$fromdir/dir/subdir/subsubdir2/bin-lt-list" 50 + + ls -lt / > "$fromdir/dir/subdir/subsubdir2/bin-lt-list" || [ $? -eq 1 ] 51 + fi 52 + 53 + # echo testing head: 54 + -- 55 + 2.50.1 56 +