summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* parse: Don't reorder or remove tests with potential side effectsTavian Barnes2017-09-063-3/+29
| | | | | | -empty and -xtype may have side effects like reporting permission errors, which even affect the exit status of bfs. We shouldn't remove these effects without -Ofast.
* util: Factor out checks for nonexistent paths/broken linksTavian Barnes2017-09-063-3/+12
|
* parse: Factor out common initialization code for -print and friendsTavian Barnes2017-09-061-35/+30
|
* tests: Test hardlinks to symlinksTavian Barnes2017-09-0613-0/+20
|
* tests: Make test_deep pass with other find implementationsTavian Barnes2017-09-043-22/+37
| | | | | And move test_deep_strict to the bfs-specific tests, since it's not likely to ever pass for other implementations.
* Implement -D searchTavian Barnes2017-09-023-6/+111
|
* tests: Use human-readable filenames in links/Tavian Barnes2017-09-0233-142/+128
|
* mtab: Use __has_include() to check for <mntent.h>Tavian Barnes2017-09-021-4/+15
| | | | | This fixes the build against musl, as long as you have a new enough compiler for __has_include.
* Implement cost-based optimizationTavian Barnes2017-08-275-61/+254
|
* printf: Save some lines in time specifier parsingTavian Barnes2017-08-271-36/+4
|
* Avoid multiple extra stat()s of broken symlinks for -xtypeTavian Barnes2017-08-225-13/+18
|
* tests: Remove unnecessary sort-args.sh invocationsTavian Barnes2017-08-163-40/+40
|
* tests: Add some syntax highlighting to --verboseTavian Barnes2017-08-121-3/+22
|
* Unify broken symlink handlingTavian Barnes2017-08-1211-33/+74
| | | | | | | | | Rather than open-code the fallback logic for broken symlinks everywhere it's needed, introduce a new xfstatat() utility function that performs the fallback automatically. Using xfstatat() consistently fixes a few bugs, including cases where broken symlinks are given as arguments to predicates like -samefile.
* tests: Add a test for -exec ... {} + with a failing commandTavian Barnes2017-08-122-0/+27
|
* Update README.mdTavian Barnes2017-08-101-4/+16
|
* bftw: Assert that the queue is empty when freeing itTavian Barnes2017-08-101-0/+1
|
* parse: Don't allow negative optimization levelsTavian Barnes2017-08-101-1/+1
|
* Release 1.1.11.1.1Tavian Barnes2017-08-103-2/+11
|
* exec: Fix more corner cases with -ok ... +Tavian Barnes2017-07-294-9/+58
| | | | -ok should look for a ; even if it sees {} +, according to POSIX.
* tests.sh: Add a --verbose modeTavian Barnes2017-07-291-22/+58
|
* exec: Don't allow anything between {} and +Tavian Barnes2017-07-297-117/+99
| | | | | | | | | POSIX explicitly forbids this extension: > Only a <plus-sign> that immediately follows an argument containing > only the two characters "{}" shall punctuate the end of the primary > expression. Other uses of the <plus-sign> shall not be treated as > special.
* util: Define O_DIRECTORY to 0 if it's not already definedTavian Barnes2017-07-294-15/+7
|
* Re-license under the BSD Zero Clause LicenseTavian Barnes2017-07-2723-234/+343
|
* Release 1.11.1Tavian Barnes2017-07-223-2/+20
|
* Represent never returning as always_true && always_falseTavian Barnes2017-07-213-34/+42
| | | | | | | | | | Expressions that never return are vacuously always both true and false. Using this representation lets us take advantage of existing truth-based optimizations, which gets us optimizations of command lines like bfs -name foo -quit -print for free.
* Fix a couple terrible optimizer bugsTavian Barnes2017-07-214-2/+14
| | | | | | | Just because an expression is always true or false, doesn't mean we can execute it more often than it otherwise would be, unless it's also pure. But that's equivalent to being identically -true/-false, so just check that.
* Implement -printxTavian Barnes2017-07-215-0/+81
| | | | Also from NetBSD.
* main: Call setlocale() at startup to use the system localeTavian Barnes2017-07-202-0/+14
|
* eval: Add some sanity checksTavian Barnes2017-07-204-0/+35
|
* Implement -exit [STATUS]Tavian Barnes2017-07-206-12/+75
| | | | From NetBSD again.
* Implement -rm as an alias for -deleteTavian Barnes2017-07-204-4/+25
| | | | From NetBSD.
* Revert "tests.sh: Better line overwriting"Tavian Barnes2017-07-201-4/+5
| | | | | | This reverts commit 4b02d5dae771a8797868ccaddf1bbb7cf0b67c2b. Overwriting the last line of the test output is worse.
* tests.sh: Better line overwritingTavian Barnes2017-07-181-5/+4
| | | | | This way the cursor is always at the beginning of the line, so any error output is more readable.
* tests.sh: Make closefrom() behave like its namesakeTavian Barnes2017-07-181-3/+3
|
* tests.sh: Close extraneous fds for tests that depend on ulimitTavian Barnes2017-07-161-0/+17
|
* parse: Ask for confirmation in some casesTavian Barnes2017-07-162-108/+157
|
* Handle yes/no prompts correctly according to the localeTavian Barnes2017-07-153-7/+80
|
* parse: Warn if -depth and -prune are used togetherTavian Barnes2017-07-091-0/+19
|
* Handle ENOTDIR the same as ENOENTTavian Barnes2017-07-0911-3/+21
| | | | | | For a/b/c, ENOTDIR is returned instead of ENOENT if a or b are not directories. Handle this uniformly when detecting broken symlinks, readdir races, etc.
* bftw: Rename and refactor the internalsTavian Barnes2017-07-091-235/+257
|
* bftw: Fix ENAMETOOLONG handling when the root is closedTavian Barnes2017-07-084-12/+33
| | | | | The root has depth == 0, but we still need to include it in the components array.
* exec: Clear errno when a multi-exec doesn't failTavian Barnes2017-07-081-1/+6
| | | | | | | This fixes strange "Inappropriate ioctl for device" errors when using -exec ... + with output redirection. errno was set to ENOTTY by the isatty() call during startup for color auto-detection, and never cleared before eval_exec() wants to check if anything went wrong.
* bftw: Recover from ENAMETOOLONGTavian Barnes2017-07-083-23/+137
| | | | | | | | | | | | | | | | | | | | | | | | It is always possible to force a breadth-first traversal to encounter ENAMETOOLONG, regardless of the dircache eviction policy. As a concrete example, consider this directory structure: ./1/{NAME_MAX}/{NAME_MAX}/{NAME_MAX}/... (longer than {PATH_MAX}) ./2/{NAME_MAX}/{NAME_MAX}/{NAME_MAX}/... ./3/{NAME_MAX}/{NAME_MAX}/{NAME_MAX}/... ... (more than RLIMIT_NOFILE directories under .) Eventually, the next file to be processed will not have any parents in the cache, as the cache can only hold RLIMIT_NOFILE entries. Then the whole path must be traversed from ., which will exceed {PATH_MAX} bytes. Work around this by performing a component-by-component traversal manually when we see ENAMETOOLONG. This is required by POSIX: > The find utility shall be able to descend to arbitrary depths in a file > hierarchy and shall not fail due to path length limitations (unless a > path operand specified by the application exceeds {PATH_MAX} > requirements).
* Revert "bftw: Don't store the terminating '\0' in dircache_entry names."Tavian Barnes2017-07-081-1/+2
| | | | | | | This reverts commit 20860becb5a0e89ee2aaaddbb0ba1eb248552640. The terminating NUL will be useful for the upcoming per-component traversal to handle ENAMETOOLONG.
* Release 1.0.21.0.2Tavian Barnes2017-06-153-2/+13
|
* -perm: Handle permcopy (e.g. u=rw,g=u) correctlyTavian Barnes2017-06-153-5/+22
|
* tests: Fix test_printf_nul with non-GNU sortTavian Barnes2017-06-112-1/+7
| | | | | Other UNIX sort implementations seem to truncate at the nul bytes, so open-code it without the sort.
* printf: Fix embedded nul bytesTavian Barnes2017-06-105-11/+37
| | | | Fixes #26.
* parse: Make some error messages redTavian Barnes2017-06-031-2/+4
|