aboutsummaryrefslogtreecommitdiff
path: root/toys/posix
AgeCommit message (Collapse)Author
2014-12-23Merge catv back into cat as discussed on the list. Add comments about ↵Rob Landley
infrastructure upgrades needed to restore separate catv option.
2014-12-22sed 'r' didn't work right.Rob Landley
2014-12-21Another sed bug. (The e2fsprogs build uses multiple line continuations on ↵Rob Landley
the same command.)
2014-12-21Promote sed to posix.Rob Landley
2014-12-18Decouple cp and mv so mv uses its own --help text.Rob Landley
MV still requires CP enabled until the flag generation logic gets updated.
2014-12-13Leftover variable from factoring out base64_init() caused an unused variable ↵Rob Landley
warning.
2014-12-13Add base64.Rob Landley
The tizen guys wanted this. Yeah, I know there's base64 code in uuencode/uudecode, but that this has -i, input lines aren't of fixed length, encode/decode are in same file, there's no prefix/suffix code, it always writes to stdout... Eliminating the code duplication wouldn't be worth the if/else I'd have to add, so I just did a new one. Factored out the base64 table init into lib.c though: that was worth sharing.
2014-12-01Ashwini Sharma pointed out that "mkdir sub; ln -s . sub/up; du -L sub" ↵Rob Landley
shouldn't loop endlessly.
2014-11-25Variant of a patch from Ashwini Sharma, making df /dev/node work and ↵Rob Landley
tweaking the spacing. I didn't apply the POSIXLY_CORRECT gnuism because it's a can of worms (as would be LSB_CORRECT), and you can presumably alias df="df -P" if you want that. Possibly in future I should factor out the "readahead and align columns based on measuring the largest value in each" code from ls and apply it here.
2014-11-22As long as Android's going to require fortify, fixup the warnings it generates.Rob Landley
2014-11-19probe for getspnam(), forkpty(), utmpx, replace sethostname()Isaac Dunham
Android is missing all of these; we need to probe for some so we have a config symbol to depend on. sethostname() is easily replaced. We got termios.h via pty.h; now it's not included in configure-step tools, so we need termios.h to generate globals.
2014-11-19Fix "tail -c 10" segfault spotted by Lukasz Szpakowski.Rob Landley
Once we've read through the initial TT.bytes backlog we discard the extra data, meaning we adjust the remaining amount each time so the overflow is zero bytes. We were doing the adjustment right, but not zeroing out the overflow counter after we did so.
2014-10-30Test for ls -d from Isaac Dunham, and he pointed out -F also disables ↵Rob Landley
symlink following.
2014-10-30Bug report from Isaac Dunham: ls -d shouldn't follow command line symlinks ↵Rob Landley
without -H or -L (just like ls -l).
2014-10-27Fix use after free error spotted by ?ukasz Szpakowski.Rob Landley
2014-10-22Teach ln -f to leave original target alone if link creation fails.Rob Landley
Suggested by Ashwini Sharma, I wound up implementing it by creating the new link at a temporary name and renaming it over the old one instead of renaming the old file out of the way and putting it back if it failed. (Because "mkdir -p one/one/blah && ln -sf /bin/one one" would otherwise rename one/one out of the way and only notice it can't delete it way at the end when recovery's darn awkward, vs create new thing and if rename fails (including EISDIR) that's the main error path. And yes the temporary name is in the same directory as the destination so we never rename between mounts.) link over the old one instead of renaming the old file and renaming it back.
2014-10-20More static analysis fixes from Ashwini Sharma.Rob Landley
2014-10-18Factor out printf-style escape parsing logic from echo.c.Rob Landley
2014-10-14Use O_CLOEXEC instead of O_RDONLY to signal loopfiles_rw() to close filehandles.Rob Landley
2014-10-14Fix last night's mv commit (use dest, not source).Rob Landley
2014-10-14Implement mv -f and -i.Rob Landley
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