History log of /freebsd-10.0-release/usr.bin/find/
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
259065 07-Dec-2013 gjb

- Copy stable/10 (r259064) to releng/10.0 as part of the
10.0-RELEASE cycle.
- Update __FreeBSD_version [1]
- Set branch name to -RC1

[1] 10.0-CURRENT __FreeBSD_version value ended at '55', so
start releng/10.0 at '100' so the branch is started with
a value ending in zero.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


253886 02-Aug-2013 jilles

find: Allow -delete to delete files given as arguments.

Formerly, a command like find dir1/dir2 -delete would delete everything
under dir1/dir2 but not dir1/dir2 itself.

When -L is not specified and "." can be opened, the fts(3) code underlying
find(1) is careful to avoid following symlinks or being dropped in different
locations by moving the directory fts is currently traversing. If a
problematic concurrent modification is detected, fts will not enter the
directory or abort. Files found in the search are returned via the current
working directory and a pathname not containing a slash.

For paranoia, find(1) verifies this when -delete is used. However, it is too
paranoid about the root of the traversal. It is already assumed that the
initial pathname does not refer to directories or symlinks that might be
replaced by untrusted users; otherwise, the whole traversal would be unsafe.
Therefore, it is not necessary to do the check for fts_level ==
FTS_ROOTLEVEL.

Deleting the pathnames given as arguments can be prevented without error
messages using -mindepth 1 or by changing directory and passing "." as
argument to find. This works in the old as well as the new version of find.

Tested by: Kurt Lidl
Reviewed by: jhb


249657 19-Apr-2013 ed

Add the Clang specific -Wmissing-variable-declarations to WARNS=6.

This compiler flag enforces that that people either mark variables
static or use an external declarations for the variable, similar to how
-Wmissing-prototypes works for functions.

Due to the fact that Yacc/Lex generate code that cannot trivially be
changed to not warn because of this (lots of yy* variables), add a
NO_WMISSING_VARIABLE_DECLARATIONS that can be used to turn off this
specific compiler warning.

Announced on: toolchain@


248446 17-Mar-2013 jilles

find: Include nanoseconds when comparing timestamps of files.

When comparing to the timestamp of a given file using -newer, -Xnewer and
-newerXY (where X and Y are one of m, c, a, B), include nanoseconds in the
comparison.

The primaries that compare a timestamp of a file to a given value (-Xmin,
-Xtime, -newerXt) continue to compare times in whole seconds.

Note that the default value 0 of vfs.timestamp_precision almost always
causes the nanoseconds part to be 0. However, touch -d can set a timestamp
to the microsecond regardless of that sysctl.

MFC after: 1 week


247730 03-Mar-2013 dwmalone

Add an option for finding sparse files.

Reviewed by: iedowse
MFC after: 3 weeks


246628 10-Feb-2013 jilles

find: Run when cwd cannot be opened, except with -execdir or -delete.

fts(3) can run (albeit more slowly and imposing the {PATH_MAX} limit) when
the current directory cannot be opened. Therefore, do not make a failure to
open the current directory (for returning to it later in -exec) fatal.

If -execdir or -delete are used, the expectation is that fts(3) will use
chdir to avoid race conditions (except for -execdir with -L). Do not break
this expectation any more than it already is by still failing if the current
directory cannot be opened.


246618 10-Feb-2013 jilles

find: In -execdir ... {} +, only pass one file per invocation.

This is inefficient but ensures that -execdir ... {} + does not mix files
from different directories in one invocation; the command could not access
some files. Files from the same directory should really be handled in one
invocation but this is somewhat more complicated.


243280 19-Nov-2012 eadler

Use .Nm instead of a self xref

Approved by: bcr (mentor)
MFC after: 1 week


243239 18-Nov-2012 eadler

Make it clear that amin and friends take + and - options.

PR: docs/173265
Submitted by: Anton Shterenlikht <mexas@bristol.ac.uk>
Approved by: bcr (mentor)
MFC after: 3 days


241015 27-Sep-2012 mdf

Fix usr.bin/ and usr.sbin/ build with a 64-bit ino_t.

Original code by: Gleb Kurtsou


240973 26-Sep-2012 jilles

find: Do not pass fd to save current directory to child processes.

This removes one of the two wrongly passed file descriptors. The other one
appears to be from fts(3).

MFC after: 1 week


240299 10-Sep-2012 des

Note that -quit terminates successfully.

Requested by: jmg@


240278 09-Sep-2012 des

Document -quit, four and a half years after it was implemented.

MFC after: 3 days
Pointy hat to: imp@


238948 31-Jul-2012 jilles

find: Remove unnecessary and inconsistent initialization.

Submitted by: jhb


238780 25-Jul-2012 jilles

find: Implement real -ignore_readdir_race.

If -ignore_readdir_race is present, [ENOENT] errors caused by deleting a
file after find has read its name from a directory are ignored.

Formerly, -ignore_readdir_race did nothing.

PR: bin/169723
Submitted by: Valery Khromov and Andrey Ignatov


237035 13-Jun-2012 jilles

find(1): Move description of -d option to -depth primary.

The nullary -depth primary is standard and the -d option provides little
advantage.

PR: docs/168885
MFC after: 1 week


236860 10-Jun-2012 issyl0

Add more description and clarification about the -depth and -d options in
both places where they are mentioned in find(1).

Discussed with: dougb
PR: docs/168885
Reported by: Ronald F. Guilmette (rfg at tristatelogic dot com)
Approved by: gabor (mentor)
MFC after: 3 days


236596 05-Jun-2012 eadler

Fix style nit: don't use leading zero for dates in .Dd

Prompted by: brueffer
Approved by: brueffer
MFC after: 3 days


