| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
In trie_remove(), clearing the bit before trie_node_collapse() causes us
to free the old node with size 1 instead of 2, putting it on the wrong
freelist. This is technically safe with the current arena
implementation, but not intentional.
|
|
|
|
|
|
|
|
|
| |
Allowing unaligned sizes will allow us to allocate aligned slabs with
additional metadata in the tail without ballooning the allocation size
for large alignments.
Link: https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_460
Link: https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2072.htm
|
|
|
|
|
|
|
|
|
|
|
| |
On non-Linux systems, bfs_check_capabilities always returned -1, so
cpath_has_capabilities would always return true. If bfs was called with
an LS_COLORS containing the `ca` statement, e.g. `ca=30;41`, bfs would
color ALL the files. While including the `ca` statement in LS_COLORS
on non-Linux systems is unusual, this is not an error and is a valid
use-case (e.g. Using GNU ls or lsd).
Fixes: 1520d4d3 ("color: Don't color files like directories on ENOTDIR")
|
|
|
|
| |
Fixes: https://github.com/tavianator/bfs/issues/145
|
|
|
|
| |
And mark the fallible ones with _nodiscard.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously, given
$ touch file
$ ln -s file/file notdir
$ bfs notdir/file
bfs would loop forever when printing the error message, since it
expected stripping the trailing slash from "notdir/" to fix the ENOTDIR
error, but the broken symlink still gave the same error.
Fixes: b4c3201 ("color: Only highlight the trailing slash on ENOTDIR")
|
|
|
|
|
|
|
| |
This was causing a UAF if we ever unregistered the last hook for a
signal and then re-registered one.
Fixes: 75b7f70 ("sighook: Make sigunhook() O(1)")
|
| |
|
|
|
|
|
|
| |
setitimer() is obsolescent in POSIX 2008 and removed from POSIX 2024.
However, at least macOS doesn't implement the new timer_create() API, so
we still need the setitimer() fallback.
|
| |
|
| |
|
|
|
|
|
|
| |
First of all, almost all checks were !trie_is_leaf(), so it makes sense
to use trie_is_node() instead. Secondly, using the tag bit for internal
nodes allows us to remove some NULL checks.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Leading NUL bytes (e.g. `*\0.gz=...`) could cause us to insert a
non-prefix-free set of strings into the case-insensitive extension trie,
which would lead to crashes like
bfs: trie_split@src/trie.c:538: Assertion failed: `key_nibble != rep_nibble`
and OOB accesses to trie leaf keys. Fix it by ignoring those
extensions, since filenames cannot contain NUL bytes.
Fixes: 08030aea ("color: Delay the case_sensitive decision")
|
| |
|
| |
|
|
|
|
|
|
| |
This avoids what might be a strict aliasing violation in some models.
Link: https://github.com/llvm/llvm-project/pull/108385#issuecomment-2352938645
|
| |
|
| |
|
|
|
|
| |
Fixes: 65a7814 ("opt: Don't raise RLIMIT_NOFILE if it would prevent using posix_spawn()")
|
|
|
|
|
|
|
| |
When optimizing -not \( -a , -b \), the child is a comma expression, not
the parent.
Fixes: 4a36bb9 ("expr: Make expressions variadic")
|
| |
|
| |
|
|
|
|
| |
Fixes: 9b8cf46 ("opt: Warn about all ignored tests")
|
| |
|
|
|
|
|
|
| |
This replaces the explicit CPPFLAGS list in flags.mk with just
`-include src/prelude.h`, shortening our compiler command lines and
allowing them to be easily documented.
|
| |
|
|
|
|
|
| |
Rather than a bunch of manual fallback macros, just provide a fallback
definition that returns false.
|
| |
|
| |
|
|
|
|
|
| |
In most cases, it's not too annoying to specify a message. For
tests/bit.c, we can manually polyfill the 1-argument version.
|
| |
|
| |
|
|
|
|
| |
Fixes: c964524 ("atomic: Add a spin_loop() hint")
|
| |
|
| |
|
| |
|
|
|
|
| |
Fixes: 33b85e1 ("Implement POSIX 2024's -mount")
|
|
|
|
| |
Closes: https://github.com/tavianator/bfs/issues/142
|
| |
|
|
|
|
|
| |
This lets us warn about `bfs -delete -empty`, even though -empty is
impure.
|
| |
|
| |
|
|
|
|
|
| |
The annotation visitor probably can't fail, but we might as well check
consistently.
|
|
|
|
|
|
| |
For example, `bfs -delete -type f` is almost certainly a mistake.
Link: https://savannah.gnu.org/bugs/?65895
|
|
|
|
|
|
|
|
| |
This fixes warnings on commands like `bfs -exclude -true` or
`bfs -exclude -type f -type f`, because the data flow is properly shared
between the -exclude expression and the main one.
Fixes: 4a36bb9 ("expr: Make expressions variadic")
|
| |
|
|
|
|
|
|
|
|
|
|
| |
POSIX allows optional features to be supported at compile time but not
necessarily at run time by defining _POSIX_OPTION to 0 and requiring
users to check sysconf(_SC_OPTION) > 0. The new sysoption() macro
simplifies the check.
sighook() and bfs_spawn() now check for conditional runtime support for
the relevant POSIX options.
|