summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* tests.sh: Use eval instead of declare -gTavian Barnes2017-04-081-1/+1
| | | | Turns out declare -g is from Bash 4 too.
* Move bftw_typeflag converters to util.cTavian Barnes2017-04-086-116/+112
|
* bftw: Only rebuild the part of the path that changesTavian Barnes2017-03-221-37/+50
| | | | | | | | | | | | | | Quadratic complexity is still possible for directory structures like root -- a -- a -- a -- a ... | +- b -- b -- b -- b ... But for most realistic directory structures, bfs should now spend less time building paths. (Of course if you print every path, overall complexity is quadratic anyway.)
* bftw: Fix quadratic reference counting complexityTavian Barnes2017-03-201-8/+15
| | | | | | | | | | | | | dircache_entry refcounts used to count every single descendant, resulting in n refcount updates to create/delete an entry at depth n, and thus O(n^2) complexity overall for deep directory structures. Fix it by only counting direct children instead. The cache eviction policy is changed to prefer shallower entries in all cases, attempting to save at least some of the benefit of the previous accounting scheme. Unfortunately, the average number of traversed components for openat() calls still went up by ~20%, but the performance in practice is roughly unchanged in my tests.
* Respect -nocolor for -fprint /dev/stdoutTavian Barnes2017-03-161-2/+16
|
* Color link targets for -lsTavian Barnes2017-03-166-26/+60
| | | | Fixes #18.
* Give struct expr a CFILE* instead of just a FILE*Tavian Barnes2017-03-165-58/+90
| | | | This unifies the behaviour of -print and -fprint /dev/stdout.
* Release 0.960.96Tavian Barnes2017-03-113-2/+20
|
* Implement -ls and -flsTavian Barnes2017-03-116-102/+291
|
* tests: Run everything in UTCTavian Barnes2017-03-112-4/+5
|
* Add a test for colored outputTavian Barnes2017-03-112-0/+15
|
* Make a printf()-style API for colored messagesTavian Barnes2017-03-118-322/+306
|
* Implement -printf %Ak, %Ck, and %TkTavian Barnes2017-03-113-90/+240
|
* tests: Print the count of passing and failing testsTavian Barnes2017-02-111-13/+14
|
* Add some tests for the operators themselvesTavian Barnes2017-02-119-10/+118
|
* Allow short-circuiting optimizations with non-pure operandsTavian Barnes2017-02-112-14/+42
|
* Add tests for bfs's flexible command line parsingTavian Barnes2017-02-106-0/+35
|
* tests: Don't require bash associative arraysTavian Barnes2017-02-101-22/+11
| | | | That's a bash 4 feature, while macOS is stuck on bash 3.
* bftw: Make the nameoff of "///" point to "/"Tavian Barnes2017-02-096-11/+14
| | | | This simplifies a few things such as -name handling for ///.
* Give the test cases human-readable namesTavian Barnes2017-02-09138-312/+452
|
* Don't close stdin for -ok or -okdirTavian Barnes2017-02-094-15/+45
| | | | Turns out it violates POSIX, even though GNU find does it.
* parse: Factor out all "looks like icmp" checksTavian Barnes2017-02-091-11/+16
|
* bftw: Add the DIR* to bftw_stateTavian Barnes2017-02-091-15/+39
| | | | Can't forget to close it that way.
* Add support for -x?type with multiple typesTavian Barnes2017-02-088-169/+146
| | | | This functionality is already part of GNU findutils git.
* bftw: Add mising closedir() to error pathTavian Barnes2017-02-071-0/+1
|
* Bail out if parse_root() failsTavian Barnes2017-02-071-44/+88
| | | | | | Previously, skip_paths() did not distinguish between end-of-arguments and parse_root() failing, returning NULL in both cases. If parse_root() failed, parsing would attempt to continue, in an unexpected state.
* Add some missing perror() callsTavian Barnes2017-02-073-34/+39
|
* bftw: Plug a leak if dirqueue_push() failsTavian Barnes2017-02-061-16/+28
| | | | | | | | | | If bftw_add() succeeds but dirqueue_push() fails, we need to clean up the just-added dircache_entry. Otherwise it will leak, and we'll also fail the cache->size == 0 assertion. Fix it by extracting the dircache-related parts of bftw_pop() into a new helper function bftw_gc(), and call it from bftw_pop() as well as the bftw_push() failure path.
* Fix a memory leak parsing -printfTavian Barnes2017-02-063-1/+9
|
* tests.sh: Set the umask before creating the test treesTavian Barnes2017-02-061-0/+1
|
* Make -quit happen immediately, not at the end of the current expressionTavian Barnes2017-02-054-4/+43
|
* bftw: Compute nameoff correctly for the root in BFTW_DEPTH modeTavian Barnes2017-02-053-2/+11
|
* Implement -printf/-fprintfTavian Barnes2017-02-0517-46/+1087
| | | | | Based on a patch by Fangrui Song <i@maskray.me>. Closes #16.
* Implement -nouser and -nogroupTavian Barnes2017-02-046-1/+62
|
* Don't trust st_size when reading symlinksTavian Barnes2017-01-313-12/+44
| | | | | Linux /proc, for example, reports a st_size of 0 for everything. It's nice to be able to use -lname on them anyway.
* Simplify exec_chdir()Tavian Barnes2017-01-141-16/+10
| | | | | | The previous code recomputed the name offset for no reason, and had an embarrassing typo that was hypothetically a bug (`} if` instead of `} else if`).
* Don't set _POSIX_C_SOURCETavian Barnes2017-01-061-5/+4
| | | | | | The BSD behaviour is to hide all BSD extensions if standard-conformance feature test macros are present. We don't want strict POSIX, we want all available extensions, so ask for that.
* tests: Add a test for -inumTavian Barnes2017-01-032-1/+9
|
* tests: Add tests for -quitTavian Barnes2017-01-025-1/+27
|
* eval: Check that O_DIRECTORY is defined before using itTavian Barnes2017-01-021-1/+5
|
* travis: Do 32-bit builds tooTavian Barnes2016-12-211-2/+13
|
* Set _FILE_OFFSET_BITS to 64Tavian Barnes2016-12-213-1/+8
| | | | | With the new support for -size n[TP], this is needed to avoid overflow on 32-bit platforms.
* Bump the version to 0.880.88Tavian Barnes2016-12-203-2/+19
|
* Add some text to the -help outputTavian Barnes2016-12-201-1/+27
|
* Implement -mnewerTavian Barnes2016-12-204-1/+20
|
* Add tera and peta suffices for -sizeTavian Barnes2016-12-203-3/+15
|
* Implement -sparse from FreeBSD findTavian Barnes2016-12-203-0/+22
|
* Support -[gu]id NAME like BSD findTavian Barnes2016-12-204-25/+59
|
* Don't check errno after get{gr,pw}nam()Tavian Barnes2016-12-201-24/+6
| | | | | Turns out it doesn't always keep errno 0, even if the only problem is a failed lookup. This was observed on a machine with Kerberos auth.
* Implement BSD find's -depth NTavian Barnes2016-12-1810-2/+95
|