236433 02-Jun-2012 eadler

Document the limitations of the -delete primary

PR: bin/166554
Submitted by: Richard Kettlewell <rjk@greenend.org.uk>
Discussed with: jilles
Approved by: bcr
MFC after: 3 days


235789 22-May-2012 bapt

Fix world after byacc import:
- old yacc(1) use to magicially append stdlib.h, while new one don't
- new yacc(1) do declare yyparse by itself, fix redundant declaration of
'yyparse'

Approved by: des (mentor)


233648 29-Mar-2012 eadler

Remove trailing whitespace per mdoc lint warning

Disussed with: gavin
No objection from: doc
Approved by: joel
MFC after: 3 days


233456 25-Mar-2012 joel

Remove superfluous paragraph macro.


228394 10-Dec-2011 ed

Replace char copyright[] by static const char copyright[].

It seems the latter is used throughout the tree.


225847 28-Sep-2011 ed

Get rid of major/minor number distinction.

As of FreeBSD 6, devices can only be opened through devfs. These device
nodes don't have major and minor numbers anymore. The st_rdev field in
struct stat is simply based a copy of st_ino.

Simply display device numbers as hexadecimal, using "%#jx". This is
allowed by POSIX, since it explicitly states things like the following
(example taken from ls(1)):

"If the file is a character special or block special file, the
size of the file may be replaced with implementation-defined
information associated with the device in question."

This makes the output of these commands more compact. For example, ls(1)
now uses approximately four columns less. While there, simplify the
column length calculation from ls(1) by calling snprintf() with a NULL
buffer.

Don't be afraid; if needed one can still obtain individual major/minor
numbers using stat(1).


223035 13-Jun-2011 avatar

Using statfs.f_fstypename rather than statfs.f_type whilst performing fstype
comparsion as nullfs will copy f_type from underlayer FS.

PR: bin/156258
Submitted by: Marcin Wisnicki <mwisnicki+freebsd@gmail.com>
MFC after: 1 month


222697 04-Jun-2011 jilles

find: Exit if there is an unknown option.

Ignoring the parameter with the unknown options is unlikely to be what was
intended.

Example:
find -n .

Note that things like
find -n
already caused an exit, equivalent to "find" by itself.


222390 27-May-2011 jilles

find: If a part of an expression is unknown, do not call it an option.

Although most of the primaries and operators start with "-", they are not
options.

Examples:
find . -xyz
find . -name xyz -or bad

MFC after: 1 week


219455 10-Mar-2011 gjb

Move the explanation of using arguments for the PRIMARIES above
the list of PRIMARIES.

PR: 151812
Submitted by: Jay (jouellette of gmail com)
Patch by: eadler
MFC after: 1 week


216370 11-Dec-2010 joel

Remove the advertising clause from UCB copyrighted files in usr.bin. This
is in accordance with the information provided at
ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change

Also add $FreeBSD$ to a few files to keep svn happy.

Discussed with: imp, rwatson


216106 02-Dec-2010 kevlo

Don't error out while searching for empty directories.

Submitted by: Bakul Shah <bakul at bitblocks dot com>


207705 06-May-2010 delphij

Revert r207677 which is considered a violation of style(9).

Pointed out by: bde
Pointy hat to: delphij


207677 05-May-2010 delphij

Move SCCS tags to comments as they were already #if 0'ed.


205233 16-Mar-2010 pjd

Better way to find out available file system types is to use lsvfs(1).
Using 'sysctl vfs' is not only ugly, but is also not reliable - not all
file system types create entries in vfs sysctl tree.

Reviewed by: imp
MFC after: 1 week


203865 14-Feb-2010 gavin

The -newerXB option was being interpreted the same as the -newerXm option
as a check for F_TIME2_B was missing. Fix this.

PR: bin/138245
Submitted by: "David E. Cross" <crossd cs.rpi.edu>
MFC after: 1 month


203747 10-Feb-2010 ed

Remove unneeded CFLAGS.


203723 09-Feb-2010 ed

Don't let find(1) depend on struct timeb.

This structure is deprecated and only used by ftime(2), which is part of
libcompat. The second argument of get_date() is unused, which means we
can just remove it entirely.


201386 02-Jan-2010 ed

Build usr.bin/ with WARNS=6 by default.

Also add some missing $FreeBSD$ to keep svn happy.


201227 29-Dec-2009 ed

ANSIfy almost all applications that use WARNS=6.

I was considering committing all these patches one by one, but as
discussed with brooks@, there is no need to do this. If we ever
need/want to merge these changes back, it is still possible to do this
per application.


200462 13-Dec-2009 delphij

Revert most part of 200420 as requested, as more review and polish is
needed.


200420 11-Dec-2009 delphij

Remove unneeded header includes from usr.bin/ except contributed code.

Tested with: make universe


197363 20-Sep-2009 jilles

Update find(1) man page for -L/-delete interaction.

It is a bit unfortunate that the example to delete broken symlinks now uses
rm(1), but allowing this with -delete would require fixing fts(3) to not
imply FTS_NOCHDIR if FTS_LOGICAL is given (or hacks in the -delete option).

PR: bin/90687
MFC after: 2 weeks


196839 04-Sep-2009 trasz

Add NFSv4 ACL support to find(1).

Reviewed by: rwatson


193087 30-May-2009 jilles

rm, find -delete: fix removing symlinks with uchg/uappnd set.

Formerly, this tried to clear the flags on the symlink's target
instead of the symlink itself.

As before, this only happens for root or for the unlink(1) variant of rm.

PR: bin/111226 (part of)
Submitted by: Martin Kammerhofer
Approved by: ed (mentor)
MFC after: 3 weeks


192381 19-May-2009 avg

