From 40854f479c93b27252a0b1860a37f16c58744d1d Mon Sep 17 00:00:00 2001 From: Kamil Dudka <kdudka@redhat.com> Date: Mon, 24 May 2010 17:15:03 +0200 Subject: [PATCH] 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. diff --git a/find/pred.c b/find/pred.c index e310eea..65f4308 100644 --- a/find/pred.c +++ b/find/pred.c @@ -528,13 +528,11 @@ initialise_wd_for_exec (struct exec_val *execp, int cwd_fd, const char *dir) static bool 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 -- 1.6.6.1