Age | Commit message (Collapse) | Author |
|
When we "losetup" success need mount loop device.
Found this issue on AndroidQ
|
|
|
|
(Also show unknown values on Linux in hex rather than just "unknown".)
|
|
Move longopts after their corresponding shortopts instead of before
|
|
|
|
The Mac iconv_open(3) doesn't follow Unicode TR#22 rules for charset
alias matching that bionic and glibc do (and, strictly, POSIX doesn't
say you have to even though it's obviously a good idea), so we have
to say exactly "UTF-8" rather than "utf8".
Additionally, the 2006-era bash 3.2 on current versions of macOS
(because it was the last GPLv2 bash) seems to have bugs that cause
it to mangle UTF-8 input, so we can't reliably echo a UTF-8 sequence
into a file. Use \x in the tests to work around this.
|
|
|
|
Includes new tests.
|
|
One is really "the command is too long for me to ever call it given
other constraints", so leave "argument too long" for the case where it's
actually an argument causing the issue.
|
|
|
|
|
|
but the problem is some vertical sort arrangements are impossible, and that's
what it was testing for. For example, showing 29 entries in 9 columns with
horizontal sort requires 4 rows:
1 2 3 4 5 6 7 8 9
10 11 12 13 14 15 16 17 18
19 20 21 22 23 24 25 26 27
29 29 x x x x x x x
But with vertical sort that would be:
1 5 9 13 17 21 25 29 x
2 6 10 14 18 22 26 x x
3 7 11 15 19 23 27 x x
4 8 12 16 20 24 28 x x
It still doesn't fit in 3 rows (3x9=27) but with 4 rows the 7 leftover spaces
eats a whole column, so you _can't_ have 9 columns with vertical sort.
|
|
in whitespace accounting, eliminate lastcol, same sort[next] in dt, don't
count trailing whitespace on last entry in row.
|
|
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.
|
|
|
|
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).
|
|
|
|
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
|
|
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>
|
|
And a few small cleanups while I was there.
|
|
back when they haven't specified -s, add tests.
|
|
And check in more multicast support that's been sitting in the tree, I don't
have a test enviornment for it anymore but somebody wanted this...
|
|
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.
|
|
|
|
|
|
add: linelist unload
fix: proper utf8 handling on insert mode backspace
fix: free allocated data at exit
cleanup: rename some variables to be describive but short
cleanup: reorganize some variables in main
|
|
Added: parsing of redirectation responses, will now follow redirectation
path until maximum of 10 jumps. This will probably lead to server
advertising user the https url.
|
|
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
|
|
|
|
|
|
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>
|
|
|
|
Inline array becomes garbage outside the if.
|
|
The <netdb.h> functions have their own errno :-(
|
|
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.
|