find: do not silently disable -L when -delete is used

First of all, current behavior is not documented and confusing,
and it can be very dangerous in the following sequence:
find -L . -type l
find -L . -type l -delete
(the second line is even suggested by find(1)).

Instead simply refuse to proceed when -L and -delete are both used.
A descriptive error message is provided.
The following command can be safely used to remove broken links:
find -L . -type l -print0 | xargs rm -0

To do: update find(1)
PR: bin/90687
Obtained from: Anatoli Klassen <anatoli@aksoft.net>
Approved by: jhb (mentor)


176761 03-Mar-2008 ru

Fix SYNOPSIS and usage().


176532 24-Feb-2008 ceri

Bump .Dd for revisions 1.83 and 1.84.


176531 24-Feb-2008 imp

Tag -ilname and -lname as GNU extensions.
Correct their descriptions to indicate that it is the contents of the
symbolic link that are matched.


176497 24-Feb-2008 imp

The matching in -lname and -ilname are on the contents of the link
itself, not on the type of the file. As such, do a readlink to get
the symbolic link's contents and fail to match if the path isn't a
symbolic link.

Pointed out by: des@


176478 23-Feb-2008 imp

Implement a number of primaries present in GNU find, but not present
in our find.

The following are nops because they aren't relevant to our find:
-ignore_readdir_race
-noignore_readdir_race
-noleaf
The following aliaes were created:
-gid -> -group [2]
-uid -> -user [2]
-wholename -> -path
-iwholename -> ipath
-mount -> -xdev
-d -> -depth [1]
The following new primaries were created:
-lname like -name, but matches symbolic links only)
-ilname like -lname but case insensitive
-quit exit(0)
-samefile returns true for hard links to the specified file
-true Always true
I changed one primary to match GNU find since I think our use of it violates
POLA
-false Always false (was an alias for -not!)

Also, document the '+' modifier for -execdir, as well as all of the above.
This was previously implemented.

Document the remaining 7 primaries that are in GNU find, but aren't yet
implemented in find(1)

[1] This was done in GNU find for compatibility with FreeBSD, yet they
mixed up command line args and primary args.

[2] -uid/-gid in GNU find ONLY takes a numeric arg, but that arg does the
normal range thing that. GNU find -user and -uid also take a numberic arg,
but don't do the range processing. find(1) does both for -user and -group,
so making -uid and -gid aliases is compatible for all non-error cases used
in GNU find. While not perfect emulation, this seems a reasonable thing
for us.


167102 28-Feb-2007 ru

Check in some insignificant fixes obtained as a result of
the translation work.


165179 13-Dec-2006 ru

Fix the description of the -Btime primary.

Noticed by: Vadim Goncharov <vadimnuclight tpu.ru>


163125 08-Oct-2006 ceri

Update the list of POSIX extensions.

PR: docs/103859
Submitted by: shaun
MFC after: 1 week


162792 29-Sep-2006 ru

Markup fixes.


160466 18-Jul-2006 stefanf

Document that the pathname(s) following the options need not be given if
-f pathname was specified.


158986 27-May-2006 krion

Add the capability for a trailing scale indicator to cause the
specified size to be read in the more familiar units of kilobytes,
megabytes, gigabytes, terabytes and petabytes.

PR: bin/50988
Submitted by: Matthew Seaman <m.seaman@infracaninophile.co.uk>
MFC after: 7 days


158919 25-May-2006 krion

Enable numeric arguments and +/- prefixes with -user (-group)
options.

PR: bin/71513
Submitted by: Andre Albsmeier <Andre.Albsmeier@siemens.com>
MFC after: 7 days


158572 14-May-2006 krion

The last execution of -exec {} + is not done if the -exec primary is
not on the top-level -and sequence, e.g. inside of ! or -or.

Create a separate linked list of all active -exec {} + primaries and
do the last execution for all at termination.

PR: bin/79263
Submitted by: Jilles Tjoelker <jilles@stack.nl>
MFC after: 7 days


157555 05-Apr-2006 ceri

Fix options broken when the birthtime related primaries were added.

Note to self: if a comment says a list must be lexically sorted, sort
the list lexically.

Submitted by: Pawel Worach
Approved by: jhb
MFC after: 2 weeks


157472 04-Apr-2006 ceri

Note that all of the birthtime related primaries are non-standard.


157441 03-Apr-2006 ceri

Bump .Dd for the birthtime options.


157440 03-Apr-2006 ceri

Add -Btime, -Bnewer, -Bmin, -newerB[Bacmt], -newer[acmt]B options to
work with the st_birthtime field of struct stat.

'B' has been chosen to match the format specifier from stat(1).

Approved by: jhb
MFC after: 2 weeks


149453 25-Aug-2005 roberto

Fixes for gcc4.x.

Submitted by: Divacky Roman <xdivac02@stud.fit.vutbr.cz>
PR: bin/84991


147370 14-Jun-2005 ru

Markup and wording fixes.

Approved by: re (blanket)


144526 02-Apr-2005 tjr

Use rpmatch() instead of checking for responses that begin with 'y'
in queryuser(). This allows users to respond to -ok and -okdir
prompts with any affirmative reply defined by their current locale.


140810 25-Jan-2005 ssouhlal

- Make find(1) WARNS?= 6 clean
- Bump to WARNS?= 6

Approved by: stefanf, grehan (mentor)


140055 11-Jan-2005 ru

Scheduled mdoc(7) sweep.


132815 29-Jul-2004 tjr

Change the 'no terminating ";"' error message to 'no terminating ";" or "+"'
since + is also a valid way to terminate -exec.


132814 29-Jul-2004 tjr

Remove partial support for building this on NetBSD.


132813 29-Jul-2004 tjr

