Age | Commit message (Collapse) | Author |
|
glibc doesn't set errno when getpw* fails, so the perror_exit() looked
fine. bionic sets ENOENT and the trailing "No such file or directory"
looks silly, so switch to error_exit().
Additionally, the default format tests fail on Android because of
SELinux (but for a different reason than usual!). There's no id
--no-context flag, so use sed to just throw away any SELinux context.
|
|
The previous patch broke -nG, so move the -G code back to showone()
which handles -n.
Add the missing tests for the various uses of -n.
Also refactor the code to avoid the need to test optflags directly.
|
|
variable declarations go at the start of blocks, and remove specific
people's names from todo items (anybody can do any todo).
|
|
Handle unknown groups (fixes #117).
Fix -G to show *all* groups, not just all supplementary groups.
Fix -Z output to not include "context=".
|
|
Fall back to converting the "name" to an integer and calling getpwuid().
We need to update `username` for the later call to getgrouplist().
Also fix the separator printing logic to avoid a trailing ',' on `id 0`.
Switch to FLAG() and move some declarations down to where they can be
initialized, both for clarity.
Also add simple tests. Sadly, there's no always-present user that is in
multiple groups.
|
|
When in modes `-C` and `-x` we need to remove the trailing whitespace
on each line. This is the behavior of other `ls` commands.
Other `ls` commands will print the last filename and then print a
newline. Prior to this patch we would print the last filename, followed
by two spaces, and then print a newline.
Previously, we would get to the end of the loop and print the padding.
I couldn't figure out a way to determine when the program had reached
the end of a line. So I piggybacked off of the newline code.
|
|
|
|
|
|
slash
|
|
the -0 "argument too long" issue.
|
|
but --restrict checking should run on the path up to the last component
before unlinking so tar can't be tricked into deleting random files off
the system.
|
|
Reason: unicolumns() does not print combining characters correctly
Combining characters follow the character which they modify.
https://www.cl.cam.ac.uk/~mgk25/unicode.html#comb
xterm renders cut test1.txt -C -1 now correctly
|
|
And a few small cleanups while I was there.
|
|
back when they haven't specified -s, add tests.
|
|
checked relative to the current directory, not from where the symlink lives.
|
|
|
|
(it returns a malloc), and doesn't match the object lifetime of getbasename()
(which always returns some or all of its argument string). The dirname() in
libc modifies its argument string, but that's what posix says to do:
https://pubs.opengroup.org/onlinepubs/9699919799.2008edition/functions/dirname.html
so I guess we can live with it.
|
|
|
|
|
|
We need two spaces between filenames because that is the convention
followed by other implementations. More importantly, if we do not have
two spaces, certain Unicode file names cause filenames to run together.
In Unicode, combining characters come before the character they modify.
If a filename ends in a combining character, the combining character
attaches to the space that follows it, causing the space not to be
visible. Having a two-space gap stops the above issue from happening.
For context and a bit more information, see mailing list link below.
https://www.mail-archive.com/toybox@lists.landley.net/msg05986.html
|
|
|
|
|
|
|
|
Inline array becomes garbage outside the if.
|
|
Don't run the command with no arguments if we run out of input but
have already run the command at least once. The implementation of "run
the command at least once (unless -r was supplied)" wasn't taking into
account whether or not this was our first time round the loop.
Fix the exit value, and the -- already documented but not implemented --
behavior if a child exits with status 255.
Also extend the tests to cover these cases, plus cases I broke while
coming up with the fix. Add more tests to convince myself that we've
correctly interpreted how -s is supposed to behave, and fix the corner
cases at the bottom end of the range.
This fixes some issues we were seeing trying to build the Android SDK
for (and more importantly, on) macOS.
|
|
When user builds toybox CFG_TOYBOX_I18N disabled and tries to list
folder contents with multibyte characters other than UTF-8 ls might
seqfault since wcrtomb returns -1
while locale set to fi_FI-UTF-8 disable CFG_TOYBOX_I18N
touch őőőőaaőő
ls
|
|
|
|
We're inconsistent about whether the option help below should be just `-t`
or `-t DIR`, but the majority of commands _don't_ repeat their argument,
so I've left that as-is for now.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The "gratuitous extra entry" is only gratuitous when there isn't a hole. (Which
we can detect and not include but then we wouldn't match other implementations.)
|
|
|
|
|
|
|
|
|
|
(oops.)
|
|
length of sparse files properly.
|
|
|
|
|
|
(All ignored, because they disable stuff we don't do.)
|
|
|
|
Two more spacing bugs here, one before the security context for -Z, and
one after the size with --full-time.
Before:
$ ./toybox ls -lZ --full-time Config.
-rw-r----- 1 enh primarygroup? 56162019-09-07 21:09:32.892215100 -0700 Config.in
After:
$ ./toybox ls -lZ --full-time Config.
-rw-r----- 1 enh primarygroup ? 5616 2019-09-07 21:09:32.892215100 -0700 Config.in
|