diff --git a/findutils-4.5.8-0002-7dc7006.patch b/findutils-4.5.8-0002-7dc7006.patch index e7db79a..7f88774 100644 --- a/findutils-4.5.8-0002-7dc7006.patch +++ b/findutils-4.5.8-0002-7dc7006.patch @@ -1,4 +1,4 @@ - ChangeLog | 85 ++++++++++++++++++++++++++++++++++++++++++++++ + ChangeLog | 83 +++++++++++++++++++++++++++++++++++++++++++++ find/defs.h | 14 ++++---- find/find.c | 69 +++++-------------------------------- find/finddata.c | 12 +----- @@ -10,99 +10,97 @@ lib/dircallback.c | 36 +++++++++++++++++++- lib/dircallback.h | 5 ++- lib/listfile.c | 2 +- - 12 files changed, 293 insertions(+), 196 deletions(-) + 12 files changed, 291 insertions(+), 196 deletions(-) diff --git a/ChangeLog b/ChangeLog -index 34552d5..f040627 100644 +index 34552d5..fefc1b8 100644 --- a/ChangeLog +++ b/ChangeLog -@@ -1,5 +1,90 @@ +@@ -1,5 +1,88 @@ 2010-04-10 James Youngman -+ Exec predicates now store which directory they want to run in. -+ * lib/dircallback.c (run_in_dirfd): New name for old run_in_dir -+ function. -+ (run_in_dir): Like the old function of the same name, but now -+ takes an argument const struct saved_cwd *. -+ * lib/dircallback.h: Update declarations of run_in_dirfd and -+ run_in_dir. -+ * find/util.c: Include dircallback.h, xalloc.h, save-cwd.h. -+ (do_complete_pending_execdirs): Remove dir_fd parameter, since the -+ per-predicate data structures now indicate what directory they -+ need to be run in. Instead of calling bc_do_exec directly, use a -+ callback 'exec_cb' that uses run_in_dir (which now takes a -+ saved_cwd* parameter instead of a file descriptor). -+ (do_exec): Called by do_complete_pending_execdirs, and simply uses -+ run_in_dir to call exec_cb, restoring the working directory -+ afterward. -+ (record_initial_cwd): New function, initialises the global -+ variable initial_wd. -+ (cleanup_initial_cwd): New function, cleans up the global variable -+ initial_wd. -+ (cleanup): Call cleanup_initial_cwd. -+ (get_start_dirfd): Remove. -+ (is_exec_in_local_dir): New function; true for predicates -execdir -+ and -okdir. -+ * find/pred.c: Include save-cwd.h. -+ (record_exec_dir): New function, sets the value of -+ execp->wd_for_exec if needed. -+ (new_impl_pred_exec): Remove the obsolete dir_fd parameter. Call -+ record_exec_dir. -+ (pred_exec): Don't pass the dir_fd parameter. -+ (pred_execdir): Likewise. -+ (pred_ok): Likewise. -+ (pred_okdir): Likewise. -+ (can_access): Call run_in_dirfd rather than run_in_dir (the -+ function was renamed). -+ (prep_child_for_exec): Remove dir_fd parameter; don't fchdir to -+ that. Call restore_cwd instead (passing a saved_cwd* parameter -+ which replaced dir_fd). -+ (launch): Remove references to execp->use_current_dir. -+ (launch): Change references to execp->dir_fd to execp->wd_for_exec. -+ * find/parser.c: Correct indentiation of declaration of -+ insert_exec_ok and remove the obsolete dir_fd parameter. -+ (parse_exec): Don't pass the dir_fd parameter to insert_exec_ok. -+ (parse_execdir): Likewise. -+ (parse_ok): Likewise. -+ (parse_okdir): Likewise. -+ (insert_exec_ok): Remove obsolete dir_fd paramter. Initialise -+ execp->wd_for_exec, either to NULL (for -*dir) or to the -+ initial_wd. -+ * find/ftsfind.c: Remove get_current_dirfd. Remove -+ complete_execdirs_cb. -+ (consider_visiting): Call complete_pending_execdirs directly. -+ (main): Call record_initial_cwd to record the initial working -+ directory, early on. Don't initialise starting_dir or -+ starting_desc, they have been removed. -+ * find/finddata.c: Include save-cwd.h. Remove starting_dir and -+ starting_desc. Add new global variable initial_wd. It is a struct -+ saved_wd* and represents find's initial working directory. -+ * find/find.c: Include save-cwd.h. -+ (main): Call record_initial_cwd in order to initialise the -+ global variable initial_wd Don't set starting_desc and -+ starting_dir, since those variables have been removed. -+ (safely_chdir): Don't pass an fd to complete_pending_execdirs. -+ (chdir_back): Remove the safety check (since we are using fchdir -+ and in any case no longer have all the data that the existing -+ wd_sanity_check function wants). -+ (do_process_top_dir): Don't pass an fd to -+ complete_pending_execdirs. -+ (process_dir): Likewise. -+ * find/defs.h (struct exec_val): Remove use_current_dir and -+ dir_fd. Replace with wd_for_exec, which is a struct saved_wd*. -+ (get_start_dirfd): Remove prototype. -+ (get_current_dirfd): Remove prototype. -+ (complete_pending_execdirs): No longer takes dir_fd parameter. -+ (record_initial_cwd): Add prototype. -+ (is_exec_in_local_dir): Add prototype. -+ (options): Declare. -+ (initial_wd): Add declaration. It is a struct saved_wd* and -+ represents find's initial working directory. -+ (starting_dir): Remove declaration of global variable. -+ (starting_desc): Remove declaration of global variable. -+ * import-gnulib.config (modules): Import module save-cwd. -+ -+2010-04-10 James Youngman ++ Exec predicates now store which directory they want to run in. ++ * lib/dircallback.c (run_in_dirfd): New name for old run_in_dir ++ function. ++ (run_in_dir): Like the old function of the same name, but now ++ takes an argument const struct saved_cwd *. ++ * lib/dircallback.h: Update declarations of run_in_dirfd and ++ run_in_dir. ++ * find/util.c: Include dircallback.h, xalloc.h, save-cwd.h. ++ (do_complete_pending_execdirs): Remove dir_fd parameter, since the ++ per-predicate data structures now indicate what directory they ++ need to be run in. Instead of calling bc_do_exec directly, use a ++ callback 'exec_cb' that uses run_in_dir (which now takes a ++ saved_cwd* parameter instead of a file descriptor). ++ (do_exec): Called by do_complete_pending_execdirs, and simply uses ++ run_in_dir to call exec_cb, restoring the working directory ++ afterward. ++ (record_initial_cwd): New function, initialises the global ++ variable initial_wd. ++ (cleanup_initial_cwd): New function, cleans up the global variable ++ initial_wd. ++ (cleanup): Call cleanup_initial_cwd. ++ (get_start_dirfd): Remove. ++ (is_exec_in_local_dir): New function; true for predicates -execdir ++ and -okdir. ++ * find/pred.c: Include save-cwd.h. ++ (record_exec_dir): New function, sets the value of ++ execp->wd_for_exec if needed. ++ (new_impl_pred_exec): Remove the obsolete dir_fd parameter. Call ++ record_exec_dir. ++ (pred_exec): Don't pass the dir_fd parameter. ++ (pred_execdir): Likewise. ++ (pred_ok): Likewise. ++ (pred_okdir): Likewise. ++ (can_access): Call run_in_dirfd rather than run_in_dir (the ++ function was renamed). ++ (prep_child_for_exec): Remove dir_fd parameter; don't fchdir to ++ that. Call restore_cwd instead (passing a saved_cwd* parameter ++ which replaced dir_fd). ++ (launch): Remove references to execp->use_current_dir. ++ (launch): Change references to execp->dir_fd to execp->wd_for_exec. ++ * find/parser.c: Correct indentiation of declaration of ++ insert_exec_ok and remove the obsolete dir_fd parameter. ++ (parse_exec): Don't pass the dir_fd parameter to insert_exec_ok. ++ (parse_execdir): Likewise. ++ (parse_ok): Likewise. ++ (parse_okdir): Likewise. ++ (insert_exec_ok): Remove obsolete dir_fd paramter. Initialise ++ execp->wd_for_exec, either to NULL (for -*dir) or to the ++ initial_wd. ++ * find/ftsfind.c: Remove get_current_dirfd. Remove ++ complete_execdirs_cb. ++ (consider_visiting): Call complete_pending_execdirs directly. ++ (main): Call record_initial_cwd to record the initial working ++ directory, early on. Don't initialise starting_dir or ++ starting_desc, they have been removed. ++ * find/finddata.c: Include save-cwd.h. Remove starting_dir and ++ starting_desc. Add new global variable initial_wd. It is a struct ++ saved_wd* and represents find's initial working directory. ++ * find/find.c: Include save-cwd.h. ++ (main): Call record_initial_cwd in order to initialise the ++ global variable initial_wd Don't set starting_desc and ++ starting_dir, since those variables have been removed. ++ (safely_chdir): Don't pass an fd to complete_pending_execdirs. ++ (chdir_back): Remove the safety check (since we are using fchdir ++ and in any case no longer have all the data that the existing ++ wd_sanity_check function wants). ++ (do_process_top_dir): Don't pass an fd to ++ complete_pending_execdirs. ++ (process_dir): Likewise. ++ * find/defs.h (struct exec_val): Remove use_current_dir and ++ dir_fd. Replace with wd_for_exec, which is a struct saved_wd*. ++ (get_start_dirfd): Remove prototype. ++ (get_current_dirfd): Remove prototype. ++ (complete_pending_execdirs): No longer takes dir_fd parameter. ++ (record_initial_cwd): Add prototype. ++ (is_exec_in_local_dir): Add prototype. ++ (options): Declare. ++ (initial_wd): Add declaration. It is a struct saved_wd* and ++ represents find's initial working directory. ++ (starting_dir): Remove declaration of global variable. ++ (starting_desc): Remove declaration of global variable. ++ * import-gnulib.config (modules): Import module save-cwd. + Add a test which checks $CWD for find -execdir {} +/; * find/testsuite/find.gnu/execdir-multiple.exp: New test; verifies @@ -506,7 +504,7 @@ index 3f237eb..b96d317 100644 /* Get a timestamp and comparison type. diff --git a/find/pred.c b/find/pred.c -index 7c34119..9273bba 100644 +index 7c34119..d057d48 100644 --- a/find/pred.c +++ b/find/pred.c @@ -47,6 +47,7 @@ @@ -572,7 +570,7 @@ index 7c34119..9273bba 100644 + } + else + { -+ /* For the others (-exec, -ok), the parder should ++ /* For the others (-exec, -ok), the parser should + have set wd_for_exec to initial_wd, indicating + that the exec should take place from find's initial + working directory. diff --git a/findutils-4.5.8-0003-27a7e45.patch b/findutils-4.5.8-0003-27a7e45.patch index 03b79c4..651a61e 100644 --- a/findutils-4.5.8-0003-27a7e45.patch +++ b/findutils-4.5.8-0003-27a7e45.patch @@ -1,10 +1,10 @@ ChangeLog | 10 ++++++++++ - NEWS | 13 +++++++++++++ + NEWS | 15 +++++++++++++++ find/ftsfind.c | 37 +++++++++++++++++++------------------ - 3 files changed, 42 insertions(+), 18 deletions(-) + 3 files changed, 44 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog -index 555caab..26d4be3 100644 +index fefc1b8..98d7962 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,15 @@ @@ -20,14 +20,18 @@ index 555caab..26d4be3 100644 + before we've finished with the current directory). + * NEWS: Mention this change. + - Exec predicates now store which directory they want to run in. - * lib/dircallback.c (run_in_dirfd): New name for old run_in_dir - function. + Exec predicates now store which directory they want to run in. + * lib/dircallback.c (run_in_dirfd): New name for old run_in_dir + function. diff --git a/NEWS b/NEWS -index 6b8b725..757ffd8 100644 +index 6b8b725..569ff51 100644 --- a/NEWS +++ b/NEWS -@@ -1,3 +1,16 @@ +@@ -1,5 +1,20 @@ + GNU findutils NEWS - User visible changes. -*- outline -*- (allout) + ++* Major changes in release 4.4.3-git, YYYY-MM-DD ++ +** Bug Fixes + +#19593: -execdir .... {} + has suboptimal performance (see below) @@ -41,9 +45,9 @@ index 6b8b725..757ffd8 100644 +arguments, since an exec will occur each time find encounters a +subdirectory (if at least one argument is pending). + - GNU findutils NEWS - User visible changes. -*- outline -*- (allout) - * Major changes in release 4.4.2, 2009-11-26 + + ** Functional Enhancements to find diff --git a/find/ftsfind.c b/find/ftsfind.c index 9945abd..3c9ae1d 100644 --- a/find/ftsfind.c diff --git a/findutils-4.5.8-0004-e1d0a99.patch b/findutils-4.5.8-0004-e1d0a99.patch index c66b006..bcaa555 100644 --- a/findutils-4.5.8-0004-e1d0a99.patch +++ b/findutils-4.5.8-0004-e1d0a99.patch @@ -1,18 +1,19 @@ - ChangeLog | 20 +++++++++ + ChangeLog | 21 +++++++++ NEWS | 2 + - find/pred.c | 135 ++++++++++++++++++++++++++++++++++++++++++++++++----------- - 3 files changed, 132 insertions(+), 25 deletions(-) + find/pred.c | 133 ++++++++++++++++++++++++++++++++++++++++++++++++----------- + 3 files changed, 132 insertions(+), 24 deletions(-) diff --git a/ChangeLog b/ChangeLog -index b6a0c6c..e796142 100644 +index 98d7962..8e5d0ce 100644 --- a/ChangeLog +++ b/ChangeLog -@@ -1,3 +1,23 @@ +@@ -1,3 +1,24 @@ +2010-04-11 James Youngman + + Fix Savannah bug #27563, -L breaks -execdir. -+ * find/pred.c (initialise_wd_for_exec): New function, factoring -+ out part of the body of record_exec_dir. ++ * find/pred.c (mdir_name): New function, taken from newer gnulib. ++ (initialise_wd_for_exec): New function, factoring out part of the body ++ of record_exec_dir. + (record_exec_dir): If state.rel_pathname contains a /, extract the + directory part and initialise execp->wd_for_exec to point at that + directory. @@ -32,10 +33,11 @@ index b6a0c6c..e796142 100644 Fix Savannah bug #19593, -execdir .... {} + has suboptimal performance diff --git a/NEWS b/NEWS -index 4dcffa7..7f972eb 100644 +index 569ff51..c8eb0bc 100644 --- a/NEWS +++ b/NEWS -@@ -1,5 +1,7 @@ +@@ -4,6 +4,8 @@ GNU findutils NEWS - User visible changes. -*- outline -*- (allout) + ** Bug Fixes +#27563: -L breaks -execdir @@ -44,7 +46,7 @@ index 4dcffa7..7f972eb 100644 ** Performance changes diff --git a/find/pred.c b/find/pred.c -index 9273bba..cf25184 100644 +index d057d48..cf25184 100644 --- a/find/pred.c +++ b/find/pred.c @@ -504,6 +504,57 @@ pred_empty (const char *pathname, struct stat *stat_buf, struct predicate *pred_ @@ -164,7 +166,7 @@ index 9273bba..cf25184 100644 { /* For -execdir/-okdir predicates, the parser did not fill in the wd_for_exec member of sturct exec_val. So for those -@@ -550,15 +618,30 @@ new_impl_pred_exec (const char *pathname, +@@ -550,6 +618,18 @@ new_impl_pred_exec (const char *pathname, safely_quote_err_filename (0, pathname)); /*NOTREACHED*/ } @@ -183,10 +185,7 @@ index 9273bba..cf25184 100644 } else { -- /* For the others (-exec, -ok), the parder should -+ /* For the others (-exec, -ok), the parser should - have set wd_for_exec to initial_wd, indicating - that the exec should take place from find's initial +@@ -559,6 +639,9 @@ new_impl_pred_exec (const char *pathname, working directory. */ assert (execp->wd_for_exec == initial_wd); diff --git a/findutils-4.5.8-0005-a1f5402.patch b/findutils-4.5.8-0005-a1f5402.patch index 7e5ea67..c328904 100644 --- a/findutils-4.5.8-0005-a1f5402.patch +++ b/findutils-4.5.8-0005-a1f5402.patch @@ -1,16 +1,16 @@ - ChangeLog | 13 +++++++++++++ + ChangeLog | 11 +++++++++++ find/testsuite/Makefile.am | 4 ++++ find/testsuite/find.gnu/sv-bug-27563-execdir.exp | 6 ++++++ find/testsuite/find.gnu/sv-bug-27563-execdir.xo | 1 + find/testsuite/find.posix/sv-bug-27563-exec.exp | 6 ++++++ find/testsuite/find.posix/sv-bug-27563-exec.xo | 1 + - 6 files changed, 31 insertions(+), 0 deletions(-) + 6 files changed, 29 insertions(+), 0 deletions(-) diff --git a/ChangeLog b/ChangeLog -index e796142..f42aa7a 100644 +index 8e5d0ce..5702e66 100644 --- a/ChangeLog +++ b/ChangeLog -@@ -1,5 +1,18 @@ +@@ -1,5 +1,16 @@ 2010-04-11 James Youngman + Add a test case for Savannah bug 27563 (-L breaks -execdir). @@ -23,14 +23,12 @@ index e796142..f42aa7a 100644 + * find/testsuite/find.posix/sv-bug-27563-exec.exp: New test. + * find/testsuite/find.gnu/sv-bug-27563-execdir.xo: Expected output. + * find/testsuite/find.posix/sv-bug-27563-exec.xo: Expected output. -+ -+2010-04-11 James Youngman + Fix Savannah bug #27563, -L breaks -execdir. - * find/pred.c (initialise_wd_for_exec): New function, factoring - out part of the body of record_exec_dir. + * find/pred.c (mdir_name): New function, taken from newer gnulib. + (initialise_wd_for_exec): New function, factoring out part of the body diff --git a/find/testsuite/Makefile.am b/find/testsuite/Makefile.am -index 1447132..2e661d9 100644 +index 1447132..aa32d4b 100644 --- a/find/testsuite/Makefile.am +++ b/find/testsuite/Makefile.am @@ -63,6 +63,7 @@ find.gnu/samefile-same.xo \ @@ -53,7 +51,7 @@ index 1447132..2e661d9 100644 find.gnu/sv-bug-17782.exp \ find.gnu/sv-bug-18222.exp \ find.gnu/sv-bug-24169.exp \ -+find.gnu/sv-bug-25359-execdir.exp \ ++find.gnu/sv-bug-27563-execdir.exp \ find.gnu/quit.exp \ find.gnu/used-invarg.exp \ find.gnu/used-missing.exp \ @@ -61,7 +59,7 @@ index 1447132..2e661d9 100644 find.posix/mtime0.exp \ find.posix/sv-bug-11175.exp \ find.posix/sv-bug-12181.exp \ -+find.posix/sv-bug-25359-exec.exp \ ++find.posix/sv-bug-27563-exec.exp \ find.posix/depth1.exp \ find.posix/sizes.exp \ find.posix/name.exp \ diff --git a/findutils-4.5.8-0006-Fix-Savannah-bug-29949.patch b/findutils-4.5.8-0006-Fix-Savannah-bug-29949.patch new file mode 100644 index 0000000..70812f4 --- /dev/null +++ b/findutils-4.5.8-0006-Fix-Savannah-bug-29949.patch @@ -0,0 +1,70 @@ + 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 ++ ++ 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 + + 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 diff --git a/findutils.spec b/findutils.spec index afea94e..0cdacbe 100644 --- a/findutils.spec +++ b/findutils.spec @@ -1,7 +1,7 @@ Summary: The GNU versions of find utilities (find and xargs) Name: findutils Version: 4.4.2 -Release: 7%{?dist} +Release: 8%{?dist} Epoch: 1 License: GPLv3+ Group: Applications/File @@ -45,6 +45,9 @@ Patch10: findutils-4.5.8-0004-e1d0a99.patch # backport of upstream commit a1f54022d1913a92ccb728211127d5c238397eb6 Patch11: findutils-4.5.8-0005-a1f5402.patch +# Fix Savannah bug #29949, -execdir does not change working directory +Patch12: findutils-4.5.8-0006-Fix-Savannah-bug-29949.patch + Requires(post): /sbin/install-info Requires(preun): /sbin/install-info Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -76,6 +79,7 @@ useful for finding things on your system. %patch9 -p1 %patch10 -p1 %patch11 -p1 +%patch12 -p1 autoreconf @@ -133,6 +137,9 @@ rm -rf $RPM_BUILD_ROOT %{_infodir}/find-maint.info.gz %changelog +* Tue Jun 01 2010 Kamil Dudka - 1:4.4.2-8 +- fix Savannah bug #29949 + * Mon May 10 2010 Kamil Dudka - 1:4.4.2-7 - backport of patches for upstream bugs #19593 and #27563 (rhbz #493143) - mention -xautofs in the output of --help (#590166)