Now that fnmatch() supports multibyte characters, find does too; remove
entry from BUGS section that said otherwise.


132709 27-Jul-2004 cperciva

Start new sentence on new line.

Pointed out by: simon


132707 27-Jul-2004 cperciva

Add a BUGS entry pointing out that -mindepth and -maxdepth are global
options even though they look like primaries. (This is already documented
in the options themselves, but is sufficiently astonishing that I think it
deserves a BUGS entry as well.)


132706 27-Jul-2004 cperciva

Merge the "multibyte not supported" BUG into the pre-existing BUGS
section.

Move the HISTORY section to place it before BUGS rather than after BUGS,
in order to minimize the chance of this error being reproduced in the
future. (Both mdoc(7) and 63% of manual pages have these sections listed
in this order.)


131754 07-Jul-2004 ru

mdoc(7) fixes.


131511 03-Jul-2004 tjr

Document missing multibyte character support in utilities specified
by POSIX.


131509 03-Jul-2004 tjr

Re-add half of UCB copyright notice that went missing in 1.20.


129812 28-May-2004 eik

- introduce a new primary `-depth n', which tests whether
the depth of the current file relative to the starting
point of the traversal is n. The usual +/- modifiers
to the argument apply.

- while I'm here, fix -maxdepth in the case of a depth-first
traversal

Print the top ten maintainers of python module ports
(works with p5-* too):

find /usr/ports -depth 2 \! -name 'py-*' -prune -o \
-depth 3 -name Makefile -execdir make -VMAINTAINER \; \
| sort | uniq -c | sort -nr | head

PR: 66667
Reviewed by: ru, joerg
Approved by: joerg
MFC after: 2 weeks


129428 19-May-2004 ru

Bumped document date.
Fixed a bunch of hyphen misspellings.
Fixed one warning.


129273 16-May-2004 eik

snafu, exchanged the descriptions of -maxdepth and -mindepth.

Noticed by: ru


129211 14-May-2004 eik

-maxdepth and -mindepth are global variables

PR: 66613
Approved by: ru
MFC after: 3 days


128505 21-Apr-2004 des

Clarify and correct some compatibility notes.

PR: 65822


128010 07-Apr-2004 trhodes

Add -acl and a small blurb about it to the options list.
Update date.


127796 03-Apr-2004 bmilekic

Give find(1) the option -acl to locate files with extended
ACLs. This is similar to what ls(1) can do. It is handy to
have it so that it can be used in conjunction with
"-exec setfacl {} \;" (to find(1)), among others.

This is the submitter's patch, but slightly modified.

PR: bin/65016
Submitted by: Christian S.J. Peron <maneo@bsdpro.com>


126331 27-Feb-2004 trhodes

Update the find manual page:

1: Document -follow under COMPATIBILITY.
2: Update an example to be a little more 'safe'.
3: Use '/' in place of '.' for an example; similar to other manual pages.

PR: 40196 (1), 39532 (2, 3)
Submitted by: Marc Silver <marcs@draenor.org> (2 and 3)
Discussed with: des (1)


126158 23-Feb-2004 des

Typo.


124746 20-Jan-2004 des

Use a larger field for the size in blocks; the current width (4 digits)
is only good for 5 MB.


118021 25-Jul-2003 schweikh

State that in -exec ... ; the semicolon should be quoted if invoked from
a shell.

PR: docs/54667
Submitted by: Patrick Alken <pa59@cornell.edu>
MFC after: 3 days


116333 14-Jun-2003 markm

Fix all WARNS. Checked with "make WARNS=9". Remove unused file.


111084 18-Feb-2003 des

Correctly alphabetize options[] so we don't stop at -nouser when searching
for -not.

PR: bin/48423
Submitted by: Matsumura Naoki <matsu@jp.FreeBSD.org>
MFC after: 3 days


107788 12-Dec-2002 ru

Uniformly refer to a file system as "file system".

Approved by: re


107261 26-Nov-2002 ru

mdoc(7) police: markup polishing.

Approved by: re


103726 21-Sep-2002 wollman

Make the threatened fts(3) ABI fix. FTSENT now avoids the use of the struct
hack, thereby allowing future extensions to the structure (e.g., for extended
attributes) without rebreaking the ABI. FTSENT now contains a pointer to the
parent stream, which fts_compar() can then take advantage of, avoiding the
undefined behavior previously warned about. As a consequence of this change,
the prototype of the comparison function passed to fts_open() has changed
to reflect the required amount of constness for its use. All callers in the
tree are updated to use the correct prototype.

Comparison functions can now make use of the new parent pointer to access
the new stream-specific private data pointer, which is intended to assist
creation of reentrant library routines which use fts(3) internally.

Not objected to in spirit by: -arch


102498 27-Aug-2002 charnier

Do not repeat the name of the flag in its description


102083 19-Aug-2002 jmallett

Add a unary -not operator ala -false and !, for sake of completeness.

Obtained from: OpenDarwin
MFC after: 1 week


101932 15-Aug-2002 jmallett

Oops, add -false to the operators list in the manual page for find(1), as added
in revision 1.17 of option.c.

MFC after: 1 week


101931 15-Aug-2002 jmallett

Add support for -false instead of '!' cause it can be hard to use that in
some shells, etc., and also for GNU compatability (lack of this broke the
Mono CVS build for me).

MFC after: 1 week


101651 10-Aug-2002 mux

- Introduce a new struct xvfsconf, the userland version of struct vfsconf.
- Make getvfsbyname() take a struct xvfsconf *.
- Convert several consumers of getvfsbyname() to use struct xvfsconf.
- Correct the getvfsbyname.3 manpage.
- Create a new vfs.conflist sysctl to dump all the struct xvfsconf in the
kernel, and rewrite getvfsbyname() to use this instead of the weird
existing API.
- Convert some {set,get,end}vfsent() consumers to use the new vfs.conflist
sysctl.
- Convert a vfsload() call in nfsiod.c to kldload() and remove the useless
vfsisloadable() and endvfsent() calls.
- Add a warning printf() in vfs_sysctl() to tell people they are using
an old userland.

After these changes, it's possible to modify struct vfsconf without
breaking the binary compatibility. Please note that these changes don't
break this compatibility either.

When bp will have updated mount_smbfs(8) with the patch I sent him, there
will be no more consumers of the {set,get,end}vfsent(), vfsisloadable()
and vfsload() API, and I will promptly delete it.


100495 22-Jul-2002 robert

- Use MAXLOGNAME - 1 rather than UT_NAMESIZE.
- Remove the inclusion of <utmp.h>.


99905 13-Jul-2002 tjr

Account for space used by environment variables in a similar way to
xargs(1) when handling -exec ... {} + constructions.


98863 26-Jun-2002 tjr

Indicate that the semicolon that terminates argument lists should be in
its own argument for -ok and -okdir.


98862 26-Jun-2002 tjr

Make it more obvious that the semicolon that terminates -exec and -execdir
argument lists must be in an argument by itself, not on the end of the
previous one.


97736 02-Jun-2002 tjr

Support the SysV-style -exec utility args.. {} + function, required by
SUSv3. This is similar to find foo -print0 | xargs -0 utility args.


97496 29-May-2002 ru

mdoc(7) police: markup nits.


96785 17-May-2002 jmallett

Clean up malloc(3)'s argument. Remove casts which do nothing when we're
using sizeof() anyway. Use slightly more consistent (per-file) error
reporting for malloc(3) returning NULL. If "malloc failed" was being printed,
don't use err(3). If a NULL format is being used, use err(3). In one case
errx(3) was being used with strerror(3), so just use err(3).


96704 16-May-2002 trhodes

More consistancy. file system > filesystem


95124 20-Apr-2002 charnier

Use `The .Nm utility'


