[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bug on chmod command
From: |
Jim Meyering |
Subject: |
Re: bug on chmod command |
Date: |
Tue, 10 Jan 2006 12:14:31 +0100 |
Paul Eggert <address@hidden> wrote:
> Jim Meyering <address@hidden> writes:
>
>> However, I'm not able to reproduce that with 5.93 and a small
>> hierarchy created like this (on a RHEL 2.4.28-sparc system):
>
> I can reproduce the problem as follows on a Debian GNU/Linux stable x86
> system:
Thanks.
I too have reproduced it, now.
FYI, this bug was defined away with my rewrite to make fts.c
avoid using fchdir/chdir -- to be checked in soon, but
only for coreutils-6.x.
Test case coming up...
Here's the fix that will be in coreutils-5.94:
2006-01-10 Jim Meyering <address@hidden>
Avoid the double-free (first in fts_read, second in fts_close) that
would occur when an `active' directory is made inaccessible (e.g.,
via chmod a-x) during a traversal.
* fts.c (fts_read): After a failed fchdir, update sp->fts_cur
before returning. Reproduce this failure by
mkdir -p a/b; cd a; chmod a-x . b
Reported by Stavros Passas.
Index: lib/fts.c
===================================================================
RCS file: /fetish/cu/lib/fts.c,v
retrieving revision 1.37
retrieving revision 1.37.2.1
diff -u -p -u -r1.37 -r1.37.2.1
--- lib/fts.c 12 Aug 2005 13:00:57 -0000 1.37
+++ lib/fts.c 10 Jan 2006 09:17:51 -0000 1.37.2.1
@@ -524,6 +524,7 @@ next: tmp = p;
if (p->fts_level == FTS_ROOTLEVEL) {
if (FCHDIR(sp, sp->fts_rfd)) {
SET(FTS_STOP);
+ sp->fts_cur = p;
return (NULL);
}
fts_load(sp, p);