Rob Landley [Tue, 14 Oct 2014 16:40:03 +0000 (11:40 -0500)]
Fix last night's mv commit (use dest, not source).
Rob Landley [Tue, 14 Oct 2014 05:01:22 +0000 (00:01 -0500)]
Implement mv -f and -i.
Rob Landley [Mon, 13 Oct 2014 15:49:24 +0000 (10:49 -0500)]
Started over on sed (by reading the posix spec).
Isaac Dunham [Fri, 10 Oct 2014 14:47:35 +0000 (09:47 -0500)]
acpi: implement -ctV, fix recursion, plug a small leak
* acpi_callback had blindly assumed that a path of 26 chars or more was
the right depth; rely on depth from dirtree root
* acpi -c shows cooling device state
some backlights are set up so that they will report dimmer as higher,
but that's a hardware issue that can't be sanely worked around.
* acpi -t shows temperatures
this implementation will pick up fan, battery temperatures, etc.
(but currently not hwmon-type temperatures, or hdd temps;
acpi 1.7 does not measure these either)
we handle milli-C (typical) and deci-C (I've seen this on Qualcomm
batteries, and not yet anywhere else)
we do *not* handle deci-K yet
* acpi -V shows all sensors
* without saving the result of dirtree_path() to free later, we had
a slow leak.
all callbacks call this once, so save it in GLOBALS()
acpi -t happens to need this anyhow, though using openat()/readall()
instead of readfile() would work.
Rob Landley [Thu, 9 Oct 2014 18:43:32 +0000 (13:43 -0500)]
Various bugfixes (mostly resource leaks) from Ashwini Sharma's static analysis, plus occasional tweak by me while reviewing them.
Rob Landley [Thu, 9 Oct 2014 17:17:36 +0000 (12:17 -0500)]
Fix use-after-free spotted by Ashwini Sharma's static analysis.
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.)
Rob Landley [Wed, 8 Oct 2014 18:59:16 +0000 (13:59 -0500)]
Update status lists. (Once the pending-not-in-pending files go away (see toys/pending/README), this can be probed from the source.)
Rob Landley [Tue, 7 Oct 2014 19:11:54 +0000 (14:11 -0500)]
Basic update of the roadmap and status pages. (Both need a good scrub and polish beyond this.)
Rob Landley [Thu, 2 Oct 2014 12:53:27 +0000 (07:53 -0500)]
Release notes for 0.5.0.
Rob Landley [Thu, 2 Oct 2014 12:47:08 +0000 (07:47 -0500)]
Added tag 0.5.0 for changeset
7afd32673a5c
Rob Landley [Thu, 2 Oct 2014 12:24:38 +0000 (07:24 -0500)]
Workaround for musl's faccessat bug (the rm -r "error: is a directory" thing).
The Linux man page says I can use AT_SYMLINK_NOFOLLOW. It works in glibc,
uclibc, and klibc, but musl returns -EINVAL any time you pass in that flag
and the maintainer says that's not a bug and insists the man page and those
other libraries all change to match musl's behavior.
Toybox uses it to avoid scheduling unnecessary metadata writes for things we're
about to delete (have to chmod unreadable directories so we can descend into
them to delete their contents, the chmod happens before we descend so the
disk I/O has plenty of time to be scheduled) because the extra writes wear out
SSD faster. It's just an optimization and I don't really care if it works
_well_ (the fchmodat call _also_ takes AT_SYMLINK_NOFOLLOW so that's covered),
but musl's behavior uniquely makes the check always error and thus breaks normal
"rm -r".
Yes this workaround is checking #ifdef __MUSL__ which the library does not
supply (because its code is perfect and will thus never need to be worked
around). You can CFLAGS=-D__MUSL__ if you don't echo "#define __MUSL__" >>
include/features.h when installing the library.
Rob Landley [Thu, 2 Oct 2014 00:57:34 +0000 (19:57 -0500)]
Bugfix from Ashwini Sharma: Z timezone required by posix for touch but not for libc, so we have to implement it here.
Ashwini Sharma [Mon, 29 Sep 2014 00:34:53 +0000 (19:34 -0500)]
Updated version, having complete support for ip _link_, _addr_, _rule_, _route_ and _tunnel_ options.
Rob Landley [Sun, 28 Sep 2014 23:22:34 +0000 (18:22 -0500)]
Fix two mount bugs: 1) Don't skip a filesystem type when setting up loopback mount, 2) Don't stop checking filesystem types due to EBUSY, it may mean already mounted by another filesystem type you haven't tried yet.
Rob Landley [Sun, 28 Sep 2014 18:15:41 +0000 (13:15 -0500)]
mount: terminate list so unknown user mount attempts don't endlessly loop, add better error reporting.
Rob Landley [Sun, 28 Sep 2014 18:11:20 +0000 (13:11 -0500)]
Brown paper bag time: comma_scan() didn't work for anything but the last entry.
Rob Landley [Sun, 28 Sep 2014 02:07:00 +0000 (21:07 -0500)]
Multi-build single.sh should exit with an error when build breaks.
Rob Landley [Sun, 28 Sep 2014 02:04:47 +0000 (21:04 -0500)]
Cleanup pass on groupdel.
Rob Landley [Sun, 28 Sep 2014 01:31:16 +0000 (20:31 -0500)]
Allow single.sh to build more than one command per invocation.
Rob Landley [Sun, 28 Sep 2014 01:28:33 +0000 (20:28 -0500)]
Untangle id/groups/logname so single.sh can build each one standalone.
Rob Landley [Sun, 28 Sep 2014 00:59:28 +0000 (19:59 -0500)]
Have OLDTOY emit (redundant) function prototype so single.sh can build OLDTOY standalone (if it has its own config symbol).
Rob Landley [Sun, 28 Sep 2014 00:58:18 +0000 (19:58 -0500)]
Don't segfault for --help of single.sh build of OLDTOY commands that use another command's help.
Rob Landley [Fri, 26 Sep 2014 23:49:44 +0000 (18:49 -0500)]
The only illegal characters in a username are ":" (field separator), "\n" (line separator), and "/" (filename separator).
Restricting usernames to the legacy posix character allowed set (for filenames,
so the $HOME directory is creatable on VFAT and similar) means you can't have
UTF-8 usernames. Linux allows any character but / and NUL in filenames.
Since root is creating these entries, we assume root knows what it's doing.
Rob Landley [Fri, 26 Sep 2014 23:42:23 +0000 (18:42 -0500)]
Separate more commands so single.sh can build them standalone.
?ukasz Szpakowski [Mon, 22 Sep 2014 13:32:21 +0000 (08:32 -0500)]
When killall was invoked without arguments, there appeared segmentation fault
Felix Janda [Mon, 22 Sep 2014 13:22:12 +0000 (08:22 -0500)]
Fix du test: du symlink -> "0\tsymlink"
Rob Landley [Mon, 22 Sep 2014 12:52:15 +0000 (07:52 -0500)]
Respond to two static analysis issues in dirtree_path() reported by Ashwini Sharma.
dirtree->name is an array, not a pointer, so can't be zero. Remove the test.
We dereference plen without checking it for null but calling dirtree_path(0, 0)
is pilot error: only the _first_ call can have plen = 0. Add a comment.
Rob Landley [Mon, 22 Sep 2014 03:44:20 +0000 (22:44 -0500)]
Start on ping.c.
Rob Landley [Sat, 20 Sep 2014 23:46:47 +0000 (18:46 -0500)]
Tweak portability.h for uClibc version in buildroot defconfig.
I've been locally patching uClibc to not violate posix-2008 (you don't need
to define a GNU macro to get a posix function), but uClibc is obsolete and
moribund (development peaked in 2006, last bugfix release was over 2 years
ago), and the largest remaining user (buildroot) doesn't bother to apply such
a patch. Since even buildroot is slowly migrating to musl-libc, just do the
portability tweak for what the last release of the old thing actually did.
Rob Landley [Sat, 20 Sep 2014 22:51:23 +0000 (17:51 -0500)]
Always call setlocale if I18N is enabled, so nested toy_exec() can switch it back off if necessary.
Rob Landley [Sat, 20 Sep 2014 19:20:28 +0000 (14:20 -0500)]
Delete generated/README.txt (the contents are in code.html now) so clean can just remove the "generated" directory entirely.
Rob Landley [Sat, 20 Sep 2014 19:12:55 +0000 (14:12 -0500)]
Capitalize "toybox" more consistently on the about page.
Rob Landley [Sat, 20 Sep 2014 19:11:59 +0000 (14:11 -0500)]
Fluff out the documentation some more.
Rob Landley [Sat, 20 Sep 2014 18:22:24 +0000 (13:22 -0500)]
Remove debug echo checked in by mistake.
Rob Landley [Sat, 20 Sep 2014 18:22:13 +0000 (13:22 -0500)]
Forgot to check in the updated makefile when I moved the testsuite.
(Did you know you can test individual commands with scripts/test.sh command?
Now you do...)
Rob Landley [Sat, 20 Sep 2014 18:20:17 +0000 (13:20 -0500)]
Typo from the dawn of time: toybox is not capitalized the way BusyBox was.
It's just a word. Capitalize at the start of the sentence, otherwise don't.
Yeah, it could be always capitalized as a proper name but since the command
"toybox" is all lower case, that would be weird.
Rob Landley [Sat, 20 Sep 2014 18:18:44 +0000 (13:18 -0500)]
The ancient GPL (copied from the 2.6.12 kernel) build infrastructure is actually in the "kconfig" directory, not under scripts. Remind me to write a new one from scratch...
(Someone actually submitted a basic kconfig rewrite in awk once, but until I
bite the bullet and write my own awk.c, I just don't know awk well enough to
maintain a large script written in it. Back when I maintained kernel.org/doc
I wrote http://landley.net/hg/kdocs/file/tip/make/menuconfig2html.py but
I am NOT reintroducing python as a build dependency. And neither actually
implemented actual menuing part. So... todo list.)
Rob Landley [Sat, 20 Sep 2014 18:09:14 +0000 (13:09 -0500)]
Move testsuite out of scripts/test into its own top level tests directory, and make ctrl-c kill "make test" more reliably.
Rob Landley [Sat, 20 Sep 2014 18:07:53 +0000 (13:07 -0500)]
Give library probe a progress indicator, and use 150% of detected CPUs to try to keep large SMP machines busy (each compiler invocation is short so they exit almost as fast as we launch them).
Rob Landley [Thu, 18 Sep 2014 23:07:58 +0000 (18:07 -0500)]
Reorder functions to get rid of unnecessary prototypes, and move a global into GLOBALS.
Isaac Dunham [Thu, 18 Sep 2014 18:05:21 +0000 (13:05 -0500)]
rm -rf needs to chmod directories to u+rwx, because directories need +x to search.
(Fixes messages about not being able to delete directories when running make test).
Ashwini Sharma [Thu, 18 Sep 2014 16:47:42 +0000 (11:47 -0500)]
A few fixes for issues reported in static analysis.
Rob Landley [Thu, 18 Sep 2014 01:21:44 +0000 (20:21 -0500)]
Cleanup pass on README.
Other versions are adding Cached from /proc/meminfo to free buffers/cache
(and subtracting it from used), but sysinfo() doesn't provide it. (But it
provide "high memory", which hasn't been relevant for almost a decade...)
But that's a design change, not a cleanup issue.
Rob Landley [Wed, 17 Sep 2014 23:25:05 +0000 (18:25 -0500)]
Update README for pending directory, include list of code outside of pending (grandfathered) awaiting cleanup.
Rob Landley [Wed, 17 Sep 2014 23:24:10 +0000 (18:24 -0500)]
Minor cleanup pass on touch.
Rob Landley [Wed, 17 Sep 2014 13:26:07 +0000 (08:26 -0500)]
Cleanup pass on cut, more to do.
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.
Rob Landley [Tue, 16 Sep 2014 12:21:56 +0000 (07:21 -0500)]
Cleanup pass on useradd.
Rob Landley [Mon, 15 Sep 2014 02:24:50 +0000 (21:24 -0500)]
Add cpio -p
Rob Landley [Mon, 15 Sep 2014 01:37:23 +0000 (20:37 -0500)]
find -xdev should return mount points, just not contents.
Rob Landley [Mon, 15 Sep 2014 00:54:19 +0000 (19:54 -0500)]
Second attempt at one way xpopen().
Rob Landley [Sun, 14 Sep 2014 17:29:44 +0000 (12:29 -0500)]
Split xpopen() into xpopen_both(), xpopen(), and xrun() depending on whether we want to redirect both, one, or neither of stdin/stdout.
Rob Landley [Sat, 13 Sep 2014 19:48:37 +0000 (14:48 -0500)]
Bug report from luckboy: rm -f on a broken symlink didn't work because our "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. :)
Rob Landley [Fri, 12 Sep 2014 01:50:10 +0000 (20:50 -0500)]
Create a generated/build.sh with a single compiler command line to rebuild the toybox_unstripped binary using the existing generated/*.h files.
This way we can snapshot the generated/*.{h,sh} from a defconfig build into
a "shipped" directory or something, and then people can maybe build on crazy
crippled environments like pcbsd that haven't got gmake and put bash under
/usr/local so none of the #!/scripts can find it. This solves at least
part of the "toybox can build with itself but you need to build toybox first
to have the tools to run the build scripts" problem.
Next up: work out the minimal config to provide the build tools needed
to run an actual build. (This should, eventually, include a "make" command
if freebsd's kernel is going to refuse to build with netbsd's "make" and
we don't just write off the whole thing as crazy. But it probably shouldn't
include commands that #include <linux/*.h> if we are trying to make that work.)
Rob Landley [Thu, 11 Sep 2014 05:04:37 +0000 (00:04 -0500)]
Oops, unbreak make.sh.
Clearing out old .o files needs -r now that generated/obj has its own subdirectory. (Works if you make clean between, but shouldn't need it.)
Rob Landley [Wed, 10 Sep 2014 04:44:48 +0000 (23:44 -0500)]
Ignore -m option to cpio, it's what we do anyway so it's not an error.
Rob Landley [Wed, 10 Sep 2014 04:42:25 +0000 (23:42 -0500)]
Two problems: 1) Sometimes toy_exec() needs to re-exec to gain dropped root permissions, 2) shouldn't recurse forever without exec, stack depth increases and we may leak other resources. Limit it to ~5 levels.
Rob Landley [Wed, 10 Sep 2014 01:13:03 +0000 (20:13 -0500)]
Make tweaks: collate generated/*.o files into their own subdirectory, add PIPEFAIL for better error reporting, and simpler regex to select toys/*/*.c list based on NEWTOY/OLDTOY macros.
Rob Landley [Mon, 8 Sep 2014 13:51:45 +0000 (08:51 -0500)]
Fix more memory leaks reported by Ashwini Sharma.
Rob Landley [Mon, 8 Sep 2014 13:40:06 +0000 (08:40 -0500)]
Don't close device handle until after calling flush ioctls, reported by Ashwini Sharma.
Rob Landley [Mon, 8 Sep 2014 13:26:02 +0000 (08:26 -0500)]
Add error test and fix memory leak, reported by Ashwini Sharma.
Rob Landley [Mon, 8 Sep 2014 00:33:18 +0000 (19:33 -0500)]
Promote mount. It's not perfect, but it basically works now.
Rob Landley [Mon, 8 Sep 2014 00:30:05 +0000 (19:30 -0500)]
Fix mount --move bug.
Rob Landley [Sun, 7 Sep 2014 19:42:51 +0000 (14:42 -0500)]
Debugging pass on mount. Not quite done yet, but the basics seem to work now.
Rob Landley [Sat, 6 Sep 2014 18:24:58 +0000 (13:24 -0500)]
Work around uClibc brain-damage.
Rob Landley [Thu, 4 Sep 2014 05:23:51 +0000 (00:23 -0500)]
Don't hang for $CPUS=1.
echo prints a newline if it has nothing to print, so wc -l always returns at least 1. Fix: echo -n
Divya Kothari [Wed, 3 Sep 2014 18:38:18 +0000 (13:38 -0500)]
Testsuites for toybox command - "tar", "bzcat", "xzcat", "zcat" and "hostname".
Divya Kothari [Wed, 3 Sep 2014 18:32:32 +0000 (13:32 -0500)]
chmod testsuite and link testsuite.
Chmod ?
In this testsuite after change file mode bits, we are comparing file mode with expected ones.
One additional "." is coming with modes (actual result). That?s why test cases are getting failed.
This patch will remove additional "." from actual result.
Link ?
Added more test cases.
Rob Landley [Mon, 1 Sep 2014 17:47:32 +0000 (12:47 -0500)]
Add cp -F to force delete of existing destination files, and make install command use that.
-F is equivalent to the gnu/dammit flag --we-think-long-options-without-short-options-are-a-good-idea
Rob Landley [Mon, 1 Sep 2014 03:07:43 +0000 (22:07 -0500)]
More parallel build tweaks.
echo "$PENDING" needs the quotes to avoid gluing the lines together, which
prevents wc -l or head -n +2 from working right.
Rob Landley [Sun, 31 Aug 2014 19:06:37 +0000 (14:06 -0500)]
Next mount checkpoint.
Testing level: It compiled. If any portion of this works, I'll be amazed.
Still a bunch of todo items (see giant TODO block after globals)
Rob Landley [Sun, 31 Aug 2014 16:58:39 +0000 (11:58 -0500)]
Give a hint when setuid logic fails.
Toybox expects to be setuid root; setuid some other user confuses the attempt to drop privileges, and we err on the side of avoiding shenanigans.
Rob Landley [Sat, 30 Aug 2014 22:44:07 +0000 (17:44 -0500)]
Old compilers complain about linker options passed with -c, so split out $LDOPTIMIZE.
Rob Landley [Sat, 30 Aug 2014 21:34:46 +0000 (16:34 -0500)]
Another fix from Johan Bergstr?m, using the gnu/dammit version of sort on the host can be screwed up by more than one environment variable.
Rob Landley [Sat, 30 Aug 2014 18:03:40 +0000 (13:03 -0500)]
Add VERBOSE=fail to "make tests", based on suggestion from Johan Bergstr?m.
Ashwini Sharma [Tue, 26 Aug 2014 03:01:11 +0000 (22:01 -0500)]
ipcs : display all the IPC fascilities information
crond : CRON scheduler
Rob Landley [Mon, 25 Aug 2014 04:46:23 +0000 (23:46 -0500)]
Work in progress snapshot of mount, with fallout to umount. (Not done yet.)
Rob Landley [Mon, 25 Aug 2014 03:42:47 +0000 (22:42 -0500)]
Fix parallel make not always catching errors before link time.
jobs -p removes finished jobs from the list after reporting them once,
so we need to record the output and remove duplicates ourselves.
Rob Landley [Sun, 24 Aug 2014 04:08:59 +0000 (23:08 -0500)]
Promote blockdev to other.
Rob Landley [Sun, 24 Aug 2014 04:08:04 +0000 (23:08 -0500)]
Cleanup blockdev.
Isaac Dunham [Sat, 23 Aug 2014 04:34:52 +0000 (23:34 -0500)]
getty needs fd 0 to stay open.
The O_CLOEXEC reversal resulted in login failing.
Rob Landley [Thu, 21 Aug 2014 03:23:39 +0000 (22:23 -0500)]
Promote inotifyd to other.
Rob Landley [Thu, 21 Aug 2014 03:22:46 +0000 (22:22 -0500)]
Minor help text tweak for inotifyd.
Rob Landley [Thu, 21 Aug 2014 03:21:36 +0000 (22:21 -0500)]
Cleanup inotifyd.
Rob Landley [Tue, 19 Aug 2014 00:10:45 +0000 (19:10 -0500)]
Cleanups on useradd/groupadd/groupdel, and put TOYBOX_UID_SYS and TOYBOX_UID_USR in the top level Config.
Rob Landley [Sat, 16 Aug 2014 14:46:42 +0000 (09:46 -0500)]
Add install to cp/mv.
Rob Landley [Fri, 15 Aug 2014 23:53:01 +0000 (18:53 -0500)]
Fix bug reported by Ashwini Sharma: [-abc] syntax to switch off a command forget
s _all_ saved command line arguments in GLOBALS(), not just for the command bein
g dropped.
Rob Landley [Fri, 15 Aug 2014 15:50:39 +0000 (10:50 -0500)]
If string_to_mode() is called on a base mode with S_ISDIR() and such set, pass those extra bits through.
Rob Landley [Tue, 12 Aug 2014 23:05:55 +0000 (18:05 -0500)]
Enable a command's sub-options in single builds.
Ashwini Sharma [Tue, 12 Aug 2014 12:14:58 +0000 (07:14 -0500)]
A toy _BLOCKDEV_ to get/set block device properties.
Ashwini Sharma [Tue, 12 Aug 2014 12:09:01 +0000 (07:09 -0500)]
Patches to commands for issues reported from static analysis tool.
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.]
Rob Landley [Tue, 12 Aug 2014 01:15:19 +0000 (20:15 -0500)]
Promote lspci.
Rob Landley [Tue, 12 Aug 2014 01:11:58 +0000 (20:11 -0500)]
Cleanup pass on lspci.
Rob Landley [Sun, 10 Aug 2014 17:01:49 +0000 (12:01 -0500)]
Update clean to clean up after new parallel build.
Rob Landley [Sun, 10 Aug 2014 04:49:48 +0000 (23:49 -0500)]
Disable xopen's default O_CLOEXEC for oneit.
Rob Landley [Sat, 9 Aug 2014 19:33:34 +0000 (14:33 -0500)]
Parallelize the build. (set CPUS=1 to force single processor build, or another number to override processor count autodetect.)
Rob Landley [Fri, 8 Aug 2014 04:19:18 +0000 (23:19 -0500)]
Fix -mindepth and -maxdepth to not drill down into excluded directories.
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.
Rob Landley [Wed, 6 Aug 2014 04:21:18 +0000 (23:21 -0500)]
More find bugfixes.
Rob Landley [Wed, 6 Aug 2014 00:44:59 +0000 (19:44 -0500)]
Rereading posix find.c page: "Specifying more than one of the mutually-exclusive options -H and -L shall not be considered an error. The last option specified shall determine the behavior of the utility."
Rob Landley [Wed, 6 Aug 2014 00:41:36 +0000 (19:41 -0500)]
find.c: Posix wants loop detection.
Rob Landley [Wed, 6 Aug 2014 00:32:44 +0000 (19:32 -0500)]
Building busybox from source needs find -not (a synonym for posix's "!").