94792 15-Apr-2002 obrien

Fix to WARNS=2 level.

Tested by: AXP gcc 3.1


94630 14-Apr-2002 obrien

Clean up the 1/2 a** committing from Thu, 3 May 2001 11:05:39 -0700 (PDT).
Since then we have living with a GPL'ed find(1) due to grabbing getdate.y
from src/contrib/cvs and its user of the GPL'ed xtime.h. I don't even want
to think about how this could have affected people using our source base.

Would it have been too much trouble to do then what I did now?
Copied getdate.y (public domain) to usr.bin/find and change to use
standard system headers. find(1) now compiles simply with out having
to go to extra effort to do so.

Pointed hat to: phk
Build fixed on: gcc 3.1 using platforms


94558 12-Apr-2002 charnier

Replace err() with errx(), errno is garbage in this context.


94366 10-Apr-2002 trhodes

find.1 does not encourage users to DTRT when piping to xargs(1)

PR: 36602
Submitted by: Joshua Goodall <joshua@roughtrade.net>
No objections from: ru
MFC after: 2 days


93644 02-Apr-2002 markm

There is breakage in parsedate, so revert to get_date until this can be
resolved.

Reported by: paul


93628 02-Apr-2002 jmallett

Fix find -exec with no command specified (i.e.: find . -exec ';')

PR: bin/36521
Submitted by: Simon 'corecode' Schubert <corecode@corecode.ath.cx>
Reviewed by: mike
MFC after: 3 days


93604 01-Apr-2002 obrien

Fix SCM IDs.


93603 01-Apr-2002 obrien

Allow to compile a YACC produced file with GCC 3.1 (which has different
header searching rules for generated files with #line).


93528 01-Apr-2002 keramida

Run find.1 through ispell.

PR: docs/36601
Submitted by: Joshua Goodall <joshua@roughtrade.net>
MFC after: 3 days


93425 30-Mar-2002 dwmalone

Change a "/*" within a comment to a "**".
Add a missing include spotted by gcc30.


93212 26-Mar-2002 charnier

spelling


92904 21-Mar-2002 markm

Restructure for own parsedate (replacement for get_date from CVS).

Fix up parsedate.y for WARNS=4.

Reviewd by: bde (except for parsedate.y diffs)


92897 21-Mar-2002 markm

Add a replacement for get_date which is currently being dug out of
CVS's sources.

This is a "public domain" implementation stolen from INN, and is
added unmodified.


92788 20-Mar-2002 markm

For the sake of consistency, remove an include that is included in
a previous include. All other files in this app do this.


92786 20-Mar-2002 markm

Remove __P().


91400 27-Feb-2002 dwmalone

1) Remove -Wall from Makefile.
2) WARNs fixes (rename option to lookup_option to avoid shadowing, rename
argv to argv1 to avoid shadowing, const stuff, prototypes, __unused).
3) Remove "register"s.


90878 19-Feb-2002 imp

Fixed divots that I created when I moved prototypes of group_from_gid
and user_from_uid to grp.h and pwd.h. Update the man pages.

Submitted by: David Malone
Pointy hat to: imp


86674 20-Nov-2001 ru

Add a missing comma.


84595 06-Oct-2001 obrien

Document -depth


83451 14-Sep-2001 ru

Simplify f_Xtime().


83450 14-Sep-2001 ru

Bloat find(1) even more, and introduce the concept
of time units to be used with -[acm]time primaries.

Based on patch from Nils M Holm <nmh@t3x.org>.

PR: bin/29165, bin/30309


82972 04-Sep-2001 ru

