aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2019-11-03id: support numeric lookup.Elliott Hughes
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.
2019-11-03ip: remove get_line().Elliott Hughes
2019-10-31ls: Add tests for `-C` and `-x` optionsAndrew Ilijic
These tests ensure we follow the behavior of other `ls` commands, in the basic case.
2019-10-31ls: Remove trailing whitespace so that tests passAndrew Ilijic
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.
2019-10-30rfkill: remove get_line().Elliott Hughes
2019-10-29Let "find -L -type -l" find dangling symlinks.Rob Landley
2019-10-28Some basic stat tests.Rob Landley
2019-10-28Only create test file "input" when input argument isn't empty.Rob Landley
2019-10-28ls: Add `-w` which sets the column widthAndrew Ilijic
2019-10-28Switch the fudge factor from 2048 to 4096 to unblock android build.Rob Landley
2019-10-28cp: treat a directory name with a slash at the end the same as one without a ↵William Haddon
slash
2019-10-28More xargs cleanup, with one possible accounting error but not what fixesRob Landley
the -0 "argument too long" issue.
2019-10-27Switch fallocate to new style global names.Rob Landley
2019-10-27fallocate: remove uClibc workaround to benefit macOS.Elliott Hughes
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).
2019-10-27macOS: implement posix_fallocate().Elliott Hughes
2019-10-27Technosaurus on github pointed out the error message should say adjtimex.Rob Landley
2019-10-27Tar extract should delete files or symlinks where it's making a directory,Rob Landley
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.
2019-10-26cut: re-enable crunch_str on cut -CJarno Mäkipää
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
2019-10-26losetup: Change variable name to improve readabilityAlessio Balsini
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>
2019-10-26losetup: Fix memory leaks in loopback_setup()Alessio Balsini
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>
2019-10-26Add ln -r and relative_path() to lib, plus test.Rob Landley
And a few small cleanups while I was there.
2019-10-24Mention that posix-2008 moved to a different URL, and the RFCs from IETF.Rob Landley
2019-10-24Fix the xargs argument too long problem by putting the proper accountingRob Landley
back when they haven't specified -s, add tests.
2019-10-23Use adjtimex instead of adjtime (bionic hasn't got adjtime).Rob Landley
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...
2019-10-22JakeSFR on github pointed out that broken symlink relative detection was beingRob Landley
checked relative to the current directory, not from where the symlink lives.
2019-10-21xargs: add test for -E being a full match.Elliott Hughes
89a8d00e470f1999a62ceea81269af2f39c655ba broke -E by switching to a prefix match. 4e0d246ec98f2576d52eb5fd70cd6e86d542e2e4 fixed it again. Add the missing regression test.
2019-10-21Use FLAG() macros more.Rob Landley
2019-10-21Remove getdirname(), it's _not_ a drop-in replacement for dirnameRob Landley
(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.
2019-10-21lib: getdirname fix seqfault on null ptrJarno Mäkipää
In order to be used as drop in replacement for dirname() If path is a null pointer or points to an empty string, dirname() shall return a pointer to the string "." .
2019-10-21More xargs cleanup.Rob Landley
2019-10-21xargs: fix type of a local to avoid a cast.Elliott Hughes
2019-10-21vi: unalloc used memory, cleanups, fixesJarno Mäkipää
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
2019-10-19wget: Added support for HTTP 301 and 302 redirectsJarno Mäkipää
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.
2019-10-19Use the MKPATH macros in the mkpathat() implementation.Rob Landley
2019-10-18Teach getdirname() to return "." as appropriate.Rob Landley
2019-10-18Release 0.8.20.8.2Rob Landley
2019-10-17ls: Ensure file names are separated by 2 spacesAndrew Ilijic
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
2019-10-16Fix NOSPACE tests.Rob Landley
2019-10-16Simple ps smoketest.Rob Landley
2019-10-15In-passing cleanup and add a NOP -P.Rob Landley
2019-10-15Off by one error when you try to run a command through two symlinks.Rob Landley
2019-10-14Make cmp work with 1 argument (implicit - as second argument).Rob Landley
2019-10-14Freshen up first half of roadmap.Rob Landley
2019-10-14losetup: Fix null-termination of src string instead of dest after copyAlessio Balsini
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>
2019-10-12Make cmp.test pass with TEST_HOST on systems that gratuitously violate posix.Rob Landley
2019-10-12Sigh, second attempt at removing strlen() from strstart().Rob Landley
2019-10-12Don't need the second variable, and put the comment back.Rob Landley
2019-10-12Fix argless find segfault.Denys Nykula
Inline array becomes garbage outside the if.
2019-10-12hostname: fix error reporting.Elliott Hughes
The <netdb.h> functions have their own errno :-(
2019-10-11Fix same spurious test failures that were affecting killall,Rob Landley
and silence "killed" messages from the shell by forking in a subshell.