| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
|
|
|
|
| |
The API remains similar, with some added accessor functions for lazy
initialization of the pwcache and mtab.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
| |
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 {} \;
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
| |
|
| |
|
|
|
|
|
| |
Also, don't pass the address of errno itself to write(), since write()
is allowed to modify it.
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
| |
-ok should look for a ; even if it sees {} +, according to POSIX.
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
|
|
|
| |
Thanks to https://www.in-ulm.de/~mascheck/various/argmax/
|
| |
|
|
|