The implementation of -flags was broken and did not match the (poorly)
documented behavior. Only a certain set of file flags were recognized,
and "no" flags did not match files that have corresponding flags bits
turned off.

Fix and extend the -flags functionality as follows:

: -flags [-|+]<flags>,<notflags>
: The flags are specified using symbolic names (see chflags(1)).
: Those with the "no" prefix (except "nodump") are said to be
: <notflags>. Flags in <flags> are checked to be set, and flags in
: <notflags> are checked to be not set. Note that this is different
: from -perm, which only allows the user to specify mode bits that
: are set.
:
: If flags are preceded by a dash (``-''), this primary evaluates
: to true if at least all of the bits in <flags> and none of the bits
: in <notflags> are set in the file's flags bits. If flags are pre-
: ceded by a plus (``+''), this primary evaluates to true if any of
: the bits in <flags> is set in the file's flags bits, or any of the
: bits in <notflags> is not set in the file's flags bits. Otherwise,
: this primary evaluates to true if the bits in <flags> exactly match
: the file's flags bits, and none of the <flags> bits match those of
: <notflags>.

MFC after: 2 weeks


82662 31-Aug-2001 ru

Sort predicates.

PR: docs/30237


82569 30-Aug-2001 ru

Restore the `-perm +mode' feature.

Broken in the "close a PR" race, in revision 1.30.
Note that the patch in the PR did not have this bug!


80291 24-Jul-2001 obrien

Remove emalloc and expand to the malloc + error checking it was, where used.


80235 23-Jul-2001 obrien

Quiet a [useless] compiler warning.


78966 29-Jun-2001 yar

Clarify the feature that -exec parameters won't get
shell-expanded when the specified utility is run.

MFC after: 5 days


76681 16-May-2001 ru

mdoc(7) police: fix markup.


76250 03-May-2001 phk

They add the following commands:
-anewer
-cnewer
-mnewer
-okdir
-newer[acm][acmt]

With it, you can form queries like

find . -newerct '1 minute ago' -print

As an extra bonus, the program is ANSI-fied - the original version
relies on some obscure features of K&R C.

(This PR was submitted in 1999, and the submittor has kept the patch
updated ever since, hats off for him guys, and how about you close a PR ??)

PR: 9374
Submitted by: Martin Birgmeier <Martin.Birgmeier@aon.at>


74584 21-Mar-2001 ache

Don't attempt to parse %c, use nl_langinfo instead


73258 01-Mar-2001 imp

MAXPATHLEN already accounts for the trailing NUL, so no need to add one in.
In addition, since we pass readlink MAXPATHLEN - 1, we would have never have
used that extra byte anyway.


72974 24-Feb-2001 ru

mdoc(7) police: restore correct order of references in the SEE ALSO.


72945 23-Feb-2001 knu

Implement the following options and primaries:

-E Interpret regular expressions followed by -regex and -iregex op-
tions as extended (modern) regular expressions rather than basic
regular expressions (BRE's). The re_format(7) manual page fully
describes both formats.

-iname pattern
Like -name, but the match is case insensitive.

-ipath pattern
Like -path, but the match is case insensitive.

-regex pattern
True if the whole path of the file matches pattern using regular
expression. To match a file named ``./foo/xyzzy'', you can use
the regular expression ``.*/[xyz]*'' or ``.*/foo/.*'', but not
``xyzzy'' or ``/foo/''.

-iregex pattern
Like -regex, but the match is case insensitive.

These are meant to be compatible with other find(1) implementations
such as GNU's or NetBSD's except regexp library differences.

Reviewed by: sobomax, dcs, and some other people on -current


71895 01-Feb-2001 ru

mdoc(7) police: split punctuation characters + misc fixes.


71422 23-Jan-2001 peter

Add the -empty flag, from OpenBSD. It returns true if the directory
is empty. There doesn't appear to be another easy way to do this.

mobile# mkdir foo
mobile# mkdir foo/bar
mobile# mkdir bar
mobile# find . -empty
./foo/bar
./bar


71102 16-Jan-2001 ru

Prepare for mdoc(7)NG.


70197 19-Dec-2000 ru

Prepare for mdoc(7)NG.


68963 20-Nov-2000 ru

mdoc(7) police: use the new features of the Nm macro.


68866 17-Nov-2000 mph

"minute(s) period(s)" --> "minute(s)"


63969 28-Jul-2000 eivind

Make passing unknown fstypes to -fstype result in a warning instead of
an error. As it was, which find command lines that would work (be
accepted at all) was dependent on the presently running kernel, making
script writing and porting hard.


61749 17-Jun-2000 joe

Switch over to using the new fflagstostr and strtofflags library calls.


61651 14-Jun-2000 roberto

Make find -Wall -Wredundant-decls clean.

Submitted by: nrahlstr


61575 12-Jun-2000 roberto

This patch adds the -mindepth and -maxdepth options to find(1), which
behave as in GNU find (and of course as described in the manual page
diff included). I think these options would be useful for some people.

Some missing $FreeBSD$ tags are also added.

The patch was slightly modified (send-pr mangling of TABS).

PR: bin/18941
Submitted by: Ben Smithurst <ben@scientia.demon.co.uk>


61573 12-Jun-2000 roberto

The find -perm option currently supports an exact match,
or if the mode is preceded by a '-', it checks for a match
in at least the bits specified on the command line. It is
often desirable to find things with any execute or setuid or
setgid bits set.

PR: bin/10169
Submitted by: Monte Mitzelfelt <monte@gonefishing.org>


57666 01-Mar-2000 nik

Fix errors in .Xr usage.

PR: docs/17057
Submitted by: Submitted by: Udo Erdelhoff <ue@nathan.ruhr.de>


57003 05-Feb-2000 joe

Revert part of the last commit, remove {g|s}etflags from the libc
interface, and statically link them to the programs using them.
These functions, upon reflection and discussion, are too generically
named for a library interface with such specific functionality.
Also the api that they use, whilst ok for private use, isn't good
enough for a libc function.

Additionally there were complications with the build/install-world
process. It depends heavily upon xinstall, which got broken by
the change in api, and caused bootstrap problems and general mayhem.

There is work in progress to address future problems that may be
caused by changes in install-chain tools, and better names for
{g|s}etflags can be derived when some future program requires them.
For now the code has been left in src/lib/libc/gen (it started off
in src/bin/ls).

It's important to provide library functions for manipulating file
flag strings if we ever want this interface to be adopted outside
of the source tree, but now isn't necessarily the right moment
with 4.0-release just around the corner.

Approved: jkh


56692 27-Jan-2000 joe

Historically file flags (schg, uschg, etc) have been converted from
string to u_long and back using two functions, flags_to_string and
string_to_flags, which co-existed with 'ls'. As time has progressed
more and more other tools have used these private functions to
manipulate the file flags.

Recently I moved these functions from /usr/src/bin/ls to libutil,
but after some discussion with bde it's been decided that they
really ought to go in libc.

There are two already existing libc functions for manipulating file
modes: setmode and getmode. In keeping with these flags_to_string
has been renamed getflags and string_to_flags to setflags.

The manual page could probably be improved upon ;)


55302 01-Jan-2000 joe

Added missing DPADD's. Removed unrequired SRCS's.

Obtained from: bde


55270 30-Dec-1999 joe

Moved flags_to_string and string_to_flags into libutil. It's used in
many places nowadays.


54828 19-Dec-1999 roberto

Second part of bin/3648: add -flags to search for specific flags.
I added $FreeBSD$ whicle I was here. The patch wasn't usable anymore
due to its age so I adapted it.

PR: bin/3648
Submitted by: Martin Birgmeier <mbirg@austria.ds.philips.com>


51037 06-Sep-1999 billf

-Wall: remove unused variable, initialize variable to avoid gcc stupidity.


50477 28-Aug-1999 peter

$Id$ -> $FreeBSD$


47776 06-Jun-1999 kris

The -perm option takes argument [-]mode, not [-mode]

Obtained from: NetBSD, by way of OpenBSD


45809 19-Apr-1999 jkoshy

Clarify wording to indicate that the arguments to find(1) are path names
(and can be both files or directories). Show white space between
"(", ")", "!" and their corresponding `expression' arguments as
expected by the expression parser inside find(1).

