commit: 5b03749c85a35dbd3b954cd5e727fe84cc33bedb
parent 8395b865b2a92e994e1fca8295b492c42333d363
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Thu, 1 Aug 2024 09:26:28 +0200
test-cmd/cat.sh: Skip noperm when run as uid0
Diffstat:
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/test-cmd/cat.sh b/test-cmd/cat.sh
@@ -16,12 +16,17 @@ t devnull '/dev/null' ''
t_file all_bytes "$WD/inputs/all_bytes" "$WD/inputs/all_bytes"
-touch "$WD/inputs/chmod_000"
-chmod 0000 "$WD/inputs/chmod_000"
-t --exit=1 'noperm' "$WD/inputs/chmod_000" "cat: Error opening ‘$WD/inputs/chmod_000’: Permission denied
+if [ "$(id -u)" = 0 ]
+then
+ skip noperm 'needs to be run unprivileged'
+else
+ touch "$WD/inputs/chmod_000"
+ chmod 0000 "$WD/inputs/chmod_000"
+ t --exit=1 'noperm' "$WD/inputs/chmod_000" "cat: Error opening ‘$WD/inputs/chmod_000’: Permission denied
"
-chmod 0600 "$WD/inputs/chmod_000"
-rm "$WD/inputs/chmod_000"
+ chmod 0600 "$WD/inputs/chmod_000"
+ rm "$WD/inputs/chmod_000"
+fi
#atf_test_case devfull
#devfull_body() {