Hello,

On Mon, Oct 03, 2005 at 12:41:04PM -0700, Paul Eggert wrote:
> I was worried about the case where it wasn't erased, and where the
> test contained a symlink to /usr/bin or something like that.
> Admittedly I'm waving my hands a bit here; I don't know exactly what
> I'm worried about.

I cannot imagine a real danger with links.
"mount --bind" would be dangerous, but I don't this Autotest test suties
should excersise it.  (It would be dangerous even without chmod -R.)

I'm afraid I rushed in too quickly when I decided to commit the patch.

> > I guess we have to put in the trap in order to provide backward
> > compatibility with 2.59, but only for that reason.
> 
> Yes, that's right.

First, I have to admit that I don't understand this, so I cannot fix it.

> Here are some other problems with that patch.
> 
> First, there are two other instances of the problem in general.m4:
> 
>       rm -f -r "$at_suite_dir" "$at_suite_log"
> 
>         $at_debug_p || rm -f -r $at_group_dir
> 
> Second, chmod u+w doesn't suffice for recursive removals.  You would
> need at least chmod u+rwx.  The 'r' is needed so that rm can read the
> directory to find out what its subfiles are.  The 'x' is needed so
> that rm can search the directory to remove its subfiles.

But I understand this, so I implemented it.  I committed another patch,
as attached to this mail.

Have a nice day,
        Stepan Kasal
2005-10-04  Stepan Kasal  <[EMAIL PROTECTED]>

        * lib/autotest/general.m4 (AT_INIT): Really make the subtree writable
        before removing it (chmod -R u+rwx); there are three instances of this.


Index: lib/autotest/general.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autotest/general.m4,v
retrieving revision 1.192
diff -u -r1.192 general.m4
--- lib/autotest/general.m4     3 Oct 2005 10:44:01 -0000       1.192
+++ lib/autotest/general.m4     4 Oct 2005 08:50:39 -0000
@@ -276,6 +276,7 @@
        ;;
 
     --clean | -c )
+       test -d "$at_suite_dir" && chmod -R u+rwx "$at_suite_dir"
        rm -f -r "$at_suite_dir" "$at_suite_log"
        exit 0
        ;;
@@ -669,7 +670,7 @@
       # 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+w $at_group_dir
+      test -d $at_group_dir && chmod -R u+rwx $at_group_dir
       rm -f -r $at_group_dir
       mkdir $at_group_dir ||
        AS_ERROR([cannot create $at_group_dir])
@@ -763,7 +764,10 @@
          echo "$at_log_msg" >&AS_MESSAGE_LOG_FD
 
          # Cleanup the group directory, unless the user wants the files.
-         $at_debug_p || rm -f -r $at_group_dir
+         $at_debug_p || {
+           test -d $at_group_dir && chmod -R u+rwx $at_group_dir
+           rm -f -r $at_group_dir
+         }
          ;;
        *)
          # Upon failure, include the log into the testsuite's global

Reply via email to