Sophie

Sophie

distrib > Fedora > 13 > i386 > media > updates-src > by-pkgid > e5760cbf312a51afcbaf16ccc5c78b75 > files > 14

findutils-4.4.2-8.fc13.src.rpm

 ChangeLog                                    |    9 +++++++++
 NEWS                                         |    2 ++
 find/pred.c                                  |   10 ++++------
 find/testsuite/find.gnu/execdir-multiple.exp |    1 +
 4 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5702e66..97b1b7c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2010-05-24  Kamil Dudka  <kdudka@redhat.com>
+
+	Fix Savannah bug #29949, -execdir does not change working directory
+	* find/pred.c (record_exec_dir): Do not throw the execdir when not
+	working in the cumulative mode.
+	* find/testsuite/find.gnu/execdir-multiple.exp: Add a test-case for
+	the bug #29949.
+	* NEWS: Mention this bugfix.
+
 2010-04-11  James Youngman  <jay@gnu.org>
 
 	Add a test case for Savannah bug 27563 (-L breaks -execdir).
diff --git a/NEWS b/NEWS
index c8eb0bc..2ba2111 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,8 @@ GNU findutils NEWS - User visible changes.	-*- outline -*- (allout)
 
 ** Bug Fixes
 
+#29949: find -execdir does not change working directory
+
 #27563: -L breaks -execdir
 
 #19593: -execdir .... {} + has suboptimal performance (see below)
diff --git a/find/pred.c b/find/pred.c
index cf25184..cac74d1 100644
--- a/find/pred.c
+++ b/find/pred.c
@@ -558,13 +558,11 @@ initialise_wd_for_exec (struct exec_val *execp, int cwd_fd, const char *dir)
 static boolean
 record_exec_dir (struct exec_val *execp)
 {
-  if (!execp->wd_for_exec)
+  /* working directory not already known, so must be a *dir variant,
+     and this must be the first arg we added.   However, this may
+     be -execdir foo {} \; (i.e. not multiple).  */
+  if (!execp->state.todo)
     {
-      /* working directory not already known, so must be a *dir variant,
-	 and this must be the first arg we added.   However, this may
-	 be -execdir foo {} \; (i.e. not multiple).  */
-      assert (!execp->state.todo);
-
       /* Record the WD. If we're using -L or fts chooses to do so for
 	 any other reason, state.cwd_dir_fd may in fact not be the
 	 directory containing the target file.  When this happens,
diff --git a/find/testsuite/find.gnu/execdir-multiple.exp b/find/testsuite/find.gnu/execdir-multiple.exp
index 6d4bd66..495b93b 100644
--- a/find/testsuite/find.gnu/execdir-multiple.exp
+++ b/find/testsuite/find.gnu/execdir-multiple.exp
@@ -49,6 +49,7 @@ if { [ safe_path ] } {
     }
 
     set SKIP_OLD 1
+    find_start p {tmp -type f -empty -execdir sh ./runme \{\} \; } ""
     find_start p {tmp -type f -empty -execdir sh ./runme  \{\} + } ""
     set SKIP_OLD 0
     exec rm -rf tmp