Fix compile w/o openssl; disable sha256 & sha512 for --checksum.
[rsync.git] / testsuite / protected-regular.test
blob40416b0df26cbf6ca3210e6563c12eaef6ccf61c
1 #!/bin/sh
3 # Copyright (C) 2021 by Achim Leitner <aleitner@lis-engineering.de>
4 # This program is distributable under the terms of the GNU GPL (see COPYING)
6 # Modern linux systems have the protected_regular feature set to 1 or 2
7 # See https://www.kernel.org/doc/Documentation/sysctl/fs.txt
8 # Make sure we can still write these files in --inplace mode
10 . "$suitedir/rsync.fns"
12 test -f /proc/sys/fs/protected_regular || test_skipped "Can't find protected_regular setting (only available on Linux)"
13 pr_lvl=`cat /proc/sys/fs/protected_regular 2>/dev/null` || test_skipped "Can't check if fs.protected_regular is enabled (probably need root)"
14 test "$pr_lvl" != 0 || test_skipped "fs.protected_regular is not enabled"
16 workdir="$tmpdir/files"
17 mkdir "$workdir"
18 chmod 1777 "$workdir"
20 echo "Source" > "$workdir/src"
21 echo "" > "$workdir/dst"
22 chown 5001 "$workdir/dst" || test_skipped "Can't chown (probably need root)"
24 # Output is only shown in case of an error
25 echo "Contents of $workdir:"
26 ls -al "$workdir"
28 $RSYNC --inplace "$workdir/src" "$workdir/dst" || test_fail
30 # The script would have aborted on error, so getting here means we've won.
31 exit 0