Age | Commit message (Collapse) | Author |
|
We were doing two 32-byte memset()s instead of two 16-byte memset()s.
'dir' referred to the instance (array of 2) and not the struct type.
Add some test coverage for diff, including a case that hit this bug.
The bug was found by running cp.test under AddressSanitizer, since it
happens to use diff.
|
|
While we're at it, use unsigned for the line length.
|
|
|
|
both did it) so use getbasename instead.
|
|
|
|
This fixes a failing test case in mv.test.
Test changes:
- Add coverage for -i (interactive).
- Better descriptions, better formatting, and removed some redundant
cases.
|
|
When passed an empty string, glibc's basename() returns a pointer to the
string "." in read-only memory. If an empty suffix is given, it fits
the condition of being shorter than the path, so we try to overwrite the
null byte and crash. Fix this by just ignoring empty suffixes; they
don't do anything anyway.
|
|
I'm not an od user myself, but I copy & pasted an 'od' invocation from a bug
and it didn't work. Which was embarrassing because I'd just claimed that the
od user didn't need to run od on their desktop (as they had done) and could
have run it on the device instead...
|
|
effect of "sed -e 'a\'" with no trailing line). But there's an actual user,
and it's not hard to implement, and it's not hard to implement, and there
isn't an obvious _other_ way to do it, so add the behavior and a test for it.
Fix some bad/missing comments while I was there, and add a couple TODOs.
|
|
off the start of the string. I pulled on the thread...)
|
|
vfat labels have a fixed space allocated for them. In the case of a
shorter label, the remaining bytes are padded with spaces. A vfat
filesystem with no label (i.e. that will show up in Windows as "Local
Disk (X:)" or "Removable Disk (X:)") is stored as "NO NAME ".
Both of these changes match behavior from util-linux.
|
|
Fix memory leaks in regex. Simplify regex check (if we matched, subexpression
had to match). Don't exit() from a command, set exitval and return.
|
|
I deliberately didn't do this first time round because for me our lsof
is already 10x faster than traditional lsof, and caching means we potentially
give less information about a socket that's created while we're running.
It turns out that traditional lsof caches anyway, so I guess nobody cares.
This also fixes a mistake where lsof used CFG_FREE instead of CFG_TOYBOX_FREE.
|
|
|
|
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.
|