Age | Commit message (Collapse) | Author |
|
This failure was a little hard to parse:
tar: Unknown option mode (see "tar --help")
This would have been clearer:
tar: Unknown option 'mode' (see "tar --help")
|
|
some other way.
|
|
|
|
Sets ->again |= 2 when that happens and ->st is zeroed.
While we're there, don't memset(st) and then memcpy(st) over it, and
use O_PATH in the open().
|
|
macOS doesn't have real-time signals, and it has a slightly different
set of non-portable signals from Linux.
With this, the toybox `kill -l` output matches the default macOS kill(1).
|
|
Include all the signals, not just the POSIX ones.
In particular, improve support for real-time signals. My attempt to
switch AOSP builds over to toybox timeout got reverted when I broke the
ART build bots which use SIGRTMIN+2.
Also fix `kill -l 3` to show "QUIT" and `kill -l QUIT` to show "3".
Also make the `kill -l` output include numbers and names, and format it
to look better on a 80x24 tty, because it's always August 1978 somewhere.
|
|
This patch adds a BSD version of xgetmountlist (for the path ==
NULL case only), tested on macOS. It also papers over the differences
between macOS' and Linux's xattr APIs. For once I think the macOS
one is better. The imitation of mknodat I've had to write swings
things back in Linux's favor though.
BSD calls f_frsize by the name f_iosize instead. (FWIW, it looks
like this is meaningless on Linux and actually meaningful on macOS.)
I've added one #if to toys/ --- I'm calling pathconf in stat.c to
work around the absence of f_namelen, and have left a TODO with an
explanation. I'm not sure what the best fix is here, so punting.
No-one can agree what f_fsid is, even if they're all basically the
same, so work around the `val` versus `__val` issue between macOS
and Linux.
With this patch, it's now possible to build cp/mv/install and stat
for macOS too. (Which completes the set of "toybox commands currently
used on Linux as part of the AOSP build" if you ignore stuff that
deals with processes, which I doubt we'll ever be able to support
for lack of any API.)
|
|
These are Android specific, so not really helping the outside
community, and are getting more and more Android dependencies to work
correctly, so let's drop these from toybox and build them within
Android.
Change-Id: Ic6022f1f506e10868c61f55d64fa4e7c1b14eba2
|
|
Trivial breakage from the recent refactoring.
Also add tail to the default config for macOS.
I'm still unconvinced that CONFIG_TAIL_SEEK makes sense in a world
where inotify support is always built in, but that's an argument
for another day...
|
|
|
|
This only implements the format specifiers that I've seen used in the
wild (which is actually a significant fraction of the total supported by
findutils' find). The most obvious gap is in the time support. I'm happy
to add more, but didn't want to add stuff "just because".
I'd say %A@, %C@, and -- for SELinux users -- %Z are probably the most
plausibly useful formats still missing. I don't think the human-readable
date formatting is particularly useful unless someone's seen it actually
used in the wild. The %T+ "full ISO" format being the most likely
exception to that.
Anyway, this is enough for me get started building AOSP with toybox find.
|
|
into a structure passed as arguments, add x prefix to functions that can fail,
add overflow test.
|
|
Factor out the inotify code and add a kqueue equivalent.
Specifically tested on macOS 10.14, but I assume this works for other
BSDs too, given that I worked from the FreeBSD man page...
|
|
|
|
|
|
|
|
|
|
|
|
This is a 15 year old freebsd extension (presumably thus also available on
MacOS) that glibc adopted in 2004, uClibc adopted in 2005, and bionic
supports. The only thing that DOESN'T support it is musl, once again
because its maintainer explicitly decided not to
(https://www.openwall.com/lists/musl/2013/01/15/26), so add an #ifdef
to let musl stay uniquely broken. (It'll stop at first NUL, everything
else can match NULs).
Finally fixes "s/x/y/g on a megabyte line of x's takes forever" issue.
|
|
Don't strlen() to find NUL to skip to until after we've confirmed first
section hasn't got a match (by calling regexec() on it).
|
|
|
|
Found when trying to update the toybox prebuilt used for the Android
build.
Also add the corresponding test.
|
|
They're forwarded to libprocessgroup, but we may as well go straight to
the source since neither library is in the NDK anyway.
This code is unfortunate because it means that even `toybox true` ends
up pulling in a JSON parser at runtime, because ps might call
get_sched_policy/get_sched_policy_name. I'll experiment with
dlopen-on-demand in portability.c and see whether the savings are
worthwhile, but for now at least use the current library directly so we
can save *one* dlopen!
|
|
libbuf instead of toybuf in lib/
|
|
|
|
|
|
leaking memory), and mod env command to test it.
|
|
|
|
|
|
Although we can get away with ignoring termcap/terminfo on the output
side by restricting ourselves to generally-supported escape sequences,
the input side is trickier because we need to support the sequences sent
by common terminals. Luckily, this isn't is as bad as it sounds because
only Home/End commonly differ. But it does mean we need a slightly
different implementation to deal with the many-to-one mapping.
Since we can't use TAGGED_ARRAY for this (without inflicting pain on all
the callers) I've also switched to OR-ing in the modifier keys, so we
have (say) KEY_UP|KEY_SHIFT rather than a separate KEY_SUP. This also
generalizes better should we ever need to support multiple modifiers at
once.
To reduce the number of #defines, I've also switched from KEY_F1,
KEY_F2, and so on to KEY_FN+1, KEY_FN+2, and so on. This isn't obviously
necessary, and easily undone if we'd rather have move #defines in return
for slightly more natural naming.
To enable all this, I've inverted scan_key and scan_key_getsize so that
scan_key_getsize is now the underlying function, and we don't waste all
the top bits encoding width and height between scan_key and
scan_key_getsize.
Tested by pressing Home and End in hexedit in all of the terminals
available to me.
|
|
|
|
and tweak a couple comments.
|
|
|
|
SELinux on Android is unhappy if you try to read "/":
avc: denied { read } for name="/" dev="dm-3" ino=2 scontext=u:r:hal_dumpstate_impl:s0 tcontext=u:object_r:rootfs:s0 tclass=dir permissive=0
That could happen via the open of ".." too, and potentially any other
directory might have similar restrictions, so move all of the open calls
to using O_PATH.
O_PATH seems more intention-revealing given what this function is doing anyway.
|
|
|
|
SELinux on Android is unhappy if you try to read "/":
avc: denied { read } for name="/" dev="dm-3" ino=2 scontext=u:r:hal_dumpstate_impl:s0 tcontext=u:object_r:rootfs:s0 tclass=dir permissive=0
O_PATH seems more intention-revealing anyway.
|
|
and fix tests to pass on host too.
|
|
|
|
Now there's a second user... the libc function already null terminates
at len+1, and it doesn't malloc the full size if strlen() smaller so
the redundant termination stomped unallocated memory. Oops.
sort.c never noticed because it calculated length to truncate or copy
existing string, so never hit this.
|
|
|
|
|
|
|
|
|
|
stdin/stdout filehandles.
|
|
|
|
|
|
|
|
Inspired by some of the small patches that have gone by recently.
Limited to only things found in `generated/help.h`, plus a wider cleanup
for the more common "milisecond" typo.
|
|
always set SO_REUSEADDR (which won't reuse an active port but merely disables
the strange "but reply packets might come in after we close the socket"
hand-wringing timeout nobody's cared about in decades.)
|
|
|