James Youngman 7dc70069a3 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 funciton 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 funciton; true for predicates -execdir
and -okdir.
* find/pred.c: Include cloexec.h and 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 devlaration of global variable.
(starting_desc): Remove devlaration of global variable.
* import-gnulib.config (modules): Import module save-cwd.

Signed-off-by: James Youngman <jay@gnu.org>
2010-04-12 22:50:29 +01:00
2010-04-11 15:57:16 +01:00
2010-04-11 15:57:16 +01:00
2010-04-11 15:57:16 +01:00
2010-04-07 23:45:08 +01:00
2010-04-11 15:57:16 +01:00
2010-04-02 01:47:10 +01:00
2010-04-02 01:47:10 +01:00
2010-04-03 12:22:57 +01:00
1999-08-08 19:52:01 +00:00
2007-08-19 15:31:38 +00:00
2009-03-07 21:22:36 +00:00

This package contains the GNU find, xargs, and locate programs.  find
and xargs comply with POSIX 1003.2, as far as I know (with the
exception of the "+" modifier for the "-exec" action, which isn't
implemented yet).  They also support a large number of additional
options, some borrowed from Unix and some unique to GNU.

See the file NEWS for a list of major changes in the current release.

See the file INSTALL for compilation and installation instructions.

To verify the GPG signature of the release, you will need the public
key of the findutils maintainer.  You can download this from
ftp://ftp.gnu.org/gnu/gnu-keyring.gpg.  Alternatively, you could query
a PGP keyserver, but you will need to use one that can cope with
subkeys containing photos.  Many older key servers cannot do this.  I
use subkeys.pgp.net.  I think that one works.  See also the
"Downloading" section of http://www.gnu.org/software/findutils/.

Special configure options:

--with-afs
  Make find support "-fstype afs".  Requires /afs, /usr/afsws/lib, and
/usr/afsws/include.  configure doesn't add AFS support
automatically because it adds considerably to find's size, and the
AFS libraries need -lucb on Solaris, which breaks find.

--enable-id-cache
  Make tables of used UIDs and GIDs at startup instead of using
getpwuid or getgrgid when needed.  Speeds up -nouser and -nogroup
unless you are running NIS or Hesiod, which make password and group
calls very expensive.

--enable-debug
  Produce output on the standard error output indicating what find is
doing.  This information includes details about how the command line
has been parsed and what files have been stat()ed.  This output is
normally interesting only to the maintainer, and so is off by default.

DEFAULT_ARG_SIZE=<value>
  If this environment variable is defined to a numeric expression
during configure, it determines the default argument size limits used
by xargs without -s, and by find, when spawning child processes.
Otherwise, the default is set at 128 kibibytes.  If the system cannot
support the default limit, the system's limit will be used instead.


To gain speed, GNU find avoids statting files whenever possible.
It does this by:
1. Checking the number of links to directories and not statting files
that it knows aren't directories until it encounters a test or action
that needs the stat info.
2.  Rearranging the command line, where possible, so that it can do tests
that don't require a stat before tests that do, in hopes that the
latter will be skipped because of an OR or AND.  (But it only does
this where it will leave the output unchanged.)

The locate program and its helper programs are derived (heavily
modified) from James Woods' public domain fast-find code, which is
also distributed with the 4.3BSD find.  Because POSIX.2 requires `find
foo' to have the same effect as `find foo -print', the fast-find
searching has been moved to a separate program, `locate'; the same
thing has been done in 4.4BSD.  If you use locate, you should run the
included `updatedb' script from cron periodically (typically nightly).

Mail suggestions and bug reports for these programs to
bug-findutils@gnu.org.
Description
Mirror from GNU Savannah.
Readme 14 MiB
Languages
C 55.2%
Shell 14.4%
Roff 11.2%
Logos 9.6%
Makefile 4.7%
Other 4.9%