Message ID | patch-v2-1.1-9cfc0621067-20211011T014059Z-avarab@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v2] test-lib.sh: try to re-chmod & retry on failed trash removal | expand |
Mostly looking good, but I applied the following on top to be squashed in. Thanks. -- >8 -- Style fix plus adding more paranoia to cope with the lost 'r' bit. diff --git a/t/test-lib.sh b/t/test-lib.sh index 138a26c19b..d820910154 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -1386,11 +1386,11 @@ export HOME GNUPGHOME # "rm -rf" existing trash directory, even if a previous run left it # with bad permissions. -remove_trash_directory() { +remove_trash_directory () { dir="$1" if ! rm -rf "$dir" 2>/dev/null then - chmod -R u+wx "$dir" + chmod -R u+rwx "$dir" rm -rf "$dir" fi ! test -d "$dir"
diff --git a/t/test-lib.sh b/t/test-lib.sh index aa1ad8180ed..ff6d3c79362 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -1387,8 +1387,20 @@ HOME="$TRASH_DIRECTORY" GNUPGHOME="$HOME/gnupg-home-not-used" export HOME GNUPGHOME USER_HOME +# "rm -rf" existing trash directory, even if a previous run left it +# with bad permissions. +remove_trash_directory() { + dir="$1" + if ! rm -rf "$dir" 2>/dev/null + then + chmod -R u+wx "$dir" + rm -rf "$dir" + fi + ! test -d "$dir" +} + # Test repository -rm -fr "$TRASH_DIRECTORY" || { +remove_trash_directory "$TRASH_DIRECTORY" || { GIT_EXIT_OK=t echo >&5 "FATAL: Cannot prepare test area" exit 1