[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] fts: avoid false-positive cycle-detection
From: |
Jim Meyering |
Subject: |
[PATCH] fts: avoid false-positive cycle-detection |
Date: |
Sun, 19 Jul 2009 22:35:33 +0200 |
I'm considering a rewrite of rm that uses fts.c,
and see that the resulting rm fails coreutils' rm/cycle test
because it incorrectly reports a cycle for that unusual case.
The following patch fixes fts so that it properly reinitializes one of
its cycle-detection data structure for each new command line argument.
I might save a little by merely clearing the hash table
and reusing it, rather than freeing it altogether, but don't
think that would be worth the added code.
I have not yet been able to cause trouble with chmod, chown, chcon,
or du, but haven't tried very hard, either.
>From a90d85f9e7ca8329d05bb7dd02cf807b9086b71e Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sun, 19 Jul 2009 22:33:09 +0200
Subject: [PATCH] fts: avoid false-positive cycle-detection
* lib/fts.c (fts_read): Reinitialize cycle-detection data structures
for each new command line argument.
---
ChangeLog | 6 ++++++
lib/fts.c | 2 ++
2 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 56a6bda..9c78852 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-07-19 Jim Meyering <address@hidden>
+
+ fts: avoid false-positive cycle-detection
+ * lib/fts.c (fts_read): Reinitialize cycle-detection data structures
+ for each new command line argument.
+
2009-07-19 Bruno Haible <address@hidden>
Fix build error on mingw with the modules sys_select and unistd.
diff --git a/lib/fts.c b/lib/fts.c
index 0cbb9fb..bbcd1ff 100644
--- a/lib/fts.c
+++ b/lib/fts.c
@@ -932,7 +932,9 @@ next: tmp = p;
SET(FTS_STOP);
return (NULL);
}
+ free_dir(sp);
fts_load(sp, p);
+ setup_dir(sp);
goto check_for_dir;
}
--
1.6.4.rc1.169.gd0406
- [PATCH] fts: avoid false-positive cycle-detection,
Jim Meyering <=