Age | Commit message (Collapse) | Author |
|
|
|
TT.file_no was being incorrectly calculated as 0 when tail -f was passed
a single argument.
|
|
|
|
copying itinto a second variable. Also add error message for empty ( )
|
|
eliminate syntax_error() function (just call error_exit() directly),
eliminate advance() wrapper, pipe expected error messages in test to /dev/null
|
|
All tests pass now; this fixes the 2 remaining failures, including a
segfault.
The structure of the code has changed a lot -- instead of having a tiny
function per operator, we have eval_op() which does common type coercion
and then evaluates the operator. I tried writing it a couple different
ways, and this was the cleanest.
The OPS table now contains the operator string, precedence level,
signature for type coercion, and operator ID.
|
|
expr now uses the precedence table specified by POSIX, implemented using
the "precedence climbing" algorithm. See the references at the top of
eval_expr().
This fixes 3 of 4 failing tests.
I also added more tests for correct behavior and for syntax errors.
This includes a new test exposing a segfault, related to type coercion.
|
|
|
|
|
|
numbers even though we use unsigned math now.
|
|
|
|
header unconditionally. (This fixes the warning when CP_PRESERVE disabled.)
|
|
Found by afl-fuzz.
|
|
(This should fix allyesconfig.)
|
|
handle infinite depth. Fix docs, tweak dirtree_handle_callback() semantics,
remove dirtree_start() and don't export dirtree_handle_callback(), instead
offer dirtree_flagread(). (dirtree_read() is a wrapper around dirtree_flagread
passing 0 for flags.)
|
|
|
|
- shorten error messages
- replace mk_rq with sprintf
- remove struct and defines
- change unsigned int to unsigned
|
|
next few fields in the order the other implementation outputs, fewer commas,
fix a big where big endian executable type wasn't detected right,
and fix the filehandle leak.
|
|
accept that as input. (And that I screwed up the test.)
|
|
|
|
|
|
|
|
|
|
|
|
major/minor/makedev, but glibc has vowed to break existing programs
(https://sourceware.org/ml/libc-alpha/2015-11/msg00253.html)
and replace it with _another_ non-standard header (not in posix or lsb),
so let's just add functions to lib/ that do the transform ourselves.
|
|
|
|
3.8 kernel in 2012. That's way too new to assume the build environment has
it, so #ifdef and simulate a failure if it's not there.
|
|
The clang FORITFY implementation doesn't like pointer signedness mismatch.
"What mismatch?", you say. "The historical bug in LP32 Android that left
it with a signed socklen_t".
|
|
|
|
|
|
|
|
|
|
- per POSIX, 'cannot open' must be in the 'type' string if open() fails
(both EPERM and ENOENT); we only do that if open() succeeds and fstat(fd)
fails.
- symlink detection (as per POSIX) won't work: opening them O_RDONLY
results in following the link, then we fstat() the fd.
- file 'FIFO' causes a hang; open() won't return till there's a writer.
|
|
|
|
|
|
for 2-argument version.
|
|
port 80 is not used.
|
|
Accept multiple -p, inline filter_matches, convert misleading "char* a, b" to
"char *a, b", use readfile() to read a file, use DIRTREE_SHUTUP, don't need
{ } around a single line, don't modify command line environment space
(which changes what ps/pgrep sees).
|
|
Also use finit_module if available. Given that "insmod -" requires
init_module, maybe this isn't a worthwhile optimization. Given that
"insmod /actual/file.ko" is the common use case, maybe it is.
Fix a bug in readfileat where *plen would be corrupted if you didn't supply
your own buffer (because ibuf is 0 in that case, not a pointer to the start
of the allocated space).
|
|
|
|
SELinux denials include hex-encoded paths in the log messages; xxd -r -p is
a convenient way to decode them.
The heuristics are a little weird to my mind, but match the documentation
and observed behavior.
|
|
It uses a sed expression that assumes you can escape - to use it as a literal
(you can't, it has to be first or last char of the range), and assumes
you have to escape delimiters in sed [] context (you don't), and/or that
non-printf escapes become the literal character (they don't, the backslash
is preserved as a literal), meaning it winds up doing "s/[\-\]//" which is
a length 1 range, which is officially undefined behavior according to posix,
and regcomp errors out.
But if we don't accept it (like other implementations do) the perl build
breaks. So collapse [A-A] into just [A].
Testcae taken from perl 5.22.0 file Makefile.SH line 8.
(While we're at it, remove an unused argument from a function.)
|
|
Add support for a -Z option to getprop that will either print the
SELabel of a given property if one is provided or print all properties
that have been set along with their SELabel.
Also, correct a memory leak when freeing TT.nv.
|
|
This adds the missing "relatime" option, fixes error handling logic (mount
returns 0/-1, not an errno value, and I at least get EACCES rather than
EROFS in the case where the underlying block device is read-only; we should
also probably only try again if the ioctl actually succeeded), and adds the
missing newline in case where we go around and try again read-only.
The test case was "mount -o rw,remount /system" on Android.
|
|
|
|
|
|
Unlike the POSIX file(1), there's no magic file here, just hard-coded
common (non-obsolete) file formats. Personally most of my use of file(1)
is as a one-line readelf(1) summarizer, so although I assume a full POSIX
file(1) is out of scope (because just the database would likely be larger
than all the rest of toybox), a subset that only supports in-use file types
actually covers most of the use cases I encounter personally.
Also fix peek_be/peek_le.
|
|
Check the fstat(2) return value rather than read uninitialized memory if
it failed, and add a special case for files that claim to be zero-length
but aren't (as is common in /proc on Linux).
|
|
clang scan-build flags up this line as being unread, so clearing from code.
|
|
Pathnames may be longer than the name field in the header, so use
strncpy() instead of xstrncpy() to avoid bailing out.
Also add unit tests to ensure proper handling of short and long
pathnames.
Change-Id: Id025891993746889564b479e5185cf9721b54a55
|