Age | Commit message (Collapse) | Author |
|
|
|
|
|
|
|
|
|
Includes tests for the new feature, and a failure case for the minimal
perms test as well.
Also some typo fixing / massaging the help text so it fits in 80
columns.
|
|
move slot[] documentation into C code, add PR %VSZ VIRT RES SHR
|
|
|
|
|
|
|
|
instead of carving up toybuf by hand. This makes breaking out the field
conversion logic into its own function less expensive.
|
|
Change readfileat() to pass back length of read.
|
|
1) It read st_dev instead of st_mode.
2) It reversed the semantics of absolute vs minimal ('-' prefixed) tests.
Add tests for these, and move the "unterminated -exec" test into the "Still
fails" section because it's still dumping core for me.
|
|
|
|
Four-digit years were being mangled by the code for two-digit years.
Move all the two-digit year code into the "we only saw two digits" case.
Add some new tests and fix existing tests.
|
|
functions to read major()/minor(), fix printf format warnings in error msg.
|
|
|
|
|
|
Both Android and GNU interpret -n to mean "show numeric users and groups",
despite what POSIX says.
|
|
This is equivalent to Android's historical "NAME" column, showing the
first element of /proc/pid/cmdline.
|
|
|
|
(The help infrastructure can collate and alphebetize short options,
long options haven't got a standardized help text format. Not a hard
requirement to have a short opt, but it's nice.)
|
|
"comm" is the command name without arguments, and "cmd" the command
line including arguments. Confusingly, "command" is a synonym for
the *latter*, not the former.
This implementation of "comm" matches the GNU ps behavior where the
names are truncated, but Android historically used the full name
from /proc/pid/cmdline instead, so this patch isn't sufficient to
let us match the Android behavior.
|
|
I actually thought ps was segfaulting, and it wasn't until I was in gdb
that I even noticed there was an error message at all, and even then I
had to read the source to work out what it was trying to tell me.
Before:
$ ps -o user,pid,ppid,vsize,rss,nice,wchan,addr,unknown,stat,cmd
ps: -o 'user,pid,ppid,vsize,rss,nice,wchan,addr,unknown,stat,cmd'@41
USER PID PPID VSZ RSS NI WCHAN ADDR$
After:
$ ps -o user,pid,ppid,vsize,rss,nice,wchan,addr,unknown,stat,cmd
ps: bad -o field 'user,pid,ppid,vsize,rss,nice,wchan,addr,unknown,stat,cmd'
^
|
|
As with ls, it doesn't seem like -Z should be guarded behind LSM
availability. On a non-SELinux system, the label is always "unconfined".
|
|
Used by Android.
|
|
(Matches beginning and EOF at once.)
|
|
|
|
This lets '(x)\1' match, as reported by Isabella Parakiss.
|
|
an extra newline because the test for whether we have an existing string to
append a newline to was checking if struct step had data appended to it,
and the /x/ regex is data appended to it. Change test to check for null
terminator at ->arg1 offset.
|
|
|
|
inspired by:
https://android-review.googlesource.com/#/c/152663/4/libc/bionic/fgetxattr.cpp
|
|
Also, if you mkdir "$(echo -e "one\ntwo"); chmod -r one*; ls -q one*
it honors -q.
|
|
the global so "install -g 0" doesn't alias to "cp --preserve 0" and error out.
through to --preserve 0"
|
|
On Android, the filesystem column is pretty wide. Actually measure the widths.
|
|
|
|
Adds XVFORK() macro, teaches xpopen_both() to call /proc/self/exe with NULL
argv (and converts cpio -p to use that), adds TOYBOX_FORK guards to some
unconverted commands.
|
|
Note: vfork(), like fork(), can return -1 if too many processes, and
we should notice and fail loudly.
|
|
Elliott Hughes found a bug https://android-review.googlesource.com/#/c/170020/
and Daniel K. Levy worked out the problem: the user/group/newer arguments
to find weren't consuming their arguments when not checking the results of
their comparison (because an earlier test had already caused their
parenthetical group to fail). This confused the argument parsing logic
and could lead to segfaults.
I applied a different fix that reorganized the existing tests instead of
adding a new test. (Looks like a big commit but it's mostly whitespace
due to extra curly brackets changing indendentation levels.)
|
|
|
|
|
|
This fixes the build break, the change to yesno() prototype accidentally got
checked in last commit. (Oops, sorry.)
|
|
and update the tests.
|
|
It turns out that people are anticipating the switch to toybox ls from
toolbox ls on the assumption that this will finally bring -h support.
Let's not disappoint.
I've merged two existing buffers in listfiles whose uses didn't
overlap into one. It may be possible to cram this into toybuf with the
other stuff, but it didn't seem worth the extra complexity for 64B of
stack, especially since we were already living with that for time
formatting anyway.
|
|
This doesn't address the lack of support for a variable-width
"Filesystems" column, but it doesn't make the current situation any
worse either.
This is the last of the missing -h options. The other commands with -h
also have --si, but only for df did it get a corresponding short
option (and I've never personally used --si on du or ls, so let's wait
until someone actually cares).
|
|
Right-aligned looks pretty good to me, but it's not what anyone else does.
|
|
We need to remove the destination, not the source, to be able to overwrite.
|
|
Now that the kernel's 128k environment size has been lifted, it might be
possible to feed in a gigabyte of suffix so argv[2] is enough larger than
argv[1] that char *s decrements past NULL and points to arbitrary high
memory (I.E. strlen(suffix) > (long)base), at which point the base > s
test is defeated and we strcmp() against a wild pointer.
Which is read only anyway and on 64 bit you probably couldn't hit any
interesting addresses, but the fix is easy enough: compare strlen values
instead of pointers. So do that instead.
|
|
|
|
Correctly and portably check for non-normal dates, and explicitly show
the "before" and "after" dates (in the format of the user's choosing).
Clear the struct tm in date_main rather than parse_default because on
one path the struct tm is actually initialized. Explicitly clear the
tm_sec field in parse_default because -- experiment shows -- that
should not be preserved. Only do the "what does this 2-digit year
mean?" dance if we actually parsed a 2-digit year. Show the right
string in the error message if strptime fails.
Also add more tests, and use UTC in the tests to avoid flakiness.
|
|
uninitialized trash in struct tm fields could segfault glibc's strftime().
|