aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* Convert all modutils/* applets to "new style" applet definitionsDenys Vlasenko2016-11-239-118/+119
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Make killall and killall5 selecatable independent from killDenys Vlasenko2016-11-231-8/+16
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Convert all procps/* applets to "new style" applet definitionsDenys Vlasenko2016-11-2314-172/+184
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Convert all miscutils/* applets to "new style" applet definitionsDenys Vlasenko2016-11-2237-77/+147
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Split miscutils/Config.src items into miscutils/*.c filesDenys Vlasenko2016-11-2236-533/+498
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* httpd: explain why we use sprintf and why it should be fineDenys Vlasenko2016-11-221-20/+36
| | | | | | | 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>
* Fix allnoconfig warningsDenys Vlasenko2016-11-181-8/+16
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* applets.h.sh: a script to check applet names against config optionsDenys Vlasenko2016-11-171-0/+20
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Make mkfs.vfat and mkdosfs individually selectableDenys Vlasenko2016-11-164-10/+19
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Make mke2fs and mkfs.ext2 individually selectableDenys Vlasenko2016-11-164-11/+20
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Make bzcat, lzcat, xzcat, zcat, lzopcat, unlzop individually selectableDenys Vlasenko2016-11-163-35/+81
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Make ifup and ifdown individually selectable.Denys Vlasenko2016-11-144-116/+127
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Make swapon and swapoff individually selectable.Denys Vlasenko2016-11-144-32/+50
| | | | | | For example, without swapoff, code shrinks by 277 bytes. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Make grep/egrep/fgrep independently selectableDenys Vlasenko2016-11-142-31/+23
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Make halt/poweroff/reboot independently selectableDenys Vlasenko2016-11-141-9/+32
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Make setarch/linux32/linux64 independently selectableDenys Vlasenko2016-11-131-5/+24
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* dnsdomainname: split it from "hostname", make it independently selectableDenys Vlasenko2016-11-134-11/+24
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* tar: handle pax-encoded utf8 filenames and link names. Closes 9406Denys Vlasenko2016-11-113-7/+45
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: make getch/peek functions directly calledDenys Vlasenko2016-11-081-27/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* hush: renumber PIPE_foo, make PIPE_SEQ = 0Denys Vlasenko2016-11-081-5/+4
| | | | | | | | | | 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>
* hush: small optimization in run_listDenys Vlasenko2016-11-081-7/+8
| | | | | | | | | 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>
* hush: deindent large block of code, no code changesDenys Vlasenko2016-11-081-58/+57
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: simplify insert_bg_jobsDenys Vlasenko2016-11-081-10/+8
| | | | | | | function old new delta insert_bg_job 366 281 -85 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: make "wait %1" less likely to play with signal maskDenys Vlasenko2016-11-081-8/+7
| | | | | | | | | | | 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>
* hush: rework "wait %jobspec" to work in non-interactive shells tooDenys Vlasenko2016-11-089-13/+28
| | | | | | | | | 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>
* hush: "wait $!; echo $?" should return 127 if $! already exitedDenys Vlasenko2016-11-071-4/+5
| | | | | | | 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>
* hush: implement "wait %jobspec"Denys Vlasenko2016-11-071-29/+88
| | | | | | | | | | | | | | | | 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>
* hush: factor out %jobspec parsingDenys Vlasenko2016-11-071-11/+22
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: comment fixDenys Vlasenko2016-11-071-2/+2
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: do not allow sh -c '{ echo boo }'Denys Vlasenko2016-11-071-2/+4
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* cpio: add ownership (-R) test casesAaro Koskinen2016-11-041-0/+24
| | | | | | | Add ownership (-R) test cases. Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: case logic for setting $? was still wrongDenys Vlasenko2016-11-041-4/+12
| | | | | | | Resetting to 0 should happen in "esac". Matched branch must still see previous $?. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: non-matching "case" statement sets $? to 0Denys Vlasenko2016-11-041-0/+2
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: allow { cmd } to not be terminated by semicolon in some casesDenys Vlasenko2016-11-045-6/+58
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash: fix "duplicate local" code (forgot to re-enable interrupts)Denys Vlasenko2016-11-041-3/+20
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* comment and readme updatesDenys Vlasenko2016-11-042-1/+10
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* su: expand help; simplify passing of -c CMD to run_shell()Denys Vlasenko2016-11-036-25/+45
| | | | | | | | | | | | | 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>
* loadfont: 32k size limit is not enoughDenys Vlasenko2016-11-031-2/+4
| | | | | | | | | 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>
* ash: while (!got_sig) pause() is not reliable, use sigsuspend()Denys Vlasenko2016-11-031-5/+6
| | | | | | | 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>
* man: remove -Tascii from nroff invocationDenys Vlasenko2016-10-311-2/+4
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* man: make width selection more thorough; explain how to override itDenys Vlasenko2016-10-312-16/+44
| | | | | | | 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>
* man: allow nroff and tbl commands be overridden; unmangle writing to filesDenys Vlasenko2016-10-301-25/+79
| | | | | | | | | | | | | | | | | | | 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>
* ash: if using libc glob(), skip it if no metachars are in wordDenys Vlasenko2016-10-301-0/+15
| | | | | | | | | 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>
* ash: fix bit-rotten debug infrastructureDenys Vlasenko2016-10-301-14/+7
| | | | | | DEBUG = 2 output was a bit messed up Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash: make popfile() anfter popallfiles() safeDenys Vlasenko2016-10-301-2/+5
| | | | | | | | | | | 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>
* hush: fix "(sleep 1; exit 3) & sleep 2; echo $?; wait $!; echo $?"Denys Vlasenko2016-10-281-4/+14
| | | | | | | "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>
* hush: fix "wait PID"Denys Vlasenko2016-10-287-174/+246
| | | | | | | | | | | | | | | | | 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>
* ash: use pause(), not sigsuspend(), in wait builtinDenys Vlasenko2016-10-281-26/+31
| | | | | | | | | Same effect, smaller code function old new delta dowait 463 374 -89 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash: fix interactive "command eval STRING" exiting on errors.Denys Vlasenko2016-10-283-1/+33
| | | | | | This bug is also present in current dash Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash: [JOBS] Fix dowait signal raceDenys Vlasenko2016-10-271-13/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>