Prompted by: David Honig <David.Honig@idt.com> on freebsd-doc
Message-Id: <199904132055.NAA09432@justinian.Eng.idt.com>


42212 31-Dec-1998 billf

Typo - "the -delete primary do not.." -> "the -delete primary does not.."

PR: docs/9255
Submitted by: Christian Weisgerber <naddy@bigeye.rhein-neckar.de>


41846 16-Dec-1998 imp

Return memory from setmode.

Obtained from: OpenBSD


41406 29-Nov-1998 bde

Fixed style bugs in previous commit.


41402 29-Nov-1998 bde

Fixed English in previous commit. Clarify "lexicographical order".
Don't format paragraphs manually (new sentences not beginning on new
lines give hard-formatted line breaks).


41399 29-Nov-1998 bde

Fixed my English fixes.


41398 29-Nov-1998 bde

Fixed style bugs and English in previous commit.


41397 29-Nov-1998 bde

Fixed disorder and and usage message. Improved English.

Broken in: previous commit


41396 29-Nov-1998 bde

Fixed disordering in previous commit.


41391 29-Nov-1998 wosch

Added a sort option to find(1).

The sort option make it possible to build the locate
database without large (usually 20-100MB) temp files.


40301 13-Oct-1998 des

Calls one or more of malloc(), warn(), err(), syslog(), execlp() or
execvp() in the child branch of a vfork(). Changed to use fork()
instead.

Some of these (mv, find, apply, xargs) might benefit greatly from
being rewritten to use vfork() properly.

PR: Loosely related to bin/8252
Approved by: jkh and bde


38223 10-Aug-1998 thepish

PR: 7522
Correct bug in the inverse operator optimisation code which caused segv
on ! without a following expression.


37453 06-Jul-1998 bde

Fixed printf format errors.


36787 09-Jun-1998 imp

Make sure we pass the length - 1 to readlink, since it adds its own
NUL at the end of the path.

Inspired by: OpenBSD's changes in this area by theo de raadt


36057 15-May-1998 jkoshy

Add cross references for find(1), locate(1), whereis(1) and which(1).

Submitted by: Josh Gillam <josh@quick.net>
PR: docs/6642


32645 20-Jan-1998 bde

Removed definition of _NEW_VFSCONF. The new vfsconf interface is now
the default.


32402 10-Jan-1998 jb

A partial frontal lobotomy for find if using the NetBSD libc which
doesn't know about getvfsbyname() and the vfsconf structure. This
disables the -fstype option if compiled with a pre-processor that
defines __NetBSD__. With the FreeBSD built pre-processor, find can only
be built with the FreeBSD libc. So when running with a NetBSD kernel,
FreeBSD's libc will have to return ENOSYS for things that NetBSD
doesn't support. That's life in a hybrid world.


31440 28-Nov-1997 steve

Sort option list so that -amin works.

PR: 5171
Submitted by: Dmitrij Tejblum <tejblum@arc.hq.cti.ru>


30781 27-Oct-1997 steve

Better wording explaining that all single character options
are extensions along with the previous list of primaries.

Suggested by: bde


30759 27-Oct-1997 steve

Offending statement removed from STANDARDS section. From what I
can gather from the Posix spec that I have (which is very old)
all one character options are extensions to Posix.

PR: docs/4701


30395 13-Oct-1997 wosch

Add the primaries -mmin, -amin, -cmin to find, similar to the GNU find.


28914 29-Aug-1997 imp

Add -execdir which will execute the exec command in the dir of the file
in question. This change and the fts changes should be merged into 2.2-stable
as soon as they are vetted in -current. This should allow cleaning of files
in /tmp to be reneabled.
Obtained from: OpenBSD


25942 19-May-1997 jdp

Eliminate a variable that is set but never used.


25941 19-May-1997 jdp

Mention that "-P" is the default.


25932 19-May-1997 eivind

`it's'' -> `its'' where appropriate and typo fixes in time2posix.3.

Closes PR docs/3612.

Submitted by: Josh Gilliam <soil@quick.net>


25395 02-May-1997 max

Minor typo.
PR: 3472
Submitted by: Josh Gilliam <soil@quick.net>


24360 29-Mar-1997 imp

compare return value from getopt against -1 rather than EOF, per the final
posix standard on the topic.


24313 27-Mar-1997 peter

Fix "-fstype local" that was broken by another bugfix in the Lite2 merge.

Submitted by: Dmitrij Tejblum <dima@tejblum.dnttm.rssi.ru>, PR#3076


23695 11-Mar-1997 peter

Merge from Lite2 - use new getvfsbyname() and related changes.
understand whiteouts (FTS_W from fts()).


23614 10-Mar-1997 joerg

Fix a gross bug in the ! operator optimization code. The following
kind of expressions caused a dereferencation of an uninitialized malloc
area, yielding wrong expression evaluation at best, and core dumps at
worst (malloc.conf -> AJ):

find ... ! \( expr1 ! expr2 \) ...


23012 22-Feb-1997 peter

Revert $FreeBSD$ to $Id$


22066 28-Jan-1997 wosch

The option "fstype" does not handle the argument "msdos" correctly.
This error results from changing the name for the msdos file system
from "pcfs" to "msdos". Close PR #1105

submitted by: Thomas Wintergerst <thomas@lemur.nord.de>,
Slaven Rezic <eserte@cs.tu-berlin.de>


21673 14-Jan-1997 jkh

Make the long-awaited change from $Id$ to $FreeBSD$

This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore. This update would have been
insane otherwise.


18720 05-Oct-1996 peter

With -delete, don't complain about non-empty directories. Otherwise
"cd /tmp; find . -mtime +7 -delete" is excessively noisy.


18713 05-Oct-1996 peter

For the -delete option, emulate the behavior of "rm -f" when dealing with
user-immutable files.

Requested by: ache


18681 04-Oct-1996 peter

Implement a -delete option to find. The code is extremely paranoid and
goes to a fair degree of trouble to enable something like this to
be safe: cd /tmp && find . -mtime +7 -delete

It removes both files and directories. It does not attempt to remove
immutable files (an earlier version I showed to a few people did a chflags
and tried to blow away even immutable files. Too risky..)

It is thought to be safe because it forces the fts(3) driven descent to
only do "minimal risk" stuff. specifically, -follow is disabled, it does
checking to see that it chdir'ed to the directory it thought it was
going to, it will *not* pass a pathname with a '/' character in it to
unlink(), so it should be totally immune to symlink tree races. If it runs
into something "fishy", it bails out rather than blunder ahead.. It's better
to do that if somebody is trying to compromise security rather than risk
giving them an opportunity. Since the unlink()/rmdir() is being called
from within the current working directory during the tree descent, there
are no fork/exec overheads or races.

As a side effect of this paranoia, you cannot do a
"find /somewhere/dir -delete", as the last argument to rmdir() is
"/somewhere/dir", and the checking won't allow it. Besides, one would use
rm -rf for that case anyway. :-)

Reviewed by: pst (some time ago, but I've removed the immutable file
deletion code that he complained about since he last saw it)


17891 29-Aug-1996 wosch

[HISTORY] command appeared in Version 1 AT&T UNIX
Obtained from: A Quarter Century of UNIX, Peter H. Salus, page 41


17534 12-Aug-1996 ache

Localize it


15102 07-Apr-1996 bde

Use strtoq() instead of strtol() so that large inums, and sizes can be
specified.

Not fixed: specification of large uids and gids; silent truncation of
unrepresentable values.


11538 16-Oct-1995 wollman

Don't use printf() for simple strings because it is slow. Closes PR 783.

Submitted by: Wolfram Schneider <wosch@freebsd.first.gmd.de>


10704 12-Sep-1995 nate

Simpler fix to the find bug reported by Terry Lambert <terry@lambert.org>

[ Find to a file vs. to stdout ] produces different output because find
does not flush stdout when doing a -print.

Submitted by: Jeffrey Hsu <hsu@freefall.freebsd.org>


9987 07-Aug-1995 wollman

Delete bogus referneces to timezone code internal header file `tzfile.h',
which is no longer bogusly installed in /usr/include.


8874 30-May-1995 rgrimes

Remove trailing whitespace.


8389 09-May-1995 wollman

Add GNU-style `-print0' primary. This exists so that one can safely
do `find some-nasty-expression -print0 | perl -n0e unlink' and have all
the files actuallly get deleted. (Using `xargs' and `rm' is not safe.)


6776 27-Feb-1995 guido

Fix completely broken find behaviour:
a find -foo -o -bar would behave like find -bar. The same for -a
This broke (among others) ./etc/security.

Obtained from: NetBSD


1591 27-May-1994 rgrimes

This commit was generated by cvs2svn to compensate for changes in r1590,
which included commits to RCS files with non-trunk default branches.