From e6ca61c1a1bf601cfde4b67c33fe861cafff7450 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Wed, 16 Feb 2011 20:43:22 +0100 Subject: [PATCH] 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. --- ChangeLog | 11 +++++++++++ tests/Makefile.am | 2 +- tests/Makefile.in | 2 +- tests/defs.in | 4 ++-- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4563585da..8d03512ba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2011-02-20 Stefano Lattarini + + 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 Ralf Wildenhues diff --git a/tests/Makefile.am b/tests/Makefile.am index ed415f228..047bc7b1d 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -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; diff --git a/tests/Makefile.in b/tests/Makefile.in index 136393060..fe6238b86 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -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; diff --git a/tests/defs.in b/tests/defs.in index ffe21e1de..fd0cc9cd5 100644 --- a/tests/defs.in +++ b/tests/defs.in @@ -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 -- 2.47.2