aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2016-11-23Make killall and killall5 selecatable independent from killDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-23Convert all procps/* applets to "new style" applet definitionsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-22Convert all miscutils/* applets to "new style" applet definitionsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-22Split miscutils/Config.src items into miscutils/*.c filesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-22httpd: explain why we use sprintf and why it should be fineDenys Vlasenko
While at it, fix a pathological case where it is not fine: -r REALM with some 8-kbyte long REALM would overflow the buffer. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-18Fix allnoconfig warningsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-17applets.h.sh: a script to check applet names against config optionsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-16Make mkfs.vfat and mkdosfs individually selectableDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-16Make mke2fs and mkfs.ext2 individually selectableDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-16Make bzcat, lzcat, xzcat, zcat, lzopcat, unlzop individually selectableDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-14Make ifup and ifdown individually selectable.Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-14Make swapon and swapoff individually selectable.Denys Vlasenko
For example, without swapoff, code shrinks by 277 bytes. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-14Make grep/egrep/fgrep independently selectableDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-14Make halt/poweroff/reboot independently selectableDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-13Make setarch/linux32/linux64 independently selectableDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-13dnsdomainname: split it from "hostname", make it independently selectableDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-11tar: handle pax-encoded utf8 filenames and link names. Closes 9406Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-08hush: make getch/peek functions directly calledDenys Vlasenko
Indirect calls are more difficult to predict. Unfortunately, on x64 direct call is 5 bytes while indirect "call (reg+ofs)" is 3 bytes: function old new delta i_getch - 82 +82 i_peek - 63 +63 parse_stream 2531 2579 +48 parse_dollar 771 797 +26 parse_redirect 296 321 +25 add_till_closing_bracket 408 420 +12 encode_string 256 265 +9 i_peek_and_eat_bkslash_nl 93 99 +6 add_till_backquote 110 114 +4 parse_and_run_stream 139 141 +2 expand_vars_to_list 1143 1144 +1 static_peek 6 - -6 setup_string_in_str 39 18 -21 setup_file_in_str 40 19 -21 static_get 27 - -27 file_peek 52 - -52 file_get 65 - -65 ------------------------------------------------------------------------------ (add/remove: 2/4 grow/shrink: 9/2 up/down: 278/-192) Total: 86 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-08hush: renumber PIPE_foo, make PIPE_SEQ = 0Denys Vlasenko
PIPE_SEQ is used most often, having it zero makes code smaller: function old new delta done_word 719 707 -12 parse_stream 2546 2531 -15 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-08hush: small optimization in run_listDenys Vlasenko
I thought gcc can detect this itself. It doesn't. function old new delta run_list 1030 1021 -9 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-08hush: deindent large block of code, no code changesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-08hush: simplify insert_bg_jobsDenys Vlasenko
function old new delta insert_bg_job 366 281 -85 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-08hush: make "wait %1" less likely to play with signal maskDenys Vlasenko
Was playing with "sleep 3 | exit 3 & wait %1" and noticed that often SIGCHLD arrives even before I get to signal masking. Can avoid it in this case. function old new delta wait_for_child_or_signal 228 265 +37 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-08hush: rework "wait %jobspec" to work in non-interactive shells tooDenys Vlasenko
Also add tests. wait5.tests so far fails (but works for ash and dash). function old new delta builtin_wait 305 283 -22 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-07hush: "wait $!; echo $?" should return 127 if $! already exitedDenys Vlasenko
It would be nice to provide bash-like "remember las exitcode" thingy, but it's a bit complex. For now, match ash and dash. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-07hush: implement "wait %jobspec"Denys Vlasenko
function old new delta parse_jobspec - 83 +83 job_exited_or_stopped - 79 +79 builtin_wait 236 302 +66 wait_for_child_or_signal 199 228 +29 checkjobs 142 158 +16 builtin_jobs 59 68 +9 process_wait_result 453 408 -45 builtin_fg_bg 272 203 -69 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 4/2 up/down: 282/-114) Total: 168 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-07hush: factor out %jobspec parsingDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-07hush: comment fixDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-07hush: do not allow sh -c '{ echo boo }'Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-04cpio: add ownership (-R) test casesAaro Koskinen
Add ownership (-R) test cases. Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-04hush: case logic for setting $? was still wrongDenys Vlasenko
Resetting to 0 should happen in "esac". Matched branch must still see previous $?. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-04hush: non-matching "case" statement sets $? to 0Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-04hush: allow { cmd } to not be terminated by semicolon in some casesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-04ash: fix "duplicate local" code (forgot to re-enable interrupts)Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-04comment and readme updatesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-03su: expand help; simplify passing of -c CMD to run_shell()Denys Vlasenko
Also, added a comment about bug 9401 (TIOCSTI input injection). function old new delta packed_usage 30909 30932 +23 su_main 470 487 +17 sulogin_main 260 258 -2 run_applet_and_exit 681 678 -3 run_shell 166 126 -40 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-03loadfont: 32k size limit is not enoughDenys Vlasenko
Since our "read to malloced buf" routines only gradually grow allocations, let's be generous here and allow 128k. Reported by Alex Henrie <alexhenrie24@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-03ash: while (!got_sig) pause() is not reliable, use sigsuspend()Denys Vlasenko
dash was doing it for a reason. Unfortunately, it had no comment why... now I know. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-31man: remove -Tascii from nroff invocationDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-31man: make width selection more thorough; explain how to override itDenys Vlasenko
Fedora's "man CMD >file" still uses terminal width, not 80 (but disables formatting), this change mimics that. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-30man: allow nroff and tbl commands be overridden; unmangle writing to filesDenys Vlasenko
Parse this in config files: DEFINE col ... DEFINE tbl ... DEFINE nroff ... Add width options to nroff command line. Use "tbl", not "gtbl", as default tbl command. Export GROFF_NO_SGR=1 and use "col -b -p -x" instead of pager when writing to file. function old new delta man_main 735 863 +128 if_redefined - 64 +64 show_manpage 199 169 -30 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 1/1 up/down: 192/-30) Total: 162 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-30ash: if using libc glob(), skip it if no metachars are in wordDenys Vlasenko
This saves making tons of pointless stat() calls function old new delta expandarg 888 921 +33 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-30ash: fix bit-rotten debug infrastructureDenys Vlasenko
DEBUG = 2 output was a bit messed up Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-30ash: make popfile() anfter popallfiles() safeDenys Vlasenko
In this example: ash -c 'readonly x; echo $(command eval x=2)' evalstring() is called after forkchild(), which calls popallfiles(). On exception, evalstring() will popfile(). Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-28hush: fix "(sleep 1; exit 3) & sleep 2; echo $?; wait $!; echo $?"Denys Vlasenko
"wait $!" may be just a bit too late: backgrounded $! is gone. Do not bomb out in this case. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-28hush: fix "wait PID"Denys Vlasenko
It was not properly interruptible, and did not update job status (the exited processes were still thought of as running). function old new delta process_wait_result - 453 +453 wait_for_child_or_signal - 199 +199 run_list 996 1002 +6 checkjobs_and_fg_shell 41 43 +2 builtin_wait 328 215 -113 checkjobs 516 142 -374 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 2/2 up/down: 660/-487) Total: 173 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-28ash: use pause(), not sigsuspend(), in wait builtinDenys Vlasenko
Same effect, smaller code function old new delta dowait 463 374 -89 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-28ash: fix interactive "command eval STRING" exiting on errors.Denys Vlasenko
This bug is also present in current dash Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-27ash: [JOBS] Fix dowait signal raceDenys Vlasenko
Upstream commit: Date: Sun, 22 Feb 2009 18:10:01 +0800 [JOBS] Fix dowait signal race This test program by Alexey Gladkov can cause dash to enter an infinite loop in waitcmd. #!/bin/dash trap "echo TRAP" USR1 stub() { echo ">>> STUB $1" >&2 sleep $1 echo "<<< STUB $1" >&2 kill -USR1 $$ } stub 3 & stub 2 & until { echo "###"; wait; } do echo "*** $?" done The problem is that if we get a signal after the wait3 system call has returned but before we get to INTON in dowait, then we can jump back up to the top and lose the exit status. So if we then wait for the job that has just exited, then it'll stay there forever. I made the original change that caused this bug to fix pretty much the same bug but in the opposite direction. That is, if we get a signal after we enter wait3 but before we hit the kernel then it too can cause the wait to go on forever (assuming the child doesn't exit). In fact this is pretty much exactly the scenario that you'll find in glibc's documentation on pause(). The solution is given there too, in the form of sigsuspend, which is the only way to do the check and wait atomically. So this patch fixes Alexey's race without reintroducing the old bug by converting the blocking wait3 to a sigsuspend. In order to do this we need to set a signal handler for SIGCHLD, so the code has been modified to always do that. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> I failed to reproduce the bug (it requires precise timing), but it seems real. function old new delta dowait 284 463 +179 setsignal 301 326 +25 signal_handler 59 76 +17 ash_main 1481 1487 +6 localcmd 350 348 -2 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 4/1 up/down: 227/-2) Total: 225 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-27ash: [SIGNAL] Remove EXSIGDenys Vlasenko
Upstream commit 1: Date: Sun, 22 Feb 2009 18:16:13 +0800 [SIGNAL] Remove EXSIG Now that waitcmd no longer uses EXSIG we can remove it. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Upstream commit 2: Date: Thu, 2 Oct 2014 21:07:55 +0800 [ERROR] Set exitstatus in onint Currently the exit status when we receive SIGINT is set in evalcommand which means that it doesn't always get set. For example, if you press CTRL-C at the prompt of an interactive dash, the exit status is not set to 130 as it is in many other Bourne shells. This patch fixes this by moving the setting of the exit status into onint which also simplifies evalcommand. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Upstream commit 3: Date: Fri, 3 Oct 2014 14:07:07 +0800 [EVAL] Do not clobber exitstatus in evalcommand All originators of EXERROR have been setting the exitstatus for a while now. So it is no longer appropriate to set it explicitly in evalcommand. In fact doing so may cause the original exitstatus to be lost. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Last three coomits: function old new delta waitcmd 186 224 +38 dowait 276 284 +8 waitforjob 104 107 +3 localcmd 348 350 +2 showjobs 64 61 -3 forkshell 263 260 -3 raise_interrupt 93 67 -26 blocking_wait_with_raise_on_sig 40 - -40 evalcommand 1264 1208 -56 evaltree 809 498 -311 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>