Age | Commit message (Collapse) | Author |
|
Instead of unlink() && check errno, call lstat() explicitly to check
file existence if "-f" is specified.
There is a regression when if the path to be removed is nonexistence
and within a readonly filesystem, then unlink() could set the EROFS
errno instead of ENOENT, thus screwing up the output of `rm`.
|
|
or else singlemake enables it for all commands. (I was trying to
move it out of the command namespace, but it's not a global config
option either...)
|
|
|
|
|
|
and address TODO where -z was still splitting patterns on \n
|
|
no argument returns NULL same as --opt without =
|
|
The kernel will do this for us on both Linux and macOS, but error
messages are a bit misleading if we don't do it ourselves --- it
can look as if the failure is because of the type bits.
|
|
configurable.
|
|
The GNU tar manual, when talking about the `tar --transform` option that I
need to implement, describes the 'x' flag by saying "regexp is an extended
regular expression (see section 'Extended regular expressions' in GNU sed)".
Only it turns out that even the latest GNU sed doesn't actually have
that flag. It's unique to `tar --transform`. That link is just telling
you that the sed manual will explain extended regular expressions, not
that GNU sed also supports the 'x' flag.
So I don't know whether we want this in toybox sed after all. (It made
sense that sed would have such a flag, but no sed that I know of
actually does.)
|
|
|
|
|
|
tests to catch this. While there add -k to test sticky bit.
|
|
|
|
|
|
|
|
I didn't know until implementing this that --iso is actually called
--iso-8601 and that GNU date will actually accept any prefix. --iso-8
works fine too. I've assumed that --iso (that I always used) and
--iso-8601 (as given in the documentation) are the only two that matter.
|
|
|
|
I promised months ago I'd fix this, and there was a (not visible to the
public but filed by a member of the public) bug filed against Android in
the meantime, but judged No Security Impact because "toybox is not a
security boundary". Anyway, it seemed high time I learned about fuzzing
command-line tools with AFL++, so here we are.
With these patches (and starting from the ELF files in test/files/elf),
toybox file survived ~24hours against AFL++. Amusingly it corrupted the
ELF files hard enough that it also managed to find a bug in the code
for MS-DOS executables, which is the motivation for the final hunk in
this patch.
Bug: http://b/159065007
Test: ~/AFLplusplus/afl-fuzz -i tests/files/elf -o fuzz-out -- ./file @@
|
|
|
|
Android is introducing a new binary XML format that is a drop-in
replacement for many existing .xml files written by system_server.
Since engineers may be surprised when encountering this new format,
add it to the "file" tool to aid identification in the field.
|
|
One reason to use toybox on the host is to get the same behavior across
Android/Linux/macOS. Unfortunately (as we've seen from a few bugs) one
area where that doesn't quite work is that toybox uses the libc regular
expression implementation. That's fine, and mostly what users want, but
those folks trying to get the exact same behavior everywhere might want
to switch in a known regex implementation (bionic's NetBSD regex
implementation, say) for increased consistency.
That actually works pretty well, but portability.h has an #ifndef test
for REG_STARTEND before including <regex.h> that gets in the way. To
make up for that, this patch removes the unnecessary #include <regex.h>
from grep.c itself.
|
|
|
|
The comma thing turned into an internationalization can of worms,
don't go there. Keep the "show megabytes on systems with >10G"
logic which includes not showing 0.0 for single digit values.
|
|
|
|
and use the comma format when selected even if <3 digits (no 0.0M)
|
|
string parsing error. This patch enables proper local facility handling.
|
|
|
|
|
|
This also changes the other compression options (such as -j) so that we
pass no arguments for compression and just -d for decompression, which
is what -I does to its filter and which appears sufficient. (I think I
used -dc before just out of habit, since that's what I've been typing on
the command line for decades.)
|
|
|
|
Also, the failing mv test was because posix says to prompt when mv-ing over an
unwriteable file only when stdin is a tty (but -i prompts either way)
|
|
Also fix help text to say that it is not the default.
|
|
|
|
Allow -pd to work by changing -p from an option that takes an
argument to an option that implies there will be an argument (that
is, `-pd x` is `-p -d x` with x being the directory for -p, rather
than `-p d x` with d being the directory, as we previously interpreted
it).
Fix -d (aka --make-directories) to not be a no-op. Previously we
acted as if this was always on.
Accept --quiet and effectively just ignore it, since toybox cpio
doesn't seem to produce any output that --quiet would suppress.
|
|
|
|
|
|
Heavily used long params under some contexts for already implemented
options:
chgrp/chown:
Add alias '--no-dereference' for '-h'
rmdir:
Add alias '--parents' for '-p'
|
|
Requested in https://github.com/landley/toybox/issues/130, quoting an
old version of the toybox help. This is also supported by coreutils.
Set $LANG to C in the date tests so that they pass with TEST_HOST=1
(they were already failing for me, presumably related to a newer glibc).
|
|
|
|
has a build script that goes much faster with it, and added tests for it.
I reimplemented it a different way, and did SIGUSR1 and SIGUSR2 support.
|
|
|
|
Fixes #227.
|
|
|
|
(Also fix -v output going to stderr when it shouldn't.)
|
|
This let me compare against the host for #225.
|
|
|
|
Found trying to run the libc++ tests.
For coreutils, `info chmod` says:
'chmod' ignores symbolic links encountered during recursive directory
traversals.
Bug: http://b/155809792
|
|
|
|
|
|
|