tests: tempdirs with restrictive permissions are cleaned correctly
authorStefano Lattarini <stefano.lattarini@gmail.com>
Wed, 16 Feb 2011 19:43:22 +0000 (20:43 +0100)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Mon, 21 Feb 2011 12:15:52 +0000 (13:15 +0100)
Before this change, the removal of a temporary test directory
containing subdirectories with restrictive permissions (such as
'r--r--r--') could fail.

* tests/defs: Ensure that all the subdirectories of a temporary
test directory have the 'read', 'write' and 'execute' bits set,
before trying to remove it with `rm -rf'.
* tests/Makefile.am (clean-local-check): Likewise.

ChangeLog
tests/Makefile.am
tests/Makefile.in
tests/defs.in

index 4563585..8d03512 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2011-02-20  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: tempdirs with restrictive permissions are cleaned correctly
+       Before this change, the removal of a temporary test directory
+       containing subdirectories with restrictive permissions (such as
+       'r--r--r--') could fail.
+       * tests/defs: Ensure that all the subdirectories of a temporary
+       test directory have the 'read', 'write' and 'execute' bits set,
+       before trying to remove it with `rm -rf'.
+       * tests/Makefile.am (clean-local-check): Likewise.
+
 2011-02-16  Stefano Lattarini  <stefano.lattarini@gmail.com>
            Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
index ed415f2..047bc7b 100644 (file)
@@ -839,6 +839,6 @@ clean-local-check:
         if test "$$#,$$1" = "1,*.dir"; then \
           : there is no test directory to clean; \
         else \
-          find "$$@" -type d '!' -perm -200 -exec chmod u+w {} ';'; \
+          find "$$@" -type d ! -perm -700 -exec chmod u+rwx {} ';'; \
           rm -rf "$$@"; \
         fi;
index 1363930..fe6238b 100644 (file)
@@ -1443,7 +1443,7 @@ clean-local-check:
         if test "$$#,$$1" = "1,*.dir"; then \
           : there is no test directory to clean; \
         else \
-          find "$$@" -type d '!' -perm -200 -exec chmod u+w {} ';'; \
+          find "$$@" -type d ! -perm -700 -exec chmod u+rwx {} ';'; \
           rm -rf "$$@"; \
         fi;
 
index ffe21e1..fd0cc9c 100644 (file)
@@ -263,7 +263,7 @@ Exit ()
 curdir=`pwd`
 testSubDir=$me.dir
 test ! -d $testSubDir || {
-  find $testSubDir -type d ! -perm -200 -exec chmod u+w {} ";"
+  find $testSubDir -type d ! -perm -700 -exec chmod u+rwx {} ";"
   rm -rf $testSubDir
 }
 mkdir $testSubDir
@@ -275,7 +275,7 @@ if test "$sh_errexit_works" = yes; then
     cd "$curdir"
     case $exit_status,$keep_testdirs in
     0,)
-      find $testSubDir -type d ! -perm -200 -exec chmod u+w {} ";"
+      find $testSubDir -type d ! -perm -700 -exec chmod u+rwx {} ";"
       rm -rf $testSubDir
       ;;
     esac