Isaac Dunham [Thu, 6 Aug 2015 02:33:43 +0000 (21:33 -0500)]
reboot: signal init, add -f option to call reboot();
init: use SIGINT, use xsignal()
Now that oneit supports the same signals as our "sysv"-init for shutdown,
make reboot et al. signal pid 1 with the appropriate signal.
Of these signals, only SIGINT works with sysvinit 2.88, causing a reboot.
The others are only supported in Busybox init.
Also, make init accept SIGINT and use xsignal().
Rob Landley [Thu, 6 Aug 2015 02:23:50 +0000 (21:23 -0500)]
Cosmetic tweak: newline at the end of "make change".
Rob Landley [Thu, 6 Aug 2015 02:20:27 +0000 (21:20 -0500)]
Switch nbd_client to xconnect() and make xconnect() try all returned addresses
before failing.
Rob Landley [Thu, 6 Aug 2015 01:32:49 +0000 (20:32 -0500)]
Tweak xconnect: socket can be a string (ala "ftp") from /etc/services.
Still need a rethink on how to handle socket/bind/connect sequence.
Rob Landley [Mon, 3 Aug 2015 19:34:01 +0000 (14:34 -0500)]
Factor out xconnect(), plus some other small cleanups to telnet.c.
Rob Landley [Mon, 3 Aug 2015 02:51:41 +0000 (21:51 -0500)]
Mark command-local functions static.
Rob Landley [Sun, 2 Aug 2015 23:04:17 +0000 (18:04 -0500)]
Long-overdue cleanup on login.
Only tested that it compiled so far.
Rob Landley [Sat, 1 Aug 2015 17:22:18 +0000 (12:22 -0500)]
Replace xcheckrange() with atolx_range()
Rob Landley [Sat, 1 Aug 2015 16:48:59 +0000 (11:48 -0500)]
Move strlower() from find to lib.
Isaac Dunham [Sat, 1 Aug 2015 16:09:51 +0000 (11:09 -0500)]
'!' replaces '/' in the sysfs paths of older drivers, so properly
reverse that to get correct paths.
While we're here, reduce the duplication of initialization.
While this is enough for some drivers, it won't get 'input/' stuff
in the right folder.
Rob Landley [Fri, 31 Jul 2015 08:05:24 +0000 (03:05 -0500)]
Whitespace.
Rob Landley [Fri, 31 Jul 2015 07:59:40 +0000 (02:59 -0500)]
Check in the note about rebuilding the source tarball.
Rob Landley [Sat, 25 Jul 2015 00:58:59 +0000 (19:58 -0500)]
Promote fsync.
Rob Landley [Sat, 25 Jul 2015 00:55:15 +0000 (19:55 -0500)]
Promote hostid.
Sameer Pradhan [Sat, 25 Jul 2015 00:51:40 +0000 (19:51 -0500)]
Attached are new toys.
tftp - Client for tftp daemon.
hostid -Print the numeric identifier for the current host.
fsync -Synchronize a file's in-core state with storage device.
Rob Landley [Tue, 21 Jul 2015 04:36:01 +0000 (23:36 -0500)]
Release notes for 0.6.0.
Rob Landley [Tue, 21 Jul 2015 03:20:35 +0000 (22:20 -0500)]
Fix llvm build break.
Rob Landley [Sun, 19 Jul 2015 23:41:46 +0000 (18:41 -0500)]
Tweak version number.
Rob Landley [Mon, 13 Jul 2015 05:11:25 +0000 (00:11 -0500)]
Produce an error message for "cat /mnt", not just return code.
Rob Landley [Mon, 13 Jul 2015 00:23:24 +0000 (19:23 -0500)]
Commit rss feed.
Elliott Hughes [Sat, 11 Jul 2015 19:20:31 +0000 (14:20 -0500)]
Fix 32-bit bionic toybox build.
https://android-review.googlesource.com/159035/
Rob Landley [Fri, 10 Jul 2015 19:52:14 +0000 (14:52 -0500)]
Add a basename_r() and use it in names_to_pid() to avoid basename() overwriting
itself on some inputs. (Which makes killall really impolite. Bug report
from Nicholas Noury via Elliott Hughes.)
Rob Landley [Fri, 10 Jul 2015 19:23:00 +0000 (14:23 -0500)]
More explanation of TOYBOX_DEBUG for option string checking.
Rob Landley [Fri, 10 Jul 2015 19:12:44 +0000 (14:12 -0500)]
Move comment about TOYBOX_DEBUG to start of file so it's more obvious.
Elliott Hughes [Fri, 10 Jul 2015 18:53:39 +0000 (13:53 -0500)]
ifconfig MAC addresses should be lowercase.
A minor nit, but for some reason this really stands out every time I
run ifconfig...
Yeongdeok Suh [Fri, 10 Jul 2015 18:49:12 +0000 (13:49 -0500)]
I added dhcpd -6 option.
It's for supporting ipv6, and I referred to RFC 3315 Specification
http://www.rfc-base.org/txt/rfc-3315.txt
There are some different kind of requests in dhcpd6,
but I inplemented only a basic protocol. (Solicit - Advertise - Request - Reply)
There's a sample packet as below. toybox dhcpd works in the same way.
http://packetlife.net/captures/DHCPv6.cap
Greg Hackmann [Fri, 10 Jul 2015 17:14:02 +0000 (12:14 -0500)]
find: add -inum option
-inum is a commonly implemented extension to search by inode number.
Linux's fs-layer tracepoints log many events in terms of inodes, so
"find -inum" is useful for mapping those events back to specific files.
Rob Landley [Fri, 10 Jul 2015 06:23:54 +0000 (01:23 -0500)]
Rename a function to be more obvious, and factor out a repeated calculation
the compiler was almost certainly retaining in a register anyway.
Rob Landley [Fri, 10 Jul 2015 06:21:28 +0000 (01:21 -0500)]
Promote hwclock.
Elliott Hughes [Fri, 10 Jul 2015 05:57:22 +0000 (00:57 -0500)]
Fix hwclock -w.
The gmtime_r/localtime_r error check was backwards, and the wrong argument
was being passed to the RTC_SET_TIME ioctl.
Also, the error reporting was misleading (showing errno for functions that
don't set errno) and too vague for the user to tell what failed.
Sameer Pradhan [Thu, 9 Jul 2015 22:19:03 +0000 (17:19 -0500)]
There is a typo in mkfifo.c for __Z__ option.
Elliott Hughes [Wed, 8 Jul 2015 07:32:57 +0000 (02:32 -0500)]
Fix ionice.
ioprio_set takes a "prio" argument that combines class and level. Although
bionic (via the uapi headers) includes the appropriate constants and even
a convenience macro, glibc doesn't, so just hard-code the encoding.
Also fix the sense of a conditional so we actually execute the provided
command.
Rob Landley [Tue, 7 Jul 2015 00:41:57 +0000 (19:41 -0500)]
Avoid integer overflow with insane input data.
Rob Landley [Mon, 6 Jul 2015 10:08:48 +0000 (05:08 -0500)]
Save failure reason for each make change .bad file.
Rob Landley [Sun, 5 Jul 2015 07:36:51 +0000 (02:36 -0500)]
Kylie McClain pointed out that -z affects both input and output.
Can't say I'm happy with the API (-z and -Z to keep them independent would
be nice), but compatibility with what exists trumps having a good API...
Rob Landley [Sat, 4 Jul 2015 08:49:53 +0000 (03:49 -0500)]
Actually set time with touch -d and -t when you don't specify nanonseconds.
There's a nanoseconds field value that says use current time, which I set
but forgot to clear in the right places. (Oops.)
Rob Landley [Sat, 4 Jul 2015 04:08:39 +0000 (23:08 -0500)]
First pass on cp --preserve
Rob Landley [Fri, 3 Jul 2015 20:19:07 +0000 (15:19 -0500)]
Promote xxd to other.
Rob Landley [Fri, 3 Jul 2015 20:17:25 +0000 (15:17 -0500)]
Probe for fork() instead of relying on a distro-specific #define.
Hyejin Kim [Fri, 3 Jul 2015 18:22:37 +0000 (13:22 -0500)]
Added i option to use other interface on running dhcpd.
Rob Landley [Thu, 2 Jul 2015 18:40:03 +0000 (13:40 -0500)]
Cleanup xxd.
Rob Landley [Thu, 2 Jul 2015 17:17:59 +0000 (12:17 -0500)]
Minor cleanups on xxd.
Rob Landley [Thu, 2 Jul 2015 16:44:01 +0000 (11:44 -0500)]
The android guys sent in xxd. It doesn't share code with od and hexdump. Hmmm...
Elliott Hughes [Wed, 1 Jul 2015 20:00:06 +0000 (15:00 -0500)]
Fix segfault with "mount -o ro,remount".
Or any call to comma_scan where 'opt' appears as the last item in 'optlist'.
Elliott Hughes [Wed, 1 Jul 2015 19:56:07 +0000 (14:56 -0500)]
Improve -Z error reporting.
The most likely reason for setfscreatecon to fail is that you don't have permission, and that's reported by the write return EACCES. There isn't really a "bad" context; they're just strings.
Before:
$ adb shell mkdir -Z x y
mkdir: bad -Z 'x'
After:
$ adb shell mkdir -Z x y
mkdir: -Z 'x' failed: Permission denied
Other than this, the ToT mkdir works fine with SELinux.
Elliott Hughes [Wed, 1 Jul 2015 19:46:23 +0000 (14:46 -0500)]
Fix top.c build.
Broken by recent lib.h additions.
Rob Landley [Mon, 29 Jun 2015 06:31:34 +0000 (01:31 -0500)]
mkfifo -Z
Rob Landley [Sun, 28 Jun 2015 21:23:08 +0000 (16:23 -0500)]
Add ionice and iorenice.
Rob Landley [Sun, 28 Jun 2015 02:35:37 +0000 (21:35 -0500)]
Add undo buffer for 'u'.
Rob Landley [Sat, 27 Jun 2015 18:36:25 +0000 (13:36 -0500)]
Simplify hexedit logic by adjusting viewport all in one place up top.
(Easier to genericize logic and reuse later in less or vi...)
Rob Landley [Fri, 26 Jun 2015 21:26:15 +0000 (16:26 -0500)]
Factor out more not-curses infrastructure into lib.
Rob Landley [Thu, 25 Jun 2015 22:55:54 +0000 (17:55 -0500)]
Suggestion from Elliott Hughes: tweak test infrastructure to notice if
command exits with high errno and assume it segfaulted.
Rob Landley [Tue, 23 Jun 2015 19:35:57 +0000 (14:35 -0500)]
Fix version number in ifconfig cleanup reference.
Rob Landley [Tue, 23 Jun 2015 18:56:53 +0000 (13:56 -0500)]
Don't segfault if none of the file arguments to ls exists.
Rob Landley [Tue, 23 Jun 2015 18:15:13 +0000 (13:15 -0500)]
Don't depend on malloc(0) to return non-null.
Rob Landley [Tue, 23 Jun 2015 17:59:19 +0000 (12:59 -0500)]
Fix ls so spacing is right for ls -l, -o, -g, -og, -ogZ, -lZ, -gZ, and -oZ.
Rob Landley [Mon, 15 Jun 2015 20:19:11 +0000 (15:19 -0500)]
Fluff up explanation of why 0BSD license for SPDX submission.
Rob Landley [Mon, 15 Jun 2015 20:17:56 +0000 (15:17 -0500)]
Use lsm_set_create() to set security blanket context before mknod, avoiding
racy gap between create/label.
Rob Landley [Thu, 11 Jun 2015 08:35:49 +0000 (03:35 -0500)]
Add nproc.
Rob Landley [Wed, 10 Jun 2015 16:58:47 +0000 (11:58 -0500)]
Cosmetic tweak: no need for pages of text from "make defconfig" and friends.
Rob Landley [Sun, 7 Jun 2015 02:34:02 +0000 (21:34 -0500)]
Last grep commit broke non -r use of grep. Oops.
Rob Landley [Tue, 2 Jun 2015 14:58:51 +0000 (09:58 -0500)]
Make "printf --" and "printf ---" work.
Rob Landley [Sun, 31 May 2015 10:15:47 +0000 (05:15 -0500)]
Redo mkstatus.py to grep pending for pending data and trust toybox
defconfig output for ready command list, to reduce manual updating.
Rob Landley [Sun, 31 May 2015 10:11:28 +0000 (05:11 -0500)]
Move the magic list of commands needing cleanup from toys/pending/README
to greppable TODO annotations in the individual files. (grep -riw TODO)
Hyejin Kim [Mon, 25 May 2015 06:51:56 +0000 (01:51 -0500)]
On testing fold command, I found w option didnt check the range of value.
José Bollo [Mon, 11 May 2015 16:54:15 +0000 (18:54 +0200)]
mknod: Add -Z option
Change-Id: I23174fb7b54d029784e6d7460368128113090079
Rob Landley [Thu, 28 May 2015 06:43:47 +0000 (01:43 -0500)]
Attempt to fix the mkdir LSM race.
Doing a world writeable mkdir and _then_ adding a label seems like a race
window, so set the global "create stuff with these labels" context, then
do the creates.
Rob Landley [Fri, 22 May 2015 02:25:41 +0000 (21:25 -0500)]
ls -lZ wasn't putting a space before the xattr output.
José Bollo [Fri, 22 May 2015 02:00:25 +0000 (21:00 -0500)]
mkdir: Fix argument of option -Z
Rob Landley [Thu, 21 May 2015 04:59:53 +0000 (23:59 -0500)]
Make "grep -r regex" work on implicit "." if no files specified.
Rob Landley [Wed, 20 May 2015 04:29:18 +0000 (23:29 -0500)]
Add -Z support to mkdir, based on a patch from Jose Bollo.
I have no idea why -Z isn't showing up in mkdir --help when enabled, I
need to look at that...
Rob Landley [Tue, 19 May 2015 19:53:06 +0000 (14:53 -0500)]
Adapted patch from José Bollo to do the "tonight we're gonna api like
it's 1999 and every path ever is from cwd or root" api versions for sockets
and as a fallback of the open fails.
There are still some holes (symlink to socket with -L will give you info
about the symlink, not the socket, and symlink to a file you can't open will
give you info about the symlink, not the file) but the correct fix is
to make O_PATH work in the kernel for the LSM functions. (If we can read
this data by path, we should be able to read it by O_PATH. We should not
need two codepaths for this.)
Rob Landley [Tue, 19 May 2015 00:14:53 +0000 (19:14 -0500)]
Switch id over to new infrastructure, switch id to use FORCE_FLAGS, and
make lib/lsm.h auto-include from toys.h.
Rob Landley [Mon, 18 May 2015 19:48:11 +0000 (14:48 -0500)]
Fix "ls -Z . toys" segfaulting, because preprocessing skipped.
strwidth() got called on ->extra which was NULL. Had some other bad effects
ala "ls -sk file1 file2 file3" ignored the -k. This should fix that too.
Rob Landley [Mon, 18 May 2015 18:33:36 +0000 (13:33 -0500)]
Recent commit broke ls -R (test reversed), and "ls -R singledir" should
show label: at the start (yes, even "ls -R" in an empty dir).
Rob Landley [Mon, 18 May 2015 07:00:43 +0000 (02:00 -0500)]
More ls -Z upgrading. Move TOYBOX_SELINUX and TOYBOX_SMACK support from
portability.h to new lib/lsm.h. Update ls.c to use it.
Fix "ls . toys" (two directories when one is . or ..), which was filtering
out the . as something we shouldn't recurse into even though it was explicitly
listed on the command line. For some reason "ls -Z . toys" is still segfaulting
though (but "ls -Z ." isn't), need to figure out why...
José Bollo [Wed, 6 May 2015 12:57:51 +0000 (14:57 +0200)]
stat: fix group name
Change-Id: I0ad65a40bf380d789c4396ebdc01be217901a2e3
Rob Landley [Thu, 14 May 2015 18:48:55 +0000 (13:48 -0500)]
Bugfix from Hyejin Kim: su should not prompt root user for new user's password.
Rob Landley [Thu, 14 May 2015 18:43:01 +0000 (13:43 -0500)]
Promote reset (actually write a new one using the simple man 4 console_codes
terminal reset escape sequence) and add gettty() function to lib so terminal
gets reset even when we redirect stdout/stderr. (This is apparently the
expected behavior.)
Rob Landley [Wed, 13 May 2015 06:34:01 +0000 (01:34 -0500)]
Print name of file at the bottom of the screen.
And yes, I tested $PWD/私はガラスを食べられま す。それは私を傷つけません。
as a name and made it work. If you throw newlines or ascii escapes in the
name it'll use the fancy printing logic for chars, otherwise it does the
full utf8 fontmetrics deal.
Rob Landley [Wed, 13 May 2015 05:22:26 +0000 (00:22 -0500)]
More hexedit cursor boundary tweaking.
Rob Landley [Wed, 13 May 2015 05:04:50 +0000 (00:04 -0500)]
Fix bug (len[7] wasn't zeroed if -Z off, thus -C overestimated entry lengths),
and some cleanups while I was there.
Rob Landley [Tue, 12 May 2015 18:24:26 +0000 (13:24 -0500)]
Set the executable bits on all the *.test files. (Wasn't consistent, is now.)
Rob Landley [Sun, 10 May 2015 23:56:49 +0000 (18:56 -0500)]
Git hates me.
Rob Landley [Sun, 10 May 2015 05:21:42 +0000 (00:21 -0500)]
Cleanups of dirtree_start() calls. (Don't need to feed in flag values, just
symfollow true/false.)
Rob Landley [Sat, 9 May 2015 23:11:22 +0000 (18:11 -0500)]
Add DIRTREE_SHUTUP to disable dirtree warnings if file vanishes out from
under traversal. Pass through full flag set in dirtree_add_node(), add
dirtree_start() wrapper to provide symlink-only behavior (avoiding a lot
of DIRTREE_SYMFOLLOW*!!(logic) repeated in callers).
Rob Landley [Sat, 9 May 2015 22:07:22 +0000 (17:07 -0500)]
Probe for -Wno-string-plus-int.
LLVM has its own nuts warnings about things that aren't wrong, but disabling
them with the relevant -Wno-* warning disabling command line option drives
gcc nuts because it's a command line option it doesn't recognize. (gcc 4.2.1
dies with an error. gcc 4.6 warns about it _only_ if it's warning about
something else. (PICK ONE, either you warn about this or you don't, distract
people from actual problems with noise about something clearly unrelated to
what just changed is extra-stupid.)
So just probe for it, and add the flag only if it doesn't complain about it
while we're producing an unrelated warning.
Rob Landley [Sat, 9 May 2015 01:20:29 +0000 (20:20 -0500)]
Move not-curses code into interstingtimes.c
Elliott Hughes [Wed, 6 May 2015 21:39:12 +0000 (16:39 -0500)]
Fix more with missing files.
Previously we'd go into an infinite loop because we weren't
incrementing optargs.
Also add a missing flush so an error on stderr won't overtake the
escape code that resets reverse video.
Disclaimer: the new behavior isn't exactly like the desktop version;
surprisingly they try to open the next file _before_ they prompt. That
feels weird to me as a user, and seems like it would lead to a more
awkward implementation, but if you're more concerned about
authenticity...
Rob Landley [Wed, 6 May 2015 21:21:19 +0000 (16:21 -0500)]
Re-enable catv command now that flag infrastructure is updated.
Elliott Hughes [Mon, 4 May 2015 17:56:16 +0000 (12:56 -0500)]
Implement SELinux ls -Z support.
This patch uses lgetfilecon rather than fgetfilecon because
dirtree_parentfd always seems to return -1 in this function. If/when
the SMACK code is fixed to work with dirtree_parentfd, I'll send a
matching patch for SELinux.
In the meantime, this works, and although ls -h is still on my to-do
list, I think this patch is sufficient to let us replace toolbox ls
with toybox ls.
Rob Landley [Mon, 4 May 2015 01:18:53 +0000 (20:18 -0500)]
Replace android-specific hack with just signal(SIGPIPE, SIG_IGN).
Rob Landley [Mon, 4 May 2015 01:15:52 +0000 (20:15 -0500)]
Yank smack from singleconfig.
Need to come up with a better solution to this, but the problem is that
single.sh's symbol enabling isn't dependency aware, and "silentoldconfig"
prompts. I suspect the better solution is "write a kconfig replacement".
Elliott Hughes [Sun, 3 May 2015 21:25:09 +0000 (16:25 -0500)]
Fix dmesg -c error output.
Use perror_exit to show the likely "Operation not permitted" if klogctl fails.
Rob Landley [Sun, 3 May 2015 21:20:27 +0000 (16:20 -0500)]
Move a prototype to the start of portability.h (suggested by Elliott Hughes)
Hyejin Kim [Sun, 3 May 2015 20:53:37 +0000 (15:53 -0500)]
dhcpd writes leases on "dhcpd.leases" file.
but, dumpleases read from "udhcpd.leases".
Elliott Hughes [Sun, 3 May 2015 20:31:41 +0000 (15:31 -0500)]
Fix getprop sorting and error reporting.
Use qstrcmp instead of alphasort (which expects struct dirent arguments).
Don't use perror_exit because property_list doesn't set errno.
Rob Landley [Sun, 3 May 2015 20:13:41 +0000 (15:13 -0500)]
Minor dmesg cleanup.
Rob Landley [Sun, 3 May 2015 17:41:05 +0000 (12:41 -0500)]
If a shortopt is configured out right before a bare longopt, the option parsing infrastructure segfaults because there's no next shortopt but the list isn't empty. (There was a test for this, but we're simultaneously traversing two lists and it was testing the wrong one.)
Mark Salyzyn [Sat, 2 May 2015 22:41:27 +0000 (17:41 -0500)]
dmesg: add -t suppress timestamp flag