summaryrefslogtreecommitdiffstats
path: root/exec.c
AgeCommit message (Collapse)Author
2019-07-05exec: Mark a formatting function as BFS_FORMATTERTavian Barnes
2019-06-16exec: Assert that at_fd is the immediate parentTavian Barnes
2019-01-02diag: Unify diagnostic formattingTavian Barnes
This adds a bfs: prefix to error/warning messages for consistency with other command line tools, and leaves only the "error:"/"warning:" part colored like GCC. It also uniformly adds full stops after messages.
2018-11-14exec: Reject -exec \; without a commandTavian Barnes
Prior to this, we'd fork and then segfault on every file as NULL was passed to execvpe(). Found while looking through old FreeBSD find bugs: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=36521 bfs still supports the (dubious, possibly unintentional?) GNU find extension to POSIX that allows $ bfs -exec {} \;
2018-09-18spawn: New posix_spawn()-like API for execTavian Barnes
2018-09-12exec: Don't leave zombies around if the child fails to exec()Tavian Barnes
2018-09-10exec: More fixes for bfs_exec_debug() changing errnoTavian Barnes
2018-07-08exec: Add some debugging info about failed commandsTavian Barnes
2018-07-07exec: Make ARG_MAX accounting a bit less restrictive with large pagesTavian Barnes
For Linux-style accounting, we really only need to handle a single page of wasted space due to rounding. Subtracting two pages for extra headroom was reasonable on systems with 4K pages, but overkill on systems like ppc64le with 64K pages. Worse yet was the fact that Alpine Linux only gives us 128K for arguments. Instead, only subtract a single page, plus the POSIX-recommended 2048 bytes. Credit to Mike Sullivan for the initial patch and testing on Alpine ppc64le. Fixes: http://build.alpinelinux.org/buildlogs/build-edge-ppc64le/testing/bfs/bfs-1.2.2-r0.log Co-authored-by: Mike Sullivan <mksully22@gmail.com>
2018-06-25exec: Don't assume bfs_exec_debug() doesn't change errnoTavian Barnes
2018-02-10exec: Fix size accounting when recovering from E2BIGTavian Barnes
2018-02-06exec: Avoid a warning when building with _FORTIFY_SOURCETavian Barnes
Also, don't pass the address of errno itself to write(), since write() is allowed to modify it.
2017-11-13exec: Minor whitespace consistency fixTavian Barnes
2017-11-12exec: Recover from E2BIGTavian Barnes
2017-10-26exec: Make argument size tracking robust to page-granularity accountingTavian Barnes
From looking at the Linux exec() implementation, it seems a big part of the reason we needed extra headroom was that the arguments/environment are copied page-by-page, so even a small accounting difference could result in an error of an entire page size. Grow the headroom to two entire pages to account for this.
2017-10-22exec: Apply more headroom to avoid E2BIGTavian Barnes
I ran into "argument list too long" errors with a bfs -type f -exec grep pattern '{}' + command, despite the current accounting being pretty careful. Some experimentation showed that an additional 2048 bytes of headroom is always safe. While we're at it, explicitly account for the terminating NULL pointers in argv and environ.
2017-09-16opt: Separate optimization from parsingTavian Barnes
2017-07-29exec: Fix more corner cases with -ok ... +Tavian Barnes
-ok should look for a ; even if it sees {} +, according to POSIX.
2017-07-29exec: Don't allow anything between {} and +Tavian Barnes
POSIX explicitly forbids this extension: > Only a <plus-sign> that immediately follows an argument containing > only the two characters "{}" shall punctuate the end of the primary > expression. Other uses of the <plus-sign> shall not be treated as > special.
2017-07-29util: Define O_DIRECTORY to 0 if it's not already definedTavian Barnes
2017-07-27Re-license under the BSD Zero Clause LicenseTavian Barnes
2017-07-15Handle yes/no prompts correctly according to the localeTavian Barnes
2017-07-08exec: Clear errno when a multi-exec doesn't failTavian Barnes
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.
2017-05-09Implement -D execTavian Barnes
2017-04-30exec: Treat -1 from _SC_ARG_MAX as "unlimited"Tavian Barnes
2017-04-15exec: Interpret ARG_MAX corretly.Tavian Barnes
Thanks to https://www.in-ulm.de/~mascheck/various/argmax/
2017-04-15exec: close() the working directory even if !ftwbufTavian Barnes
2017-04-15Implement -exec/-execdir ... +Tavian Barnes