[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Autotest: make test dir writable before removing
From: |
Ralf Wildenhues |
Subject: |
Re: Autotest: make test dir writable before removing |
Date: |
Wed, 11 Jan 2006 09:32:50 +0100 |
User-agent: |
Mutt/1.5.11 |
Hi Stepan,
This is a somewhat older thread:
http://thread.gmane.org/gmane.comp.sysutils.autoconf.patches/2563
* Stepan Kasal wrote on Wed, Oct 05, 2005 at 11:07:02AM CEST:
> On Tue, Oct 04, 2005 at 12:17:54PM -0700, Paul Eggert wrote:
> > Why do you need the "-type l -prune" here? Can't that be omitted?
> > "find" doesn't follow symlinks.
>
> the question is whether `-type d' can be true for symlinked directory,
> on some system.
>
> > Also, as a minor efficiency thing, if $at_suite_dir is not a directory
> > then you don't need to invoke rm at all;
>
> Yes.
>
> Can we use `-perm -700' to avoid most of the chmod's?
I assume yes -- nobody complained, it's not noted in the docs.
> A proposed patch attached.
I have applied that as below.
Cheers,
Ralf
2006-01-11 Ralf Wildenhues <address@hidden>
Stepan Kasal <address@hidden>
* lib/autotest/general.m4 (AT_INIT): When ensuring writability
before the removals of test dirs, use `find' to avoid modification
of symlinked directories.
Index: lib/autotest/general.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autotest/general.m4,v
retrieving revision 1.195
diff -u -r1.195 general.m4
--- lib/autotest/general.m4 6 Jan 2006 00:10:37 -0000 1.195
+++ lib/autotest/general.m4 11 Jan 2006 08:32:46 -0000
@@ -276,7 +276,8 @@
;;
--clean | -c )
- test -d "$at_suite_dir" && chmod -R u+rwx "$at_suite_dir"
+ test -d "$at_suite_dir" &&
+ find "$at_suite_dir" -type d ! -perm -700 -exec chmod u+rwx \{\} \;
rm -f -r "$at_suite_dir" "$at_suite_log"
exit 0
;;
@@ -670,8 +671,10 @@
# Create a fresh directory for the next test group, and enter.
at_group_dir=$at_suite_dir/$at_group_normalized
at_group_log=$at_group_dir/$as_me.log
- test -d $at_group_dir && chmod -R u+rwx $at_group_dir
- rm -f -r $at_group_dir
+ if test -d $at_group_dir; then
+ find $at_group_dir -type d ! -perm -700 -exec chmod u+rwx \{\} \;
+ rm -fr $at_group_dir
+ fi
mkdir $at_group_dir ||
AS_ERROR([cannot create $at_group_dir])
cd $at_group_dir
@@ -764,10 +767,11 @@
echo "$at_log_msg" >&AS_MESSAGE_LOG_FD
# Cleanup the group directory, unless the user wants the files.
- $at_debug_p || {
- test -d $at_group_dir && chmod -R u+rwx $at_group_dir
- rm -f -r $at_group_dir
- }
+ $at_debug_p ||
+ if test -d $at_group_dir; then
+ find $at_group_dir -type d ! -perm -700 -exec chmod u+rwx \{\} \;
+ rm -fr $at_group_dir
+ fi
;;
*)
# Upon failure, include the log into the testsuite's global
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: Autotest: make test dir writable before removing,
Ralf Wildenhues <=