Age | Commit message (Collapse) | Author |
|
|
|
Yeah, this limits 32 bit support, but that's a "fix it properly in lib/args.c
or don't care" issue. Why work around it here when truncate -s doesn't?
|
|
Increase memory:swpd,free,cache to 7 characters
Increase swap:si,so to 5 characters
Increase system:in,cs to 5 characters
Sample output from Pixel 4 phone:
procs ------------memory------------ ----swap--- -----io---- ---system-- ----cpu----
r b swpd free buff cache si so bi bo in cs us sy id wa
4 0 1111676 87896 6328 2268596 8152 11896 10712 14280 0 25712 31 21 46 3
17 0 1082788 224292 5972 2213996 73220 68908 2432 3948 1 26611 41 38 22 0
6 0 1127316 203196 5972 2225164 8980 53996 11796 788 0 25200 33 22 45 1
0 0 1133072 200984 5972 2225280 416 6260 52 88 0 8543 10 6 84 0
2 0 1128976 196976 5972 2225692 3588 0 340 800 0 5243 5 4 91 0
|
|
Bug: http://b/156292059
Signed-off-by: Wei Wang <wvw@google.com>
|
|
|
|
|
|
|
|
|
|
with memset() instead of = {}, and move TT.alarm to local variable.
|
|
Some of the bringup folks are debugging RTC issues and asked for this.
Rather than duplicate the weird xtzset dance with mktime, I've factored
that out into a new xmktime that takes a boolean for whether to use UTC
or local time.
Otherwise, the slight cleanup of hwclock.c is entirely optional. The
only functional change there is that util-linux 2.34's hwclock uses ISO
time format, which is the usual toybox preference anyway, so I've
switched it over to that rather than ctime(3).
Bug: http://b/152042947
|
|
In case I'm not yet in the running for the most pedantic change of this
release, I think the "days of the week are written with initial capitals
in English" subset of this patch is a strong contender.
(Found via `toybox help -a | ispell -l | sort | uniq`.)
|
|
|
|
I came here because the new -Wno-unreachable-code-loop-increment warning
didn't like the for loop on line 86. That loop is indeed not necessary.
Use strend() to do a string suffix match.
Use memmem() to search. It's available on macOS and Android by default,
but it's behind _GNU_SOURCE for glibc, so add that to portability.h.
Output the tags in the same order as the Debian modinfo.
I've left "parmtype" in even though the Debian modinfo doesn't output it
at all.
Also fix the tests so that they work on a device that has modules for
multiple kernels installed (like my laptop) --- make sure that the two
modules we pick come from the same kernel.
|
|
|
|
Also fix another bug where we were testing `set` twice.
Fixes https://github.com/landley/toybox/issues/172.
|
|
The e2fsprogs chattr(1) returns failure when it fails to do what was
asked of it, and so should we. Fixing this then reveals a lot of issues
with the tests that were being accidentally swept under the carpet.
The bulk of this patch is going through all the tests, removing the
duplicates and making the remaining tests more thorough.
I've tested this on ext4 and f2fs on a variety of 4.x and 5.x kernel
versions (but nothing older). We might need to reduce the list of
attribtues we try to toggle, but the more thorough tests use
well-supported attributes.
I've also fixed the -R test to actually involve a directory hierarchy.
|
|
When chattr fails in production, it helps to see what it was trying to
do. Reuse the lsattr format but without the '-'s.
Only read the flags if we have any intention of changing them:
`chattr -p 123` has no reason to read the flags.
Only write the flags back if they actually change: `chattr +a`
shouldn't do anything if that flag is already set, for example.
Switch -p and -v to perror_msg() instead of perror_exit() in case
they're used with -R.
(I suspect that the uses of DIRTREE_ABORT are mistakes given -R, but
I'll leave them until I actually hit this.)
|
|
Even GNU don't pretend they're still on 1970s terminals where ` and '
were a matching pair any more.
|
|
Rewrite -v and -p to not use ad hoc argument parsing.
|
|
Document all the attributes, and take less space doing so.
Switch to CAPITALS for user input in the synopses.
Don't imply that this is only for ext2 (but also don't try to list the
subset of file systems that do support which subset of attributes).
|
|
Add support for setting projid in chattr, and dumping it in lsattr.
Also fix the lsattr output formatting, and undo my well-intentioned
sorting of the flags because that broke the ordering in the lsattr terse
output.
|
|
Also update help to include flags that were already added. Remove
useless duplicative comments. Swich to FLAG macros.
|
|
-w was added recently. The change in behavior so we now always fork
means that it's needed in more cases too: other implementations of
setsid(1) only fork if getpgrp() != getpid(). This broke a script, which
is what made me notice the missing help.
This seems to have been an accidental change, and is contrary to what
the util-linux setsid(1) man page says: "The command calls fork(2) if
already a process group leader. Otherwise, it executes a program
in the current process", but whether we change our behavior or not, we
should document the new option.
|
|
set $HOME $PWD and $OLDPWD, fix prompt \w, shuffle some functions around
to avoid prototypes, implement tilde expansion, add FORCE_COPY.
|
|
|
|
builtin, and add -u.
|
|
|
|
Switch -t to -c (like man page says), add -w (wait) and -d (detach from tty)
|
|
(Also show unknown values on Linux in hex rather than just "unknown".)
|
|
|
|
My understanding is that uClibc is dead, and the probe for fallocate
would need to be made more complicated to work for macOS (where we fake
posix_fallocate() in lib/portability.c).
|
|
Having a dynamic memory pointer named as "s", issuing "free(s)" and then
performing "FLAG(s)" is correct: "FLAG(s)" is a macro which uses "s" as
a token and expands as "FLAG_s". At a glance, this would instead look
like a use-after-free violation.
Fix this readability issue by renaming the "s" pointer variable to
"f_path".
Change-Id: I51f139034a7dcd67a08a6952bc22c1a904162c65
Signed-off-by: Alessio Balsini <balsini@android.com>
|
|
The function loopback_setup() uses xabspath() to get the loopback path.
This function allocates dynamic memory which should be freed by the
function caller.
But there are early return cases where the dynamic memory is not freed.
Besides the special cases of perror_exit(), for which the "early" free
operation is simply used to silence memory analysis tools, the
if (racy && errno == EBUSY) return 1;
branch may be a real cause of memory leak.
Fix by adding a new free() in the racy+EBUSY branch and anticipating the
existing free().
Signed-off-by: Alessio Balsini <balsini@android.com>
|
|
The function loopback_setup(), after copying the loopback device name
with xstrncpy(), ensures the null-termination of the string by forcing
its last byte to 0.
Unfortunately, this operation:
- was probably intended to null-terminate dest instead;
- does not affect the program execution because src is free()d right
after;
- if the size of src is smaller than the offset of the written zero, it
modifies an unknown byte in the heap.
Drop the null-termination line to fix the issue: xstrcpy() automatically
null-terminates dest, or fails if the size of src is bigger than the the
requested number of bytes to copy.
Signed-off-by: Alessio Balsini <balsini@android.com>
|
|
I must have lost this line somehow when I moved the patch from my AOSP
tree to a toybox tree. (But the ln tests passed on the host because I
was using coreutils ln there :-( )
|
|
Required by the new `ln -t` test if it's to pass on an all-toybox
system :-)
|
|
Thanks for James McMechan for pointing this out.
Using esc[1L and esc[1M escapes with cursor jump to
1, 1 to make scrolling effect instead of S and T
fixes scrolling inside Linux terminal and tmux
-Jarno
|
|
xwaitpid(), fix off by one in xwaitpid().
|
|
There's nothing to stop a subprocess from catching our SIGTERM on timeout
and exiting, causing us to incorrectly report that it didn't time out.
Android's ART has a utility that does exactly this.
Explicitly catch this case, and add corresponding tests.
Bug: http://b/141007616
|
|
|
|
|
|
|
|
This gets the tests passing with both toybox and util-linux 2.32.1
blkid. We use -s to get around the fact that we still don't support ntfs'
$VOLUME_NAME attribute.
|
|
There's a race between LOOP_CTL_GET_FREE and LOOP_SET_FD. Work around it
by just retrying if we get EBUSY on the LOOP_SET_FD call. This is what
similar code in ChromeOS already does.
Bug: http://b/135716654
|
|
output 5 digits of octal stat data instead of 4, due to hardwired leading 0
instead of %04a sprintf prefix.
|
|
|
|
|
|
I started this last night, but thought I'd aim to send multiple small
patches rather than work through all the callers and send one big patch.
I've deliberately chosen the ugly name `allocated_length` because we've
had historical bugs where folks think this a line length in the sense of
the return value. I do wonder whether we should actually have some kind
of getline() wrapper that hides the `char *`/`size_t` pair in lib/,
which makes the function easier to use in most cases but does add the
less common gotcha that you wouldn't be able to getline() through
multiple files at once (which does happen in at least one toy).
But maybe the real fix is to look harder for places where we can just
use loopfiles_lines? Speaking of which, should we actually add two more
arguments to that? Specifically: switch it to getdelim() rather than
getline() behind the scenes, and also add a way to have the trailing
'\n' automatically removed, since that seems to be what most callers
want?
Anyway, that seemed like enough questions that it was time to send this
initial patch out before doing too much more...
|
|
Rename the existing xbind/xconnect to xbindany/xconnectany, to make room
for new xbind/xconnect that are more like 'x' versions of the regular
bind and connect. Move explicit bind/connect callers over to
xbind/xconnect.
Of the affected commands, only netcat is actually used by Android. It
was the most recent patch to netcat that made the lack of a more
traditional xbind/xconnect apparent.
|
|
Improve Android support (see code comments).
Remove unnecessary fixed-length limits.
Show error if module not found (plus test).
Expand help text.
Switch to FLAG macro.
Stop hard-coding module assumptions in the tests.
|