summaryrefslogtreecommitdiffstats
path: root/exec.c
Commit message (Collapse)AuthorAgeFilesLines
* exec: Don't leave zombies around if the child fails to exec()Tavian Barnes2018-09-121-10/+10
|
* exec: More fixes for bfs_exec_debug() changing errnoTavian Barnes2018-09-101-3/+4
|
* exec: Add some debugging info about failed commandsTavian Barnes2018-07-081-5/+19
|
* exec: Make ARG_MAX accounting a bit less restrictive with large pagesTavian Barnes2018-07-071-3/+6
| | | | | | | | | | | | | | | | | | | 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>
* exec: Don't assume bfs_exec_debug() doesn't change errnoTavian Barnes2018-06-251-4/+3
|
* exec: Fix size accounting when recovering from E2BIGTavian Barnes2018-02-101-4/+6
|
* exec: Avoid a warning when building with _FORTIFY_SOURCETavian Barnes2018-02-061-1/+6
| | | | | Also, don't pass the address of errno itself to write(), since write() is allowed to modify it.
* exec: Minor whitespace consistency fixTavian Barnes2017-11-131-1/+1
|
* exec: Recover from E2BIGTavian Barnes2017-11-121-18/+77
|
* exec: Make argument size tracking robust to page-granularity accountingTavian Barnes2017-10-261-3/+8
| | | | | | | | 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.
* exec: Apply more headroom to avoid E2BIGTavian Barnes2017-10-221-4/+16
| | | | | | | | | | | | | 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.
* opt: Separate optimization from parsingTavian Barnes2017-09-161-1/+1
|
* exec: Fix more corner cases with -ok ... +Tavian Barnes2017-07-291-9/+10
| | | | -ok should look for a ; even if it sees {} +, according to POSIX.
* exec: Don't allow anything between {} and +Tavian Barnes2017-07-291-75/+30
| | | | | | | | | 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.
* util: Define O_DIRECTORY to 0 if it's not already definedTavian Barnes2017-07-291-5/+1
|
* Re-license under the BSD Zero Clause LicenseTavian Barnes2017-07-271-10/+15
|
* Handle yes/no prompts correctly according to the localeTavian Barnes2017-07-151-7/+1
|
* exec: Clear errno when a multi-exec doesn't failTavian Barnes2017-07-081-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.
* Implement -D execTavian Barnes2017-05-091-5/+44
|
* exec: Treat -1 from _SC_ARG_MAX as "unlimited"Tavian Barnes2017-04-301-1/+1
|
* exec: Interpret ARG_MAX corretly.Tavian Barnes2017-04-151-33/+111
| | | | Thanks to https://www.in-ulm.de/~mascheck/various/argmax/
* exec: close() the working directory even if !ftwbufTavian Barnes2017-04-151-1/+1
|
* Implement -exec/-execdir ... +Tavian Barnes2017-04-151-0/+456