summaryrefslogtreecommitdiffstats
path: root/usr.bin/find
Commit message (Collapse)AuthorAgeFilesLines
* Add META_MODE support.sjg2015-06-131-0/+20
|\ | | | | | | | | | | | | | | | | | | | | Off by default, build behaves normally. WITH_META_MODE we get auto objdir creation, the ability to start build from anywhere in the tree. Still need to add real targets under targets/ to build packages. Differential Revision: D2796 Reviewed by: brooks imp
| * dirdeps.mk now sets DEP_RELDIRsjg2015-06-081-2/+0
| |
| * Merge sync of headsjg2015-05-271-1/+1
| |\ | |/ |/|
| * Merge from head@274682sjg2014-11-191-1/+1
| |\
| * | Updated dependenciessjg2014-05-161-1/+0
| | |
| * | Updated dependenciessjg2014-05-101-0/+2
| | |
| * | Merge headsjg2014-04-285-16/+59
| |\ \
| * \ \ Merge from headsjg2013-09-052-1/+4
| |\ \ \
| * \ \ \ sync from headsjg2013-04-126-24/+83
| |\ \ \ \
| * | | | | Updated dependenciessjg2013-03-111-0/+1
| | | | | |
| * | | | | Updated dependenciessjg2013-02-161-2/+0
| | | | | |
| * | | | | Sync with HEAD.obrien2013-02-081-11/+31
| |\ \ \ \ \
| | \ \ \ \ \
| | \ \ \ \ \
| | \ \ \ \ \
| | \ \ \ \ \
| *---. \ \ \ \ \ Sync from headsjg2012-11-047-39/+77
| |\ \ \ \ \ \ \ \
| * | | | | | | | | Sync FreeBSD's bmake branch with Juniper's internal bmake branch.marcel2012-08-221-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Requested by: Simon Gerraty <sjg@juniper.net>
* | | | | | | | | | find.1: Add missing whitespace:eadler2015-04-201-1/+1
| |_|_|_|_|_|_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | Obtained from: Dragonfly (dee38d02d51cc8316f82b0263158d2546f2398bc)
* | | | | | | | | Correct scale factor for T terabyte suffixemaste2014-10-081-1/+1
| |_|_|_|_|_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PR: 194250 MFC after: 3 days Sponsored by: The FreeBSD Foundation
* | | | | | | | Avoid double free in f_acl().brueffer2014-04-131-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | CID: 1018508 Found with: Coverity Prevent(tm) MFC after: 1 week
* | | | | | | | find: Return normal exit status from -quit.jilles2014-04-132-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If there was an error, make the exit status reflect this even if -quit caused the exit. Formerly, -quit always caused exit(0). GNU find does the same.
* | | | | | | | find: Correctly propagate -exec/-execdir ... {} + exit status.jilles2014-04-125-7/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As per POSIX, the -exec ... {} + primary always returns true, but a non-zero exit status causes find to return a non-zero exit status itself. GNU does the same, and also for -execdir ... {} +. It does not make much sense to return false from the primary only when the child process happens to be run. The behaviour for -exec/-execdir ... ; remains unchanged: the primary returns true or false depending on the exit status, and find's exit status is unaffected.
* | | | | | | | find: Treat errno from fts_read() more carefully.jilles2014-04-061-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fts_read() leaves errno unchanged on EOF and sets it on error, so set errno to 0 before calling it. Also, don't trust finish_execplus() to leave errno unchanged.
* | | | | | | | find: When performing -quit, finish pending -exec ... + command lines.jilles2014-03-161-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This avoids unexpected partial processing when a find command uses both -quit and -exec ... +. GNU find does the same. MFC after: 1 week
* | | | | | | | find: Allow -type d without statting everything.jilles2014-01-111-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fts(3) detects directories even in FTS_NOSTAT mode (so it can descend into them). No functional change is intended, but find commands that use -type d but no primaries that still require stat/lstat calls make considerably fewer system calls.
* | | | | | | | find: Fix two more problems with -lname and -ilname:jilles2014-01-052-2/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Do not match symlinks that are followed because of -H or -L. This is explicitly documented in GNU find's info file and is like -type l. * Fix matching symlinks in subdirectories when fts changes directories. Also, avoid some readlink() calls on files that are obviously not symlinks (because of fts(3) restrictions, not all of them). MFC after: 1 week
* | | | | | | | find: Fix -lname and -ilname.jilles2014-01-051-2/+5
| |_|_|_|_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The code did not take into account that readlink() does not add a terminating '\0', and therefore did not work reliably. As before, symlinks of length PATH_MAX or more are not handled correctly. (These can only be created on other operating systems.) PR: bin/185393 Submitted by: Ben Reser (original version) MFC after: 1 week
* | | | | | | find: Allow -delete to delete files given as arguments.jilles2013-08-021-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | | | | | Add the Clang specific -Wmissing-variable-declarations to WARNS=6.ed2013-04-191-0/+2
| |_|_|_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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@
* | | | | | find: Include nanoseconds when comparing timestamps of files.jilles2013-03-172-20/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | | | | Add an option for finding sparse files.dwmalone2013-03-034-1/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reviewed by: iedowse MFC after: 3 weeks
* | | | | | find: Run when cwd cannot be opened, except with -execdir or -delete.jilles2013-02-102-2/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | | | find: In -execdir ... {} +, only pass one file per invocation.jilles2013-02-101-1/+7
| |_|_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | | Use .Nm instead of a self xrefeadler2012-11-191-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | Approved by: bcr (mentor) MFC after: 1 week
* | | | | Make it clear that amin and friends take + and - options.eadler2012-11-181-7/+27
| |/ / / |/| | | | | | | | | | | | | | | | | | | | | | | PR: docs/173265 Submitted by: Anton Shterenlikht <mexas@bristol.ac.uk> Approved by: bcr (mentor) MFC after: 3 days
* | | | Fix usr.bin/ and usr.sbin/ build with a 64-bit ino_t.mdf2012-09-271-1/+1
| | | | | | | | | | | | | | | | Original code by: Gleb Kurtsou
* | | | find: Do not pass fd to save current directory to child processes.jilles2012-09-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This removes one of the two wrongly passed file descriptors. The other one appears to be from fts(3). MFC after: 1 week
* | | | Note that -quit terminates successfully.des2012-09-101-1/+1
| | | | | | | | | | | | | | | | Requested by: jmg@
* | | | Document -quit, four and a half years after it was implemented.des2012-09-091-1/+5
| | | | | | | | | | | | | | | | | | | | MFC after: 3 days Pointy hat to: imp@
* | | | find: Remove unnecessary and inconsistent initialization.jilles2012-07-311-1/+1
| | | | | | | | | | | | | | | | Submitted by: jhb
* | | | find: Implement real -ignore_readdir_race.jilles2012-07-256-8/+38
| |/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | find(1): Move description of -d option to -depth primary.jilles2012-06-131-30/+30
| | | | | | | | | | | | | | | | | | | | | | | | The nullary -depth primary is standard and the -d option provides little advantage. PR: docs/168885 MFC after: 1 week
* | | Add more description and clarification about the -depth and -d options inissyl02012-06-101-4/+5
| |/ |/| | | | | | | | | | | | | | | | | 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
* | Fix style nit: don't use leading zero for dates in .Ddeadler2012-06-051-1/+1
| | | | | | | | | | | | Prompted by: brueffer Approved by: brueffer MFC after: 3 days
* | Document the limitations of the -delete primaryeadler2012-06-021-1/+4
|/ | | | | | | | PR: bin/166554 Submitted by: Richard Kettlewell <rjk@greenend.org.uk> Discussed with: jilles Approved by: bcr MFC after: 3 days
* Fix world after byacc import:bapt2012-05-221-2/+0
| | | | | | | | - 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)
* Remove trailing whitespace per mdoc lint warningeadler2012-03-291-12/+12
| | | | | | | Disussed with: gavin No objection from: doc Approved by: joel MFC after: 3 days
* Remove superfluous paragraph macro.joel2012-03-251-1/+0
|
* Replace char copyright[] by static const char copyright[].ed2011-12-101-1/+1
| | | | It seems the latter is used throughout the tree.
* Get rid of major/minor number distinction.ed2011-09-282-4/+3
| | | | | | | | | | | | | | | | | | | | | | 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).
* Using statfs.f_fstypename rather than statfs.f_type whilst performing fstypeavatar2011-06-131-20/+6
| | | | | | | | 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
* find: Exit if there is an unknown option.jilles2011-06-041-1/+1
| | | | | | | | | | | | 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.
* find: If a part of an expression is unknown, do not call it an option.jilles2011-05-271-1/+1
| | | | | | | | | | | 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
OpenPOWER on IntegriCloud