16314: Fix cleanup of temp/arvbox dirs that contain readonly dirs.
authorTom Clegg <tom@tomclegg.ca>
Tue, 25 Aug 2020 14:12:55 +0000 (10:12 -0400)
committerTom Clegg <tom@tomclegg.ca>
Tue, 25 Aug 2020 14:12:55 +0000 (10:12 -0400)
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@tomclegg.ca>

build/run-tests.sh
tools/arvbox/bin/arvbox

index 2742540b16b44efe57fa113d23d3e967915e5c2f..c926fe87a17f0a740e2913e63d5464c12f6554f9 100755 (executable)
@@ -162,9 +162,12 @@ temp_preserve=
 
 clear_temp() {
     if [[ -z "$temp" ]]; then
 
 clear_temp() {
     if [[ -z "$temp" ]]; then
-        # we didn't even get as far as making a temp dir
+        # we did not even get as far as making a temp dir
         :
     elif [[ -z "$temp_preserve" ]]; then
         :
     elif [[ -z "$temp_preserve" ]]; then
+        # Go creates readonly dirs in the module cache, which cause
+        # "rm -rf" to fail unless we chmod first.
+        chmod -R u+w "$temp"
         rm -rf "$temp"
     else
         echo "Leaving behind temp dirs in $temp"
         rm -rf "$temp"
     else
         echo "Leaving behind temp dirs in $temp"
index 46acc8baf2a276993093518ca79ef397af420cc1..7d45ba17c1dcb57846030d36861051daef4fcd0c 100755 (executable)
@@ -497,6 +497,7 @@ case "$subcmd" in
                     exit 1
                 fi
                 set -x
                     exit 1
                 fi
                 set -x
+                chmod -R u+w "$ARVBOX_DATA"
                 rm -rf "$ARVBOX_DATA"
             else
                 if test "$1" != -f ; then
                 rm -rf "$ARVBOX_DATA"
             else
                 if test "$1" != -f ; then