summaryrefslogtreecommitdiffstats
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* color: Handle bfs_check_capabilities error code (-1) in cpath_has_capabilitiesJody Frankowski5 days4-0/+42
| | | | | | | | | | | 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")
* bit: Add bswap() overloads for every primitive typeTavian Barnes9 days1-0/+7
| | | | Fixes: https://github.com/tavianator/bfs/issues/145
* tests/posix: Add a test for overly aggressive -exec {} + matchingTavian Barnes9 days2-0/+33
| | | | Link: https://savannah.gnu.org/bugs/?66365
* color: Don't color files like directories on ENOTDIRTavian Barnes2024-10-161-2/+2
|
* color: Fix an infinite loop colorizing some invalid pathsTavian Barnes2024-10-132-0/+2
| | | | | | | | | | | | | | 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")
* tests/gnu: Test -L -printf %YTavian Barnes2024-10-102-0/+18
|
* tests/trie: Improve code coverageTavian Barnes2024-10-101-1/+4
|
* sighook: Don't forget to reset list->tail on the last sigpop()Tavian Barnes2024-10-101-0/+7
| | | | | | | 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)")
* tests/sighook: Use the new xtimer_start() APITavian Barnes2024-10-101-8/+6
|
* color: Fix an assertion failure with embedded NUL bytesTavian Barnes2024-10-022-0/+32
| | | | | | | | | | | | | 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")
* Fix spellingTavian Barnes2024-09-232-2/+2
|
* opt: Fix an invalid assertion in sink_not_comma()Tavian Barnes2024-09-172-0/+36
| | | | | | | When optimizing -not \( -a , -b \), the child is a comma expression, not the parent. Fixes: 4a36bb9 ("expr: Make expressions variadic")
* Fix includesTavian Barnes2024-08-297-6/+4
|
* build: Move feature test macros to prelude.hTavian Barnes2024-08-2812-18/+4
| | | | | | 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.
* prelude: Split bfs-specific utilities into new bfs.h headerTavian Barnes2024-08-2813-7/+34
|
* diag: Get rid of bfs_static_assert()Tavian Barnes2024-08-281-31/+37
| | | | | In most cases, it's not too annoying to specify a message. For tests/bit.c, we can manually polyfill the 1-argument version.
* prelude: Define thread_localTavian Barnes2024-08-281-1/+0
|
* eval: Don't warn about suppressed errors without -noerrorTavian Barnes2024-08-191-0/+2
|
* tests/bfs: Add -noerror testsTavian Barnes2024-08-197-0/+21
|
* xtime: Remove xgettime()Tavian Barnes2024-08-091-2/+2
| | | | clock_gettime() is available everywhere by now.
* parse: Take umask into account in parse_mode()Tavian Barnes2024-08-024-2/+21
| | | | | | | POSIX 2024 clarified that find(1) is meant to work exactly like chmod(1) here, so for modes like +rw,-x with no "who" specified, apply the umask. Link: https://www.austingroupbugs.net/view.php?id=1392
* tests: Add more files to perms/Tavian Barnes2024-08-0222-103/+333
|
* tests: Make some more variables localTavian Barnes2024-08-011-2/+4
|
* tests: Fix line number reported when wait -n failsTavian Barnes2024-08-011-2/+3
|
* tests: Add tests for invalid users/groupsTavian Barnes2024-07-2728-0/+8
|
* tests: Make more tests POSIX-compliantTavian Barnes2024-07-2310-10/+10
|
* tests/common: Add some missing pathsTavian Barnes2024-07-234-4/+4
|
* Implement POSIX 2024's -mountTavian Barnes2024-07-085-6/+2
| | | | | | This reverts commit 4f80c17192f2b28c96a489969d4435151d68d0ce. Link: https://www.austingroupbugs.net/view.php?id=1133
* tests: -print0 is in POSIX 2024Tavian Barnes2024-07-082-0/+0
| | | | Link: https://www.austingroupbugs.net/view.php?id=243
* tests: -iname is in POSIX 2024Tavian Barnes2024-07-083-2/+1
| | | | Link: https://www.austingroupbugs.net/view.php?id=1031
* tests: Simplify unit tests with a global variableTavian Barnes2024-07-0711-324/+263
| | | | | It's a little awkward to thread the test result through manually; much easier to just make bfs_check() update a global variable.
* sighook: Replace sigtables with RCU-protected linked listsTavian Barnes2024-07-071-34/+60
| | | | | | | | This fixes an ABA problem where sigdispatch() could think no handlers are registered for a signal even when there are. Link: https://unix.stackexchange.com/a/779594/56202 Fixes: 375caac ("sighook: New utilities for hooking signals")
* tests/bfs: New case-sensitivity ordering testTavian Barnes2024-07-032-0/+28
|
* color: Delay the case_sensitive decisionTavian Barnes2024-07-022-0/+28
|
* xspawn: Check X_OK even without $PATH resolutionTavian Barnes2024-06-081-0/+2
| | | | | | | | | | Not all posix_spawn() implementations use errno to report execv() failures from the child process, as that requires either a kernel posix_spawn() implementation or a pipe to pass the error back. This should fix tests/posix/exec_nonexistent on OpenBSD and HPPA. Link: https://buildd.debian.org/status/fetch.php?pkg=bfs&arch=hppa&ver=3.3.1-1&stamp=1717489148&raw=0
* tests: Do chmod +rwX in clean_stddirs()Tavian Barnes2024-06-081-0/+1
|
* build: Add -Wmissing-variable-declarationsTavian Barnes2024-06-081-2/+2
|
* tests: Improve color case insensitivity coverageTavian Barnes2024-06-052-6/+6
|
* tests: New inaccessible/ directory tree for permission errorsTavian Barnes2024-06-049-38/+18
|
* tests: Add directories with different permissions to perms/Tavian Barnes2024-06-0420-80/+103
|
* tests/common: Add tests for -[am]{min,time}Tavian Barnes2024-06-048-0/+84
|
* xtime: Add support for @epochseconds timestampsTavian Barnes2024-06-042-25/+12
|
* Merge branch 'revert-eloop'Tavian Barnes2024-06-034-2/+4
|\
| * Make ELOOP an error again, except for -xtype.3.3.1Tavian Barnes2024-06-034-2/+4
| | | | | | | | | | | | | | | | | | | | POSIX requires an error if (for example) -L encounters a symlink loop. The GNU find change was restricted to -xtype, so add a manual ELOOP test to eval_xtype() for compatibility. This reverts commit 470589cbd9ca3e73d8c01ac3a96cbc065179dcc5. Link: https://savannah.gnu.org/bugs/?19605
* | parse: Allow -Darg/-Sarg as well as -D arg / -S argTavian Barnes2024-06-036-0/+59
| |
* | parse: Handle multiple flags at once like -LEXO2Tavian Barnes2024-06-0311-0/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The POSIX Utility Syntax Guidelines specify that flag groups like -HL should be handled like -H -L. GNU find doesn't support grouping flags in this way, but BSD find does. To avoid conflicts with non-flag primaries, for now we require at least one flag in a group to be a capital letter. That is, we support things like -Lds but not -ds. We also do not support -fPATH (without a space) as it would conflict with -follow, -fprint, etc. It is impossible to be compatible with both GNU and BSD find here: user@gnu$ find -follow link link/file ... user@bsd$ find -follow find: ollow: No such file or directory Link: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html
* | list: New SLIST_SPLICE() macroTavian Barnes2024-05-313-0/+101
| |
* | bit: Update to match C23Tavian Barnes2024-05-291-18/+18
|/ | | | | | | | | | Based on the latest C23 draft (N3220): - Argument types to generic bit functions should be unsigned - Bit functions return unsigned int - Byte-swapping functions (stdc_memreverse8*()) weren't added - stdc_rotate_{left,right}() weren't added - first_leading_*() counts from the *left*
* Implement the remaining regex typesTavian Barnes2024-05-2812-0/+27
| | | | Closes: https://github.com/tavianator/bfs/issues/21
* tests: Add some more weird namesTavian Barnes2024-05-289-0/+67
|