Age | Commit message (Collapse) | Author |
|
Fix `losetup -f` to not fail with an error.
Add the missing \n for `losetup -f --show FILE`.
Use decimal for the device number, like the desktop losetup.
Switch to the FLAG macro.
Make the tests runnable as tests, and expand coverage a bit. With this
patch, the tests pass both with and without TEST_HOST on the desktop.
Note though that this patch is part of fixing some real-life losetup
issues, not part of the "test cleanup" I'm also looking at. losetup is
low down that list!
|
|
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.)
|
|
We'd documented find %Z but not implemented it. We'd neither documented
nor implemented stat's corresponding %C (they'd already taken %Z for
ctime, which is ironic because %c/%C sounds more obvious than %z/%Z for
that to me).
|
|
|
|
|
|
|
|
next_printf() shouldn't return null unless it never found the start of an
escape sequence (it'll return a pointer to the null at the end of the string
otherwise), and the only time we point it at a % and it doesn't is when it's
%%. So handle that before calling. (Also, a single trailing % prints in
other implementations, and while I'm there update to use FLAG() macros,
add a couple comments, and only xflush() once per pattern.)
|
|
When the specified format string has odd '%' in the end,
the next_printf function will return null. Checking
the result value before using it.
Signed-off-by: liwugang <liwugang@xiaomi.com>
|
|
|
|
Also be a bit more consistent about `COMMAND [ARG...]` in usage text.
|
|
|
|
|
|
|
|
--signal is simply a synonym for the exiting -s.
--foreground disables functionality we didn't yet have: putting the
child into a new process group. I've added the functionality and the
flag to disable it.
--preserve-status also makes it clear that our exit statuses didn't match
the coreutils version. In addition to callers that use --preserve-status
to get away from this madness, I also have callers that check for
specific exit values. This patch implements --preserve-status but also
fixes all the other exit statuses.
(The "125" exit value is broken for toybox in the same way that
`toybox grep --whoops ; echo $?` is. To fix this, we'd need some way to
signal that command-line parsing failures should exit with a different
value than the usual 1 --- 2 for grep, 125 for timeout. I've done as much
as grep manages, and left a TODO.)
Also add timeout tests. I couldn't think of an easy test for
--foreground, so I tested that manually with strace.
Also add some newlines to the `toybox --help` output to make it easier
to find the different sections, and expand the section on durations to
call out that fractions are supported as a matter of policy.
As long as timeout and sleep have text describing the duration syntax,
make them the same. (Personally I'd remove both in favor of the `toybox
--help` output, but as long as they're duplicated, keep them consistent.)
Also remove the SLEEP_FLOAT variant --- xparsetime means that sleep no
longer requires floating point to support sub-second resolution.
|
|
stdin/stdout filehandles.
|
|
|
|
|
|
|
|
More consistent tense, capitalization, and punctuation. A few commands were
missing an introductory line, so I copied those from the first comment
line.
|
|
Do the FLAG() and short argument variable cleanups while we're there.
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Used in the AOSP x86 host build.
|
|
Internally, Google uses all the longopts; Android currently only uses
this one. I was tempted to add the others, but went with "add them when a
toybox user needs them" rather than "add them when you've seen them used".
|
|
Be consistent about upper versus lower case. (Upper seems to have the
majority, so I went with that, though I'm happy to provide the opposite
patch as long as we're consistent!)
Be consistent about using \t. (Though saving a few bytes seems like it
might be better done in the code that generates help.h rather than
directly in the source, since tabs make careful ASCII art layout hard
enough that we regularly have things misaligned.)
Remove trailing periods (most of which seem to have been added by me).
Always use the US "human readable" rather than my British
"human-readable", and be more consistent about declaring whether we're
showing multiples of 1000 or 1024.
Just say "verbose" rather than adding a useless "mode" or "output".
|
|
|
|
|
|
|
|
|
|
|
|
xparsetime() not to need floating point, adjust callers.
|
|
From eyeballing the output of
for i in `./toybox | tr " " "\n"` ; do ./toybox $i --help ; done | \
grep '^-' | grep -v "\t"
|
|
|
|
Bug: https://github.com/landley/toybox/issues/104
|
|
|
|
|
|
(Fixed one declaration not at start of a block.)
|
|
|
|
|
|
|
|
|
|
(My apologies for mixing these two unrelated changes up.)
|