Rob Landley [Sat, 7 Feb 2015 22:23:59 +0000 (16:23 -0600)]
Remove xexec_optargs().
Rob Landley [Sat, 7 Feb 2015 22:23:03 +0000 (16:23 -0600)]
Cleanup pass on env, removing exec_optargs().
Rob Landley [Sat, 7 Feb 2015 22:17:44 +0000 (16:17 -0600)]
Make toy_exec() check if argc is in optargs and deal with it there so we don't need a separate xexec_optargs().
Rob Landley [Sat, 7 Feb 2015 21:32:22 +0000 (15:32 -0600)]
Merge unshare and nsenter (promoting and cleaning up nsenter).
Needs more testing, don't have a test environment set up for this yet...
Rob Landley [Fri, 6 Feb 2015 23:31:52 +0000 (17:31 -0600)]
In rm, init using to AT_REMOVEDIR in the dir case earlier.
(If you had a chmod 000 directory and did rm -r on it without -f, after the prompt it would complain it was a directory.)
Rob Landley [Fri, 6 Feb 2015 22:42:44 +0000 (16:42 -0600)]
Alright, the Android guys agree with the musl guys: faccessat(AT_SYMLINK_NOFOLLOW) is not supported.
Rob Landley [Sun, 25 Jan 2015 20:04:51 +0000 (14:04 -0600)]
Commit 1061 said "this gets expand off my to-review list". Remove it from the list.
Rob Landley [Sun, 25 Jan 2015 19:11:58 +0000 (13:11 -0600)]
Cleanup mountpoint and remove it from the pending README.
Luis Felipe Strano Moraes [Thu, 22 Jan 2015 22:29:34 +0000 (16:29 -0600)]
bootchartd: Removing wrong free call to non-malloc'ed string.
Rob Landley [Thu, 22 Jan 2015 08:18:30 +0000 (02:18 -0600)]
Fix sed s//\[newline]/ line continuations.
The problem was that readline() was returning a newline at the end of each
string, which wasn't getting stripped in the parser and thus \ wasn't at the
end of a line for -f, it was escaping a literal newline, so the continuation
logic didn't trigger. Remove some redundant null checks while we're at it,
and don't bother terminating a string we don't return (yes we leak memory
in an error path, but it's about to error_exit() anyway).
Elliott Hughes [Tue, 20 Jan 2015 22:03:29 +0000 (16:03 -0600)]
fix hwclock's rtc selection
For systems using /dev/rtcN, /dev/rtc0 isn't necessarily the RTC
that's used to provide the system time at boot time. We need to search
for the RTC whose /sys/class/rtc/rtcN/hctosys contains "1".
Elliott Hughes [Tue, 20 Jan 2015 21:52:41 +0000 (15:52 -0600)]
fix typo in printf
Rob Landley [Sun, 18 Jan 2015 20:06:14 +0000 (14:06 -0600)]
Remove trailing whitespace.
Rob Landley [Sun, 18 Jan 2015 19:44:24 +0000 (13:44 -0600)]
Lift the basename/libgen.h shenanigans back out of portability.c and make it a static inline in portability.h, and prototype dirname() while we're at it.
Elliott Hughes [Sun, 18 Jan 2015 19:36:31 +0000 (13:36 -0600)]
fix non-glibc basename(3) usage
I considered a #else on the big #ifdef __GLIBC__ above, but that
seemed harder to follow.
Rob Landley [Fri, 16 Jan 2015 19:55:32 +0000 (13:55 -0600)]
Move pty.h back to toys.h (under LSB 4.1 headers).
Elliott Hughes [Fri, 16 Jan 2015 19:49:23 +0000 (13:49 -0600)]
AOSP master has <pty.h> and builds netcat/nc.
Rob Landley [Fri, 16 Jan 2015 19:43:09 +0000 (13:43 -0600)]
id.c #ifdefectomy. (ifdefs belong in headers, not in C code.)
Elliott Hughes [Fri, 16 Jan 2015 19:36:53 +0000 (13:36 -0600)]
This patch adds a TOYBOX_SELINUX configuration option to control both
the SELinux commands (such as chcon) and the SELinux-specific options
to regular commands (such as ls -Z).
This lets us #include <selinux/selinux.h> in portability.h.
I've also fixed chcon to insist on being given the a context argument.
This patch also adds -Z to id and fixes id's regular output (-G should
be separated by spaces, non-G output should be separated by commas,
and you don't want a double comma where the egid is omitted from the
list of groups).
Rob Landley [Fri, 16 Jan 2015 01:09:08 +0000 (19:09 -0600)]
Added tag 0.5.1 for changeset
62a7d617e1ce
Rob Landley [Wed, 14 Jan 2015 19:59:10 +0000 (13:59 -0600)]
Switch netcat to stop parsing command line at first nonoption argument instead of stopping after -l or -L.
Hyejin Kim tried "toyboxd nc nc -p 1234 -l rm mv ps" (which attempted to run
"nc rm mv ps") and "toybox nc -l -p 1234" (which attempted to run "-p 1234")
and found the behavior confusing. So make it work like xargs, where all
netcat options have to come before the start of any child command.
Rob Landley [Wed, 14 Jan 2015 19:54:34 +0000 (13:54 -0600)]
Make touch -d miliseconds work. (Still only 6 digits precision instead of 9, but it's a start.)
Elliott Hughes [Wed, 14 Jan 2015 09:43:49 +0000 (03:43 -0600)]
i found a few problems while manually smoke testing toybox chown versus toolbox (NetBSD) chown...
new test:
and here's the patch to fix "owner:" ":group" and the ":" special case:
Rob Landley [Wed, 14 Jan 2015 06:31:06 +0000 (00:31 -0600)]
Let chown build standalone.
Rob Landley [Tue, 13 Jan 2015 10:28:19 +0000 (04:28 -0600)]
sed bugfix: N or n at end of script would save the terminating NULL as the resume position, so the script would restart from beginning.
Rob Landley [Tue, 13 Jan 2015 09:35:37 +0000 (03:35 -0600)]
sed s/// can have line continuations in the replacement part, with or without a \ escaping the newline.
Rob Landley [Sun, 11 Jan 2015 16:17:58 +0000 (10:17 -0600)]
Promote printf.
Rob Landley [Sun, 11 Jan 2015 16:16:38 +0000 (10:16 -0600)]
One more bugfix for printf.c, with test suite entry. (Make %-3d etc work.)
Rob Landley [Sun, 11 Jan 2015 07:22:36 +0000 (01:22 -0600)]
Cleanup pass on printf.
Alas, passing a union as the last argument to printf does not appear to work
reliably, and there's no obvious way to manually assemble varargs in a portable
manner. So I have to repeat the printf once for each data type. Oh well.
Rob Landley [Sun, 11 Jan 2015 02:02:21 +0000 (20:02 -0600)]
More half-finished cleanup of printf.c, and more test suite entries.
Rob Landley [Tue, 6 Jan 2015 21:06:51 +0000 (15:06 -0600)]
Since "printf" is a shell builtin, printf.test wasn't actually testing anything.
Rob Landley [Tue, 6 Jan 2015 18:07:20 +0000 (12:07 -0600)]
More printf cleanup, and test suite entries.
Fixes bug introduced last time where toys.optargs was both snapshotted and used
directly and the two fell out of sync.
Rob Landley [Sun, 4 Jan 2015 09:50:52 +0000 (03:50 -0600)]
Fix sed backslash parsing in square bracket pattern sections.
Rob Landley [Sun, 4 Jan 2015 02:31:41 +0000 (20:31 -0600)]
Another cleanup pass on printf.
Rob Landley [Sat, 3 Jan 2015 22:25:36 +0000 (16:25 -0600)]
Move fflush() checking to xexit() and have exit paths in main() call that.
Rob Landley [Sat, 3 Jan 2015 03:28:39 +0000 (21:28 -0600)]
Cleanup pass on printf.
Rob Landley [Fri, 2 Jan 2015 06:44:27 +0000 (00:44 -0600)]
Need to update install.c for the changed OLDTOY() argument list.
Rob Landley [Thu, 1 Jan 2015 23:37:57 +0000 (17:37 -0600)]
Tweak status.html
Rob Landley [Thu, 1 Jan 2015 22:59:35 +0000 (16:59 -0600)]
Switch a lot of strncpy() calls to xstrncpy().
Rob Landley [Thu, 1 Jan 2015 22:49:55 +0000 (16:49 -0600)]
strncpy(optptr, hname, strlen(hname)) is really just strcpy().
Rob Landley [Thu, 1 Jan 2015 22:28:51 +0000 (16:28 -0600)]
strtol() doesn't return error indicator for overflow, it just sets errno. So add estrtol() (which clears errno first), and xstrtol() (which error_exit()s on overflow).
Rob Landley [Thu, 1 Jan 2015 22:19:40 +0000 (16:19 -0600)]
Debris from flag handling rewrite: don't allow -^A to actually trigger.
Elliott Hughes [Thu, 1 Jan 2015 16:58:59 +0000 (10:58 -0600)]
typo fixes
Rob Landley [Thu, 1 Jan 2015 04:38:48 +0000 (22:38 -0600)]
Fix for mix from Isaac Dunham (who can actually test it). (I tweaked the curly brackets.)
He says:
In the channel selection loop, "if (TT.chan)" had been combined with
a strcmp; the else conditionals were premised on if (TT.chan) alone.
The help text had been only partially updated for a couple option changes.
Rob Landley [Thu, 1 Jan 2015 03:30:59 +0000 (21:30 -0600)]
Redo option parsing infrastructure so #define FORCE_FLAGS can unzero flag macros for a disabled command (needed when multiple commands share infrastructure with a common set of flags).
This means the flag space is no longer packed, but leaves gaps where the zeroes
go. (Actual flag bit positions are the same for all configs.) Since the
option parsing needs to know where the holes are, the OPTSTR values are
now generated as part of flags.h with ascii 1 values for the disabled values.
(So generated/oldflags.h went away.)
This also means that the option string argument for OLDTOY() went away, it now
uses the same arguments as the NEWTOY() it references.
Rob Landley [Thu, 1 Jan 2015 03:23:37 +0000 (21:23 -0600)]
When CP_MORE was disabled, the d flag was still in the [-exclusion] list at the end and option parsing fell off the end looking for it (segfault) if DEBUG wasn't enabled to check for that.
Rob Landley [Wed, 31 Dec 2014 22:22:31 +0000 (16:22 -0600)]
When you include the posix header libgen.h, glibc #defines basename to some random other symbol name (because gnu) and this screws up nontrivial macro expansions of NEWTOY(basename), so work around it in portability.h.
Rob Landley [Tue, 30 Dec 2014 20:49:02 +0000 (14:49 -0600)]
Link to gmane web archive.
Rob Landley [Sun, 28 Dec 2014 20:44:09 +0000 (14:44 -0600)]
Another random link for the design page.
Rob Landley [Sun, 28 Dec 2014 20:38:14 +0000 (14:38 -0600)]
Fluff out help text.
Rob Landley [Sat, 27 Dec 2014 19:52:40 +0000 (13:52 -0600)]
Promote mix
Rob Landley [Sat, 27 Dec 2014 19:52:03 +0000 (13:52 -0600)]
Cleanup mix.c.
Rob Landley [Wed, 24 Dec 2014 22:13:08 +0000 (16:13 -0600)]
Teach factor to accept whitespace separated arguments (reported by Robert Thompson).
(The diff looks bigger than it is because of reindenting.)
Elliott Hughes [Wed, 24 Dec 2014 01:20:24 +0000 (19:20 -0600)]
getenforce and setenforce
two more easy SELinux commands:
Elliott Hughes [Wed, 24 Dec 2014 01:17:13 +0000 (19:17 -0600)]
those of us who need to check in generated files find that 'tr' and
'traceroute' keep swapping places. self-inflicted, yes, but not much i
can do about it :-(
Rob Landley [Tue, 23 Dec 2014 19:29:47 +0000 (13:29 -0600)]
Merge catv back into cat as discussed on the list. Add comments about infrastructure upgrades needed to restore separate catv option.
Rob Landley [Mon, 22 Dec 2014 23:04:47 +0000 (17:04 -0600)]
Allocate space for null terminator.
Rob Landley [Mon, 22 Dec 2014 19:45:35 +0000 (13:45 -0600)]
sed 'r' didn't work right.
Rob Landley [Mon, 22 Dec 2014 05:17:06 +0000 (23:17 -0600)]
Another sed bug. (The e2fsprogs build uses multiple line continuations on the same command.)
Rob Landley [Sun, 21 Dec 2014 07:54:54 +0000 (01:54 -0600)]
Promote sed to posix.
Rob Landley [Sun, 21 Dec 2014 05:28:30 +0000 (23:28 -0600)]
sed: implement 'l'
Rob Landley [Sat, 20 Dec 2014 20:58:03 +0000 (14:58 -0600)]
Add tizen section to roadmap.
Rob Landley [Sat, 20 Dec 2014 03:17:49 +0000 (21:17 -0600)]
More sed bugs.
1) Newline in -e after s/// was eaten as "whitespace before flags"
2) \\ needs to be passed through to regex to avoid "trailing \" error and
"\\n" is not a newline.
Rob Landley [Thu, 18 Dec 2014 17:13:35 +0000 (11:13 -0600)]
Decouple cp and mv so mv uses its own --help text.
MV still requires CP enabled until the flag generation logic gets updated.
Rob Landley [Thu, 18 Dec 2014 17:05:06 +0000 (11:05 -0600)]
Give fstype its own config symbol (separate from blkid), and fix blkid not using more accurate ext3/ext4 filesystem sub-type.
Rob Landley [Mon, 15 Dec 2014 09:34:55 +0000 (03:34 -0600)]
Fix yet another sed bug.
The s/// command would copy the \ of substitutions before deciding what to
do with them (generally overwriting the \ with the new data). When the
substitution was A) at the very end of the new string, B) resolved to nothing,
it could leave a trailing \ that didn't belong there and didn't get overwritten
because the "copy trailing data" part that copies the original string's null
terminator already happened before the \ overwrote it.
The ghostwheel() function restarts regexes after embedded NUL bytes, but
if the string it's passed is _longer_ than the length it's told then it
gets confused (and it means we're off the end of our allocation so segfaults
are likely).
Fix: test for \ first and move the "copy byte" logic into an else case.
Rob Landley [Sun, 14 Dec 2014 19:51:28 +0000 (13:51 -0600)]
Make sed a\ line continuations work properly for different pattern input modes.
Rob Landley [Sun, 14 Dec 2014 00:35:11 +0000 (18:35 -0600)]
Fix bug in sed y/// where bytes in target but not in source were replaced by zeroes (nul terminator overwritten).
Rob Landley [Sat, 13 Dec 2014 18:27:51 +0000 (12:27 -0600)]
Last sed bugfix broke 'b', fix it.
Rob Landley [Sat, 13 Dec 2014 18:12:14 +0000 (12:12 -0600)]
Leftover variable from factoring out base64_init() caused an unused variable warning.
Rob Landley [Sat, 13 Dec 2014 18:09:25 +0000 (12:09 -0600)]
Oops. xfork() moved to portability.c and the config2help.c build wasn't including that. (Worked until I did a "make clean".)
Rob Landley [Sat, 13 Dec 2014 17:59:37 +0000 (11:59 -0600)]
Forgot to check in a header file for base64.
Rob Landley [Sat, 13 Dec 2014 17:59:10 +0000 (11:59 -0600)]
Add "make help" entry for "make change".
Rob Landley [Sat, 13 Dec 2014 17:58:08 +0000 (11:58 -0600)]
Add base64.
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.
Rob Landley [Sat, 13 Dec 2014 17:56:41 +0000 (11:56 -0600)]
Remove more strncpy() calls.
The semantics of strncat() and strncpy() are non-obvious, so let's not use 'em.
Both zero all their remaining buffer space, and with strncat() the size is
the space left at the _end_ of the string (not the size of the buffer) so
it's way too easy to stomp memory you don't own. As long as we have to measure
stuff ourselves to get it right, just use memcpy().
Elliott Hughes [Fri, 12 Dec 2014 02:17:28 +0000 (20:17 -0600)]
here's a patch that should let us replace toolbox's chcon.
(it also adds a feature, -R, because toybox makes that so easy.)
you'll probably want fancier configuration here because although the
--as-needed works okay, a typical Ubuntu box will have the .so but not
the .h files. i did consider adding a toys/selinux/ directory, but
given that existing tools like ls and id will want -Z SELinux options,
i wasn't sure whether you'd think it was worth segregating the
SELinux-only toys.
note that this won't help the tizen smack users (and patch for smack
won't help SELinux users). so you might want to think about where
you'd like us to be aiming: #if USE_SELINUX/USE_SMACK in all the
relevant places, or a toys/selinux and a toys/smack (though we'd still
need #if in at least ls and id), or a lib/security.c that concentrates
all the differences into one file?
Rob Landley [Thu, 11 Dec 2014 00:59:22 +0000 (18:59 -0600)]
Make unescape_delimited_string() copy the string so error reporting isn't so messed up.
Rob Landley [Wed, 10 Dec 2014 23:59:00 +0000 (17:59 -0600)]
Fix some sed bugs and improve error reporting.
A newline after 'b' commands in -e command line patterns was being discarded
as whitespace, a single element regex match on a {} was leaving stale state
for the next line, and giant -e blobs of instructions were saying things
like problem at character 432 (note: nulls inserted for regex processing
aren't always cleaned up, screws up error reporting).
Rob Landley [Fri, 5 Dec 2014 03:46:59 +0000 (21:46 -0600)]
Work with buildroot's extensively patched uClibc, and for nommu support move xfork() to portability.h and #ifdef based on __uClinux__ (which seems to be the nommu compiler define).
Rob Landley [Fri, 5 Dec 2014 03:41:12 +0000 (21:41 -0600)]
Implement xstrncat() and fix xstrndup().
Rob Landley [Thu, 4 Dec 2014 22:42:01 +0000 (16:42 -0600)]
Add shred.
Rob Landley [Wed, 3 Dec 2014 19:09:15 +0000 (13:09 -0600)]
More gzip stuff: now creates -0 compression files (store only), and does so to stdout.
Rob Landley [Tue, 2 Dec 2014 22:02:50 +0000 (16:02 -0600)]
Fix bug pointed out by Elliott Hughes ("vmstat 1" should repeat endlessly), and remove final delay (after all output) for "vmstat 2 3" case.
Rob Landley [Tue, 2 Dec 2014 19:00:08 +0000 (13:00 -0600)]
Note posix mailing list posting correcting a bug in the web version of the standard.
Rob Landley [Tue, 2 Dec 2014 09:17:34 +0000 (03:17 -0600)]
Don't mount a filesystem over an existing one with the same /dev and /dir.
The OS mostly catches this for block devices, but calling "mount -a" twice
shouldn't overmount tmpfs entries with new tmpfs instances. (This needs a test
suite entry, and the test suite needs a root context to run in...)
Rob Landley [Tue, 2 Dec 2014 09:12:58 +0000 (03:12 -0600)]
Switching on fortify was not kind to the pending directory. Fix the actual build break (open(O_CREAT) without permissions).
Rob Landley [Tue, 2 Dec 2014 09:05:01 +0000 (03:05 -0600)]
Start of deflate compress-side code, mostly refactoring and stubs so far.
Rob Landley [Mon, 1 Dec 2014 18:52:55 +0000 (12:52 -0600)]
Ashwini Sharma pointed out that "mkdir sub; ln -s . sub/up; du -L sub" shouldn't loop endlessly.
Rob Landley [Mon, 1 Dec 2014 09:15:25 +0000 (03:15 -0600)]
Refactor expr and add another test entry that works with TEST_HOST=1 but not with the one in pending.
Rob Landley [Sun, 30 Nov 2014 20:10:36 +0000 (14:10 -0600)]
Tests for operator priority groupings.
Rob Landley [Sun, 30 Nov 2014 17:05:39 +0000 (11:05 -0600)]
Remove the strncpy from mountpoint, and make a lot of other changes while I'm here (to be described on the mailing list).
Rob Landley [Sun, 30 Nov 2014 03:11:34 +0000 (21:11 -0600)]
The "re-exec to regain root permissions" logic broke the error message when calling root-only commands through the multiplexer.
It would say "no such command" when it should say "not root".
Rob Landley [Sun, 30 Nov 2014 01:07:08 +0000 (19:07 -0600)]
Minor whitespace cleanups.
Ashwini Sharma [Sun, 30 Nov 2014 00:38:05 +0000 (18:38 -0600)]
expr.c: Added '==' sign into list of operations. Also added support for regex pattern match.
Rob Landley [Fri, 28 Nov 2014 23:30:46 +0000 (17:30 -0600)]
Improve error reporting in parallel build. (On error, wait for all children to finish before exiting.)
Rob Landley [Fri, 28 Nov 2014 22:57:45 +0000 (16:57 -0600)]
Make sendfile use libbuf.
Rob Landley [Fri, 28 Nov 2014 22:56:53 +0000 (16:56 -0600)]
Tiny in-passing cleanups to more.c.
Rob Landley [Fri, 28 Nov 2014 22:53:59 +0000 (16:53 -0600)]
Check in most recent release notes.
Rob Landley [Fri, 28 Nov 2014 22:52:06 +0000 (16:52 -0600)]
When running a test, the diff is always an ascii diff, not binary.
Rob Landley [Fri, 28 Nov 2014 22:51:32 +0000 (16:51 -0600)]
Add "change" subdirectory to make clean.