Commit message (Collapse) | Author | Age | Files | Lines | ||
---|---|---|---|---|---|---|
... | ||||||
* | Handle ENOTDIR the same as ENOENT | Tavian Barnes | 2017-07-09 | 11 | -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 internals | Tavian Barnes | 2017-07-09 | 1 | -235/+257 | |
| | ||||||
* | bftw: Fix ENAMETOOLONG handling when the root is closed | Tavian Barnes | 2017-07-08 | 4 | -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 fail | Tavian Barnes | 2017-07-08 | 1 | -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 ENAMETOOLONG | Tavian Barnes | 2017-07-08 | 3 | -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 Barnes | 2017-07-08 | 1 | -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.2 | Tavian Barnes | 2017-06-15 | 3 | -2/+13 | |
| | ||||||
* | -perm: Handle permcopy (e.g. u=rw,g=u) correctly | Tavian Barnes | 2017-06-15 | 3 | -5/+22 | |
| | ||||||
* | tests: Fix test_printf_nul with non-GNU sort | Tavian Barnes | 2017-06-11 | 2 | -1/+7 | |
| | | | | | Other UNIX sort implementations seem to truncate at the nul bytes, so open-code it without the sort. | |||||
* | printf: Fix embedded nul bytes | Tavian Barnes | 2017-06-10 | 5 | -11/+37 | |
| | | | | Fixes #26. | |||||
* | parse: Make some error messages red | Tavian Barnes | 2017-06-03 | 1 | -2/+4 | |
| | ||||||
* | Add Homebrew installation instructions | Peter Brunner | 2017-06-03 | 1 | -0/+2 | |
| | ||||||
* | Release 1.0.11.0.1 | Tavian Barnes | 2017-05-17 | 3 | -2/+14 | |
| | ||||||
* | parse: Set always_true for some actions that never return false | Tavian Barnes | 2017-05-17 | 1 | -3/+25 | |
| | ||||||
* | bftw: Remove unused parameter to dircache_entry_base() | Tavian Barnes | 2017-05-17 | 1 | -5/+3 | |
| | ||||||
* | Add colors to -D tree | Tavian Barnes | 2017-05-15 | 3 | -37/+51 | |
| | ||||||
* | Optimize based on reachability due to -quit | Tavian Barnes | 2017-05-15 | 2 | -43/+85 | |
| | ||||||
* | Don't make -quit disable the implicit -print | Tavian Barnes | 2017-05-11 | 3 | -3/+9 | |
| | ||||||
* | Implement -D exec | Tavian Barnes | 2017-05-09 | 4 | -13/+63 | |
| | ||||||
* | main: Fix error checking of redirect() | Tavian Barnes | 2017-05-06 | 1 | -1/+3 | |
| | ||||||
* | exec: Treat -1 from _SC_ARG_MAX as "unlimited" | Tavian Barnes | 2017-04-30 | 1 | -1/+1 | |
| | ||||||
* | mtab: Check __GLIBC__ instead of __linux__ for getmntent() | Tavian Barnes | 2017-04-30 | 1 | -2/+2 | |
| | ||||||
* | Pass AT_EACCESS to faccessat() | Tavian Barnes | 2017-04-30 | 2 | -2/+2 | |
| | | | | | That's the form that actually answers the expected question ("can I open() this"), and the only form Hurd supports. | |||||
* | Don't forget an access mode to openat() in -empty | Tavian Barnes | 2017-04-30 | 1 | -1/+1 | |
| | ||||||
* | Don't parse the mount table until it's needed | Tavian Barnes | 2017-04-29 | 3 | -12/+14 | |
| | ||||||
* | mtab: Don't hardcode /etc/mtab | Tavian Barnes | 2017-04-29 | 1 | -1/+1 | |
| | ||||||
* | Add Debian installation instructions. | Chris Lamb | 2017-04-29 | 1 | -0/+2 | |
| | ||||||
* | Release 1.01.0 | Tavian Barnes | 2017-04-24 | 12 | -11/+42 | |
| | ||||||
* | Implement -fstype | Tavian Barnes | 2017-04-23 | 10 | -7/+319 | |
| | | | | Fixes #6! | |||||
* | Make -help output prettier and more complete | Tavian Barnes | 2017-04-16 | 2 | -50/+260 | |
| | ||||||
* | tests.sh: Allow individual tests to be specified on the command line | Tavian Barnes | 2017-04-16 | 1 | -10/+16 | |
| | ||||||
* | Implement -X | Tavian Barnes | 2017-04-16 | 7 | -0/+51 | |
| | ||||||
* | tests: Add tests for bfs extensions to -exec ... + | Tavian Barnes | 2017-04-16 | 3 | -0/+22 | |
| | ||||||
* | exec: Interpret ARG_MAX corretly. | Tavian Barnes | 2017-04-15 | 2 | -34/+117 | |
| | | | | Thanks to https://www.in-ulm.de/~mascheck/various/argmax/ | |||||
* | exec: close() the working directory even if !ftwbuf | Tavian Barnes | 2017-04-15 | 1 | -1/+1 | |
| | ||||||
* | Implement -exec/-execdir ... + | Tavian Barnes | 2017-04-15 | 10 | -227/+618 | |
| | ||||||
* | util.h: Don't use a forward reference to enum bftw_typeflag | Tavian Barnes | 2017-04-13 | 1 | -0/+1 | |
| | | | | Apparently that's not allowed in standard C. | |||||
* | tests.sh: Use eval instead of declare -g | Tavian Barnes | 2017-04-08 | 1 | -1/+1 | |
| | | | | Turns out declare -g is from Bash 4 too. | |||||
* | Move bftw_typeflag converters to util.c | Tavian Barnes | 2017-04-08 | 6 | -116/+112 | |
| | ||||||
* | bftw: Only rebuild the part of the path that changes | Tavian Barnes | 2017-03-22 | 1 | -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 complexity | Tavian Barnes | 2017-03-20 | 1 | -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/stdout | Tavian Barnes | 2017-03-16 | 1 | -2/+16 | |
| | ||||||
* | Color link targets for -ls | Tavian Barnes | 2017-03-16 | 6 | -26/+60 | |
| | | | | Fixes #18. | |||||
* | Give struct expr a CFILE* instead of just a FILE* | Tavian Barnes | 2017-03-16 | 5 | -58/+90 | |
| | | | | This unifies the behaviour of -print and -fprint /dev/stdout. | |||||
* | Release 0.960.96 | Tavian Barnes | 2017-03-11 | 3 | -2/+20 | |
| | ||||||
* | Implement -ls and -fls | Tavian Barnes | 2017-03-11 | 6 | -102/+291 | |
| | ||||||
* | tests: Run everything in UTC | Tavian Barnes | 2017-03-11 | 2 | -4/+5 | |
| | ||||||
* | Add a test for colored output | Tavian Barnes | 2017-03-11 | 2 | -0/+15 | |
| | ||||||
* | Make a printf()-style API for colored messages | Tavian Barnes | 2017-03-11 | 8 | -322/+306 | |
| | ||||||
* | Implement -printf %Ak, %Ck, and %Tk | Tavian Barnes | 2017-03-11 | 3 | -90/+240 | |
| |