aboutsummaryrefslogtreecommitdiff
path: root/toys/posix
AgeCommit message (Collapse)Author
2014-10-09Various bugfixes (mostly resource leaks) from Ashwini Sharma's static ↵Rob Landley
analysis, plus occasional tweak by me while reviewing them.
2014-10-09Fix use-after-free spotted by Ashwini Sharma's static analysis.Rob Landley
We xstrdup() an optargs string to avoid modifying our environment space (because it can change what "ps" shows to other processes), and then parse out colon delimited strings and save them in globals that can later be used in the -v codepath and so on. But those globals _aren't_ strdup (no point) which means we can't free the string while we're still using pointers into the middle of it. So move the free to the end. (I hardly ever test with CFG_TOYBOX_FREE switched on because even nommu doesn't need it.)
2014-10-01Bugfix from Ashwini Sharma: Z timezone required by posix for touch but not ↵Rob Landley
for libc, so we have to implement it here.
2014-09-27Untangle id/groups/logname so single.sh can build each one standalone.Rob Landley
2014-09-18Reorder functions to get rid of unnecessary prototypes, and move a global ↵Rob Landley
into GLOBALS.
2014-09-18rm -rf needs to chmod directories to u+rwx, because directories need +x to ↵Isaac Dunham
search. (Fixes messages about not being able to delete directories when running make test).
2014-09-17Minor cleanup pass on touch.Rob Landley
2014-09-17Cleanup pass on cut, more to do.Rob Landley
Cut predates the "pending" directory, so was checked in as-is. Ashwini Sharma's recent static analysis fixes touched this file, but there's a lot more to do than the static analyzer found.
2014-09-14Add cpio -pRob Landley
2014-09-14find -xdev should return mount points, just not contents.Rob Landley
2014-09-14Split xpopen() into xpopen_both(), xpopen(), and xrun() depending on whether ↵Rob Landley
we want to redirect both, one, or neither of stdin/stdout.
2014-09-13Bug report from luckboy: rm -f on a broken symlink didn't work because our ↵Rob Landley
"does it exist" test (to avoid errors on rm -f of nonexistent files) said it didn't. The fix: replace the access() with unlink(), which produces the same "does not exist" errno and has the added bonus of acting as a fastpath for rm -f on non-directories. (And since it produces a different error on directories, falls through to the old behavior there.) Most of this commit is comment updates explaining being subtle. :)
2014-09-09Ignore -m option to cpio, it's what we do anyway so it's not an error.Rob Landley
2014-09-08Fix more memory leaks reported by Ashwini Sharma.Rob Landley
2014-09-08Add error test and fix memory leak, reported by Ashwini Sharma.Rob Landley
2014-09-01Add cp -F to force delete of existing destination files, and make install ↵Rob Landley
command use that. -F is equivalent to the gnu/dammit flag --we-think-long-options-without-short-options-are-a-good-idea
2014-08-16Add install to cp/mv.Rob Landley
2014-08-12Patches to commands for issues reported from static analysis tool.Ashwini Sharma
portability.h.patch - it is for O_CLOEXEC, as compiler complained of it. Makefile.patch - for cleaning generated/*.o files and libopts.dat file [Fixup to uniq.c from Rob.]
2014-08-07Fix -mindepth and -maxdepth to not drill down into excluded directories.Rob Landley
The fact other implementations don't implement "! -mindepth" doesn't mean we can't. Also, find uses +N, N, -N for everything else but this extension doesn't. Also, -depth already had a definition and this has nothing to do with that. It's a poorly thought-out extension, is what I'm saying.
2014-08-05More find bugfixes.Rob Landley
2014-08-05Rereading posix find.c page: "Specifying more than one of the ↵Rob Landley
mutually-exclusive options -H and -L shall not be considered an error. The last option specified shall determine the behavior of the utility."
2014-08-05find.c: Posix wants loop detection.Rob Landley
2014-08-05Building busybox from source needs find -not (a synonym for posix's "!").Rob Landley
2014-08-05Fix a couple patch bugs concerning error output.Rob Landley
2014-08-04find.c: add -mindepth, -maxdepth, and document -newer and -depth.Rob Landley
2014-08-03Implement exec -user, -group, and -newer. Enable find in defconfig.Rob Landley
2014-08-02Missed checking in dirtree_recurse() change (now needs specific ↵Rob Landley
DIRTREE_SYMFOLLOW value, not just true/false).
2014-08-02Cosmetic tweak, slightly more conventional for loop.Rob Landley
2014-08-02Unbreak find -exec.Rob Landley
2014-07-30find.c: fix -iname.Rob Landley
2014-07-29find.c: first pass at case case insensitivity and exec. (Needs more debugging.)Rob Landley
2014-07-26Move DIRTREE_COMEAGAIN second callback up to when the filehandle is still ↵Rob Landley
open, and add dir->again variable to distinguish second call instead of checking for -1 filehandle.
2014-07-20Don't go into an endless loop if we hit a bad utf8 sequence without -q.Rob Landley
2014-07-20Add utf8 support to ls -C.Rob Landley
Use wcwidth() instead of strlen(), and extend the -q substitution to also whiteout nonprintable characters that are nonparseable utf8 snippets.
2014-07-18Find bugfixes.Rob Landley
The check for -print vs -print0 was tested before I optimized out the "-" in the strcmps, and I didn't adjust the offset or retest it. (Ooops.) Also, I wasn't clearing the ! value when descending into parentheticals, so "find . -name blah -o \! \( -stuff -o -thing \)" acted like it had a spurious second ! before -stuff inside the parentheses.
2014-07-16Write a new find. Not quite done, but the basics work.Rob Landley
2014-07-14Implement -HL for cp.Rob Landley
2014-07-06Promote killall5 by merging it into kill.Rob Landley
Slight conflict here: this puts killall5 in the posix directory. But the commands sharing code trumps that.
2014-07-03date -r wasn't saving the result in the right variable. (And make date -ur ↵Rob Landley
work.)
2014-07-03Fix rm -rf of chmod 000 directories.Rob Landley
2014-06-28Use dlist_terminate() in patch.Rob Landley
2014-06-28Add : as an alias for true (toysh needs this).Rob Landley
2014-06-11Option parsing for nohup needs to stop at first nonoption argument. Minor ↵Rob Landley
cleanups.
2014-06-11Promote strings.Rob Landley
2014-06-09When locale is enabled, sprintf("%.123s", str) is counting characters, not ↵Rob Landley
bytes, so we can't globally enable locale without opening stack/heap smashing vulnerabilities. Make commands individually request setlocale() using TOYFLAGS instead.
2014-06-02Help text should have a blank line after usage: lines, and a couple other ↵Rob Landley
whitespace tweaks.
2014-06-01cpio: archive more filesIsaac Dunham
While writing tests for cpio, I found that cpio tries to open empty files if they're regular files, and fails to archive them if unreadable. This can be easily avoided, and is not the usual behavior.
2014-05-31Introduce xfork() and make commands use it, and make some WEXITSTATUS() use ↵Rob Landley
WIFEXITED() and WTERMSIG()+127.
2014-05-29Switch mtab_list to doubly linked so we can traverse in either order. ↵Rob Landley
Convert umount and df. Add dlist_terminate() to break lists for traversal in either direction.
2014-05-25logname and whoami are the same as id -un, so merge them.Isaac Dunham
Since the starting letters are greater than those for 'id' or 'groups', we cn just check if the first letter is greater than 'i'.