summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Simplify some more macros with C23 syntaxTavian Barnes2025-07-262-11/+12
|
* list: Simplify macros with C23 featuresTavian Barnes2025-07-261-171/+65
| | | | | We can avoid the MACRO_((list), __VA_ARGS__, ) dance since the comma is no longer required. typeof() also comes in handy.
* prelude: Expose typeof() and typeof_unqual() in C17 modeTavian Barnes2025-07-261-0/+5
|
* bfs.h: New container_of macroTavian Barnes2025-07-261-3/+13
|
* diag: Simplify macros with __VA_OPT__Tavian Barnes2025-07-261-49/+19
|
* bfs.h: New BFS_VA_IF(A)(B)(C) macroTavian Barnes2025-07-261-0/+19
|
* Use C23 [[attribute]] syntaxTavian Barnes2025-07-2624-177/+174
|
* build: Use C23 if possibleTavian Barnes2025-07-261-1/+1
| | | | | | For broader compiler support, we try both -std=c23 and -std=c2x. If neither is supported, we fall back to -std=c17, but we will start requiring some C23 features as extensions in this mode.
* prelude: Move countof() here from bfs.hTavian Barnes2025-07-092-5/+9
| | | | | | | countof() will likely be in the C2Y standard. Link: https://www.open-std.org/JTC1/SC22/WG14/www/docs/n3469.htm Link: https://thephd.dev/c2y-hitting-the-ground-running
* color: Match the BSD $LSCOLORS behaviour more closelyTavian Barnes2025-07-041-21/+46
| | | | | | | | | BSD/macOS ls(1) don't reject overlong or odd-length $LSCOLORS values (although they can warn, which we don't). They also don't use the "intense" background colors for capital letters; instead, that enables underline on FreeBSD, or (foreground) bold on macOS. We copy FreeBSD here.
* color: Add support for dataless filesTavian Barnes2025-07-041-15/+47
| | | | Link: https://developer.apple.com/documentation/technotes/tn3150-getting-ready-for-data-less-files
* color: Set fields directly, not by name, in parse_bsd_ls_colors()Tavian Barnes2025-07-041-27/+49
|
* build: Add support for TySanTavian Barnes2025-07-042-1/+7
| | | | There are some false positives, so it's not added to distcheck yet.
* diag: Fix bfs_eabort() macroTavian Barnes2025-07-041-2/+2
|
* Support for FreeBSD-style ls ColoringVinX2025-07-031-5/+76
| | | | | | | | If LSCOLORS is undefined or partially defined (missing some of the eleven expected value pairs), the patch will automatically fill in those missing values with default colors. However, if the LS_COLORS environment variable is already defined, the application prefer the LS_COLORS approach, maintaining current working flow of the program.
* opt: "Not me" doesn't imply "nobody"Tavian Barnes2025-06-201-7/+12
| | | | | | | | | | | | | We were making `-user <existing>` imply `! -nouser`, which is valid, but we were also makeing `! -user <existing>` imply `-nouser`, which isn't. Fix it by only constraining the `-nouser`/`-nogroup` predicates in the true case. While I'm here, fix a similar latent bug that would have triggered if we ever merged `-readable -and -writable` into one `R_OK | W_OK` test. Fixes: https://github.com/tavianator/bfs/issues/155 Fixes: 305ee902 ("opt: Track data flow information about predicates")
* xspawn: Fix a -Wshadow warning on macOSTavian Barnes2025-06-161-2/+2
|
* xspawn: Work around a macOS posix_spawn() bugTavian Barnes2025-06-151-0/+11
| | | | | The XNU posix_spawn() implementation apparently can't handle fchdir() to a directory opened by the file actions themselves.
* xspawn: Work around a NetBSD posix_spawn() bugTavian Barnes2025-06-151-0/+11
| | | | | | | NetBSD's posix_spawn() surprisingly has the same bug as its posix_spawnp(): the executable is resolved before the file actions. Detect this case and work around it by falling back to fork()/exec() if we need to.
* parse: Allow relative $PATH entries with explicit executable pathsTavian Barnes2025-06-151-21/+48
| | | | | | $ bfs -execdir /bin/exe {} \; is perfectly safe regardless of what's in $PATH.
* xspawn: Don't check xfaccess(..., X_OK) before fchdir()Tavian Barnes2025-06-151-16/+40
| | | | Fixes: 8c130ca ("xspawn: Check X_OK even without $PATH resolution")
* Add support for __attribute__((counted_by(...)))Tavian Barnes2025-05-267-8/+17
|
* tests/posix: Add a test for POSIX bug 1859Tavian Barnes2025-05-261-1/+2
| | | | ... which requires we process root paths strictly in-order.
* bfstd: Add some more integer parsing functionsTavian Barnes2025-04-182-0/+124
|
* bfstd: Add a tcsetwinsize() polyfillTavian Barnes2025-04-152-0/+13
|
* bfstd: Add a tcgetwinsize() polyfillTavian Barnes2025-04-153-34/+40
|
* ctx: Don't leak ctx->kindsTavian Barnes2025-04-031-0/+1
| | | | Fixes: 9c911d7 ("ctx: Track the token kind of each argument")
* parse: Disallow -files0-from with explicit rootsTavian Barnes2025-04-011-0/+18
| | | | This matches the behaviour of GNU find.
* ctx: Track the token kind of each argumentTavian Barnes2025-04-013-0/+22
|
* parse: Only process the last -files0-fromTavian Barnes2025-04-011-54/+68
| | | | | | | | GNU find intentionally makes later -files0-from options override earlier ones, for symmetry with similar features like du --files0-from. Change bfs to match. Link: https://savannah.gnu.org/bugs/?66965
* color: New %p[xX] formats for expressions in diagnosticsTavian Barnes2025-04-014-36/+66
|
* parse: Track expressions, not just strings, for conflict reportingTavian Barnes2025-03-301-59/+85
|
* list: Switch back to the memcpy()/memset() SLIST_REMOVE() implementationTavian Barnes2025-03-291-19/+12
| | | | | | | | | The thread-local scratch variables make it non-reentrant for no good reason. I don't consider the theoretical strict-aliasing violation to be practically relevant. This partially reverts commit 90791fc ("list: Make SLIST_REMOVE() more type-safe").
* bfstd: Fix nproc() on systems without dynamically sized CPU masksTavian Barnes2025-03-101-2/+14
| | | | Notes: Fixes: a36774b ("bfstd: Take sched_getaffinity() into account in nproc()")
* diag: Don't leave unused assertion messages in the binaryTavian Barnes2025-03-041-6/+19
| | | | | Rather than hiding them with %.0s, use a ternary to replace them with an empty string if they would be unused.
* diag: Get rid of struct bfs_locationTavian Barnes2025-03-042-51/+40
| | | | | | | | Just add the standard prefix to the passed format string in the diagnostic macros themselves. This lets us write the whole message with one dprintf() call, minimizing interleaving. It's also a net win for binary size.
* bfstd: Take sched_getaffinity() into account in nproc()Tavian Barnes2025-02-271-5/+48
|
* bfstd: New nproc() functionTavian Barnes2025-02-273-15/+21
|
* Micro-optimize word-at-a-time loop tailsTavian Barnes2025-02-212-10/+14
| | | | | | Compilers apparently aren't smart enough to infer that the odd tail length fixup "loops" run at most once, and could be converted to ifs, so do that manually.
* ioq: Fix typo in commentTavian Barnes2025-02-181-1/+1
|
* trie: Use load8_beu*() for trie_mismatch()Tavian Barnes2025-02-131-29/+23
|
* bfstd: Use load8_leu*() for asciinlen()Tavian Barnes2025-02-131-24/+20
|
* bit: Add the load8_[bl]euN() utilitiesTavian Barnes2025-02-131-1/+53
|
* trie: Make nibble indices big-endianTavian Barnes2025-02-131-7/+7
| | | | Otherwise the order doesn't match lexicographical order on bytes.
* trie: New trie_node_size() helperTavian Barnes2025-02-131-3/+9
|
* trie: Clean up some bounds checkingTavian Barnes2025-02-121-6/+6
|
* trie: Micro-optimize trie_representative()Tavian Barnes2025-02-111-4/+5
| | | | | popcount(map & (bit - 1) & mask) has a longer critical path than popcount(map & (bit - 1)) & mask.
* eval: Don't error out in -ls if the time overflowsTavian Barnes2025-02-071-19/+30
|
* ioq: Use getppid() for the heavy NOP syscallTavian Barnes2025-02-061-1/+1
| | | | | | | | getpid() could hypothetically be cached (and glibc used to do it). getppid() can't be, because the parent could die and reparent the child to init. Link: https://lore.kernel.org/linux-mm/Z58dIOGlJ3grsAge@casper.infradead.org/
* mtab: Use mount IDs instead of dev_t for bfs_fstype()Tavian Barnes2025-02-061-2/+2
| | | | | | | | | This fixes -fstype on btrfs subvolumes, which previously reported "unknown" due to their dev_t being potentially different from the mount point. Link: https://savannah.gnu.org/bugs/?50859 Link: https://lwn.net/Articles/866582/