oweals/busybox.git
5 years agovi: further fixes to undo after autoindent
Ron Yorston [Mon, 11 Feb 2019 08:29:15 +0000 (08:29 +0000)]
vi: further fixes to undo after autoindent

Commit bb983f30e (vi: fix faulty undo after autoinsert) has a
number of problems:

- The commit message refers to 'autoinsert' when it really means
  'autoindent'.

- The indentation of undo_push_insert() was incorrect.

- Most seriously the commit only fixed the problem for cases where
  the indentation was exactly one character.  This is because undo_push()
  only allows single characters to be queued for UNDO_INS_QUEUED.

  Lifting this restriction allows the example given in the previous
  commit message (with a three character indent) to work.

function                                             old     new   delta
undo_push                                            406     435     +29
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/0 up/down: 29/0)               Total: 29 bytes

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agoi2ctransfer: new applet
Nikolaus Voss [Sun, 10 Feb 2019 18:56:41 +0000 (19:56 +0100)]
i2ctransfer: new applet

i2ctransfer sends and receives user defined i2c messages

v2: apply Xabier's comments: add -a option, don't decrement argc,
    use bb_show_usage() and xzalloc()
v3: fix possible out of bound access to msgs[nmsgs]

Reviewed-by: Xabier Oneca -- xOneca <xoneca@gmail.com>
Signed-off-by: Nikolaus Voss <nikolaus.voss@loewensteinmedical.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agosysctl: fix compatibility with procps sysctl
Aaro Koskinen [Fri, 8 Feb 2019 15:30:24 +0000 (16:30 +0100)]
sysctl: fix compatibility with procps sysctl

Busybox sysctl is incompatible with procps when '.' appears in
directory name, mostly happens with VLANs.

        busybox syntax (since 2008): net.ipv4.conf.eth0.100.mc_forwarding
         procps syntax (since 2002): net.ipv4.conf.eth0/100.mc_forwarding
                 (supported by both: net/ipv4/conf/eth0.100/mc_forwarding)

Use procps syntax for output; for input, allow both.

function                                             old     new   delta
sysctl_dots_to_slashes                                86     143     +57
sysctl_act_on_setting                                443     453     +10
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 67/0)               Total: 67 bytes

Signed-off-by: Aaro Koskinen <aaro.koskinen@nokia.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agosysctl: do slash/dot conversions only on name, not value part
Denys Vlasenko [Fri, 8 Feb 2019 15:02:39 +0000 (16:02 +0100)]
sysctl: do slash/dot conversions only on name, not value part

function                                             old     new   delta
sysctl_dots_to_slashes                                71      86     +15

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agosysctl: on EIO ("sysctl net.ipv6.conf.all.stable_secret") set nonzero exitcode
Denys Vlasenko [Fri, 8 Feb 2019 13:59:06 +0000 (14:59 +0100)]
sysctl: on EIO ("sysctl net.ipv6.conf.all.stable_secret") set nonzero exitcode

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agosysctl: avoid stat() on every item if in -w mode
Denys Vlasenko [Fri, 8 Feb 2019 13:27:21 +0000 (14:27 +0100)]
sysctl: avoid stat() on every item if in -w mode

function                                             old     new   delta
sysctl_act_recursive                                 163     167      +4

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agosysctl: allow setting empty values
Denys Vlasenko [Fri, 8 Feb 2019 13:02:59 +0000 (14:02 +0100)]
sysctl: allow setting empty values

function                                             old     new   delta
sysctl_act_on_setting                                451     445      -6

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agovi: fix replacement of single character with CR
Ron Yorston [Sun, 3 Feb 2019 14:01:58 +0000 (14:01 +0000)]
vi: fix replacement of single character with CR

Currently if the 'r' command is followed by a carriage return a
literal CR replaces the current character.

Fix this so that:

- a new line is inserted
- the autoindent setting is respected
- the cursor is placed at the start of the new line

function                                             old     new   delta
do_cmd                                              5052    5060      +8
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/0 up/down: 8/0)                 Total: 8 bytes

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agovi: fix faulty undo after autoinsert
Ron Yorston [Sun, 3 Feb 2019 10:13:17 +0000 (10:13 +0000)]
vi: fix faulty undo after autoinsert

Enable autoinsert and enter the following with an indent of three
spaces:

   line 1
   line 2

Using 'u' to undo the last insert results in:

   line1e 2

The insertion of the indent hasn't been properly recorded.

Since recording insertions is a common operation add a convenience
function, undo_push_insert(), to handle this and use it to record
the autoindent correctly.

function                                             old     new   delta
undo_push_insert                                       -      36     +36
string_insert                                        133     129      -4
char_insert                                          518     473     -45
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/2 up/down: 36/-49)            Total: -13 bytes

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agochcon: Fix typo in ACTION_RECURSE
Rostislav Skudnov [Wed, 6 Feb 2019 11:57:29 +0000 (11:57 +0000)]
chcon: Fix typo in ACTION_RECURSE

Signed-off-by: Rostislav Skudnov <rostislav@tuxera.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agodhcp service example: rewrite "private network to mask" as case statement
Denys Vlasenko [Fri, 8 Feb 2019 09:37:05 +0000 (10:37 +0100)]
dhcp service example: rewrite "private network to mask" as case statement

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agodhcp service example: cater for servers hot giving subnet and/or router
Denys Vlasenko [Tue, 5 Feb 2019 16:48:24 +0000 (17:48 +0100)]
dhcp service example: cater for servers hot giving subnet and/or router

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agolineedit: fix SEGV in isk, hexedit, ed, closes 11661
Denys Vlasenko [Mon, 4 Feb 2019 15:16:30 +0000 (16:16 +0100)]
lineedit: fix SEGV in isk, hexedit, ed, closes 11661

fdisk, hexedit and ed calls read_line_edit in libbb/lineedit.c with NULL
as first argument. On line 2373 of lineedit.c of busybox version 1.29.3,
state->hist_file is referenced without checking the state->flag.

This causes segmentation fault on fdisk, hexedit and ed on ARM Cortex-A9.
It somehow works on x86_64.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agoservice examples: do not respawn supplicant too often
Denys Vlasenko [Sat, 2 Feb 2019 18:06:19 +0000 (19:06 +0100)]
service examples: do not respawn supplicant too often

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agogrep: short-circuit -v to bail out on first match
Ari Sundholm [Mon, 28 Jan 2019 17:41:12 +0000 (19:41 +0200)]
grep: short-circuit -v to bail out on first match

A small optimization. There is no need to try matching the current
input line against any further patterns if a match was already
found and -v is specified.

function                                             old     new   delta
grep_file                                           1463    1440     -23

Signed-off-by: Ari Sundholm <ari@tuxera.com>
Signed-off-by: Niko Vähäsarja <niko@tuxera.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agogrep: fix -x -v with certain pattern orders
Ari Sundholm [Tue, 29 Jan 2019 13:42:57 +0000 (14:42 +0100)]
grep: fix -x -v with certain pattern orders

We found out that busybox -x -v is a bit broken:

ari@ari-thinkpad:~/busybox$ echo '  aa bb cc' | ./busybox grep -x -e 'aa.*' -e '.*bb.*'
  aa bb cc
ari@ari-thinkpad:~/busybox$ echo '  aa bb cc' | ./busybox grep -x -v -e 'aa.*' -e '.*bb.*'
ari@ari-thinkpad:~/busybox$ echo '  aa bb cc' | ./busybox grep -x -e '.*aa.*' -e 'bb.*'
  aa bb cc
ari@ari-thinkpad:~/busybox$ echo '  aa bb cc' | ./busybox grep -x -v -e '.*aa.*' -e 'bb.*'
  aa bb cc

Last one is wrong.

This patch fixes the issue by making sure that the variable 'found'
never makes a transition from 1 to 0, as this would mean that
grep previously found a match on this input line.

Signed-off-by: Ari Sundholm <ari@tuxera.com>
Signed-off-by: Niko Vähäsarja <niko@tuxera.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agobc: implement pass-by-reference code from upstream
Denys Vlasenko [Fri, 25 Jan 2019 13:24:03 +0000 (14:24 +0100)]
bc: implement pass-by-reference code from upstream

function                                             old     new   delta
zxc_program_popResultAndCopyToVar                    298     493    +195
bc_vec_pushIndex                                       -      75     +75
zxc_vm_process                                       859     928     +69
xc_program_dereference                                 -      66     +66
bc_vec_npush                                           -      65     +65
zbc_num_s                                            239     249     +10
zxc_program_num                                     1024    1032      +8
zbc_num_divmod                                       150     156      +6
xc_program_search                                    143     146      +3
zxc_program_assign                                   392     389      -3
zdc_program_execStr                                  520     517      -3
xc_program_pushVar                                   198     195      -3
zxc_program_exec                                    4101    4092      -9
zbc_program_call                                     318     308     -10
zbc_func_insert                                      120     104     -16
zbc_parse_stmt_possibly_auto                        1460    1439     -21
bc_vec_push                                           53      12     -41
xc_parse_pushIndex                                    61      18     -43
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 6/9 up/down: 497/-149)          Total: 348 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agologin: close PAM session on errors as well, not only on success
Denys Vlasenko [Tue, 22 Jan 2019 16:00:14 +0000 (17:00 +0100)]
login: close PAM session on errors as well, not only on success

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agoip link: Fix vlan proto, closes 8261 and 11638
Bernhard Reutner-Fischer [Tue, 22 Jan 2019 10:11:15 +0000 (11:11 +0100)]
ip link: Fix vlan proto, closes 8261 and 11638

The proto has to be passed in network byte-order.
While at it allow for
 ip link add link eth0 name eth0.2.24 type vlan proto 802.1ad id 24
 ip link del link eth0 name eth0.2.24 type vlan proto 802.1ad id 24
The del was lacking a dev_str and thus errored out. Fix by using
name/dev counterpart as fallback.

The proto identifier 802.1Q was not recognized, just it's lowercase
variant, fix that too.

function                                             old     new   delta
do_add_or_delete                                    1275    1376    +101
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/0 up/down: 101/0)             Total: 101 bytes

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
5 years agoip link: fix mismatched enums in vlan_parse_opt(), closes 11631
Denys Vlasenko [Tue, 22 Jan 2019 09:07:50 +0000 (10:07 +0100)]
ip link: fix mismatched enums in vlan_parse_opt(), closes 11631

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agowget: detect when the length of received file is less than advertised
Denys Vlasenko [Mon, 21 Jan 2019 12:53:26 +0000 (13:53 +0100)]
wget: detect when the length of received file is less than advertised

function                                             old     new   delta
retrieve_file_data                                   579     596     +17

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agosed: code shrink
Denys Vlasenko [Mon, 21 Jan 2019 12:49:28 +0000 (13:49 +0100)]
sed: code shrink

function                                             old     new   delta
parse_file_cmd                                       115      94     -21

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agosed: Fix backslash parsing for 'w' command arg
Brian Foley [Wed, 2 Jan 2019 21:09:45 +0000 (13:09 -0800)]
sed: Fix backslash parsing for 'w' command arg

If there's any whitespace between w and the filename, parse_file_cmd
writes to the wrong offset when trying to fix up backslashes.

This can be seen in the asan build with busybox sed -e 'w 0\\'

Signed-off-by: Brian Foley <bpfoley@google.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agoawk: Fix overly permissive func arg list parsing
Brian Foley [Mon, 7 Jan 2019 02:32:59 +0000 (18:32 -0800)]
awk: Fix overly permissive func arg list parsing

It allows things like 'func f(a b)' and 'func f(a,)' which GNU awk forbids.

function                                             old     new   delta
parse_program                                        327     367     +40
chain_expr                                            40      67     +27
parse_expr                                           891     915     +24
EMSG_TOO_FEW_ARGS                                     30      18     -12
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/1 up/down: 91/-12)             Total: 79 bytes

Signed-off-by: Brian Foley <bpfoley@google.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agoawk: Syntax error if delete isn't given an arg.
Brian Foley [Tue, 1 Jan 2019 21:40:59 +0000 (13:40 -0800)]
awk: Syntax error if delete isn't given an arg.

Unlike exit and return, delete strictly requires an arg, and derefs a
null pointer if executed without one.

Signed-off-by: Brian Foley <bpfoley@google.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agoawk: Guard pointer chasing when parsing ternary expressions.
Brian Foley [Tue, 1 Jan 2019 21:40:58 +0000 (13:40 -0800)]
awk: Guard pointer chasing when parsing ternary expressions.

Avoids an uninit pointer deref for some malformed ternary exprs.

Add a test that would crash in busybox before this fix.

Signed-off-by: Brian Foley <bpfoley@google.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agocapability: fix string comparison in cap_name_to_number
Mark Marshall [Fri, 18 Jan 2019 08:10:34 +0000 (09:10 +0100)]
capability: fix string comparison in cap_name_to_number

The result of strcasecmp was being used incorrectly.  This function
returns 0 if the strings match.

Signed-off-by: Mark Marshall <mark.marshall@omicronenergy.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agowget: remove empty if/endif preprocessor directive pair
Denys Vlasenko [Fri, 18 Jan 2019 22:15:20 +0000 (23:15 +0100)]
wget: remove empty if/endif preprocessor directive pair

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agoservice examples: ifplugd -M to prevents frequent respawning
Denys Vlasenko [Fri, 18 Jan 2019 13:14:07 +0000 (14:14 +0100)]
service examples: ifplugd -M to prevents frequent respawning

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agocheckstack.pl: tweak bfin re
Bernhard Reutner-Fischer [Fri, 18 Jan 2019 08:56:19 +0000 (09:56 +0100)]
checkstack.pl: tweak bfin re

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
5 years agocheckstack: pull from upstream
Bernhard Reutner-Fischer [Thu, 17 Jan 2019 21:21:53 +0000 (22:21 +0100)]
checkstack: pull from upstream

merge upstream changes

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
5 years agocheckstack.pl: fix arch autodetection
Bernhard Reutner-Fischer [Thu, 17 Jan 2019 20:53:53 +0000 (21:53 +0100)]
checkstack.pl: fix arch autodetection

chomp trailing newlines

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
5 years agowget: don't notify on download begin and end if quiet
Martin Lewis [Thu, 10 Jan 2019 12:59:30 +0000 (13:59 +0100)]
wget: don't notify on download begin and end if quiet

When printing notification on download start and end,
mistakenly, it didn't respect the quiet option

function                                             old     new   delta
retrieve_file_data                                   561     579     +18
wget_main                                           2432    2437      +5
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 23/0)               Total: 23 bytes

Signed-off-by: Martin Lewis <martin.lewis.x84@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agoUpdate examples/udhcp/udhcpd.conf
Denys Vlasenko [Tue, 15 Jan 2019 12:19:01 +0000 (13:19 +0100)]
Update examples/udhcp/udhcpd.conf

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agostart-stop-daemon: fix "both -x and -a" case: -a does override argv[0]
Denys Vlasenko [Mon, 14 Jan 2019 14:00:49 +0000 (15:00 +0100)]
start-stop-daemon: fix "both -x and -a" case: -a does override argv[0]

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agostart-stop-daemon: create pidfile before parent exits, closes 8596
Denys Vlasenko [Mon, 14 Jan 2019 13:45:18 +0000 (14:45 +0100)]
start-stop-daemon: create pidfile before parent exits, closes 8596

This removes DAEMON_DOUBLE_FORK flag from bb_daemonize_or_rexec(),
as SSD was the only user.

Also includes fix for -S: now works without -a and -x,
does not print pids
(compat with "start-stop-daemon (OpenRC) 0.34.11 (Gentoo Linux)").

function                                             old     new   delta
start_stop_daemon_main                              1018    1084     +66
add_interface                                         99     103      +4
fail_hunk                                            139     136      -3
bb_daemonize_or_rexec                                205     183     -22
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/2 up/down: 70/-25)             Total: 45 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agoadduser: fix a bug of getpwnam() overwriting shell name, closes 8586
Denys Vlasenko [Sat, 12 Jan 2019 10:51:58 +0000 (11:51 +0100)]
adduser: fix a bug of getpwnam() overwriting shell name, closes 8586

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agotls: code shrink
Denys Vlasenko [Thu, 10 Jan 2019 19:18:02 +0000 (20:18 +0100)]
tls: code shrink

function                                             old     new   delta
lm_add                                                82      78      -4
curve25519                                           793     786      -7
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-11)             Total: -11 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agonslookup: return exitcode 1 on resolution errors
Denys Vlasenko [Wed, 9 Jan 2019 12:38:57 +0000 (13:38 +0100)]
nslookup: return exitcode 1 on resolution errors

function                                             old     new   delta
nslookup_main                                        757     760      +3
send_queries                                        1690    1677     -13

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agotelnet: placate compiler's warning
Denys Vlasenko [Wed, 9 Jan 2019 12:12:58 +0000 (13:12 +0100)]
telnet: placate compiler's warning

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agodate: improve help text for -D
Denys Vlasenko [Wed, 9 Jan 2019 11:58:52 +0000 (12:58 +0100)]
date: improve help text for -D

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agobc: code shrink
Denys Vlasenko [Wed, 9 Jan 2019 10:17:19 +0000 (11:17 +0100)]
bc: code shrink

function                                             old     new   delta
xc_parse_pushInst_and_Index                            -      16     +16
zbc_parse_expr                                      1818    1816      -2
xc_parse_pushIndex                                    65      61      -4
zbc_parse_pushSTR                                     63      58      -5
zbc_parse_name                                       448     442      -6
xc_parse_pushNUM                                      74      67      -7
zdc_parse_expr                                       479     470      -9
bc_parse_pushJUMP_ZERO                                21      12      -9
bc_parse_pushJUMP                                     21      12      -9
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/8 up/down: 16/-51)            Total: -35 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agobc: remove "empty expression" check/message, parsing fails in these cases anyway
Denys Vlasenko [Tue, 8 Jan 2019 18:32:38 +0000 (19:32 +0100)]
bc: remove "empty expression" check/message, parsing fails in these cases anyway

function                                             old     new   delta
zbc_parse_expr                                      1848    1818     -30

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agobc: zbc_parse_expr_empty_ok() is unused except by zbc_parse_expr(), fold it in
Denys Vlasenko [Tue, 8 Jan 2019 18:29:35 +0000 (19:29 +0100)]
bc: zbc_parse_expr_empty_ok() is unused except by zbc_parse_expr(), fold it in

function                                             old     new   delta
zbc_parse_expr                                      1865    1848     -17

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agobc: disallow invalid syntax like "{ print 1 print 2 }"
Denys Vlasenko [Tue, 8 Jan 2019 17:08:48 +0000 (18:08 +0100)]
bc: disallow invalid syntax like "{ print 1 print 2 }"

statement parsing must NOT eat the terminator: caller needs to know
what it was, to correctly decide whether it is a valid one.

function                                             old     new   delta
zxc_program_read                                       -     234    +234
zdc_program_printStream                                -     144    +144
zbc_parse_stmt_possibly_auto                        1413    1460     +47
zxc_vm_process                                       869     859     -10
zxc_program_exec                                    4116    4101     -15
zdc_program_asciify                                  368       -    -368
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 1/2 up/down: 425/-393)           Total: 32 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agopasswd: initialize pointers correctly
Einar Jón [Tue, 8 Jan 2019 15:31:37 +0000 (16:31 +0100)]
passwd: initialize pointers correctly

Fix for running passwd as root (or sudo passwd $USER).
Crashed on call to free(orig) during cleanup.

Fix regression from commit 17058a06c4333fc0c492c168c8a971ebd0fd5a5a
Root user never changes the orig pointer, so when cleaning up, passwd tried to
free orig=(char*)""
Example: sudo passwd $USER
Changing password for xxx
New password:
Bad password: too short
Retype password:
Passwords don't match
free(): invalid pointer
Aborted

function                                             old     new   delta
passwd_main                                          958     961      +3

Signed-off-by: Einar Jón <tolvupostur@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agotls: add comment about dl.fedoraproject.org needing secp256r1 ECC curve
Denys Vlasenko [Tue, 8 Jan 2019 15:09:41 +0000 (16:09 +0100)]
tls: add comment about dl.fedoraproject.org needing secp256r1 ECC curve

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agoudhcpc: when decoding DHCP_SUBNET, ensure it is 4 bytes long
Denys Vlasenko [Mon, 7 Jan 2019 14:33:42 +0000 (15:33 +0100)]
udhcpc: when decoding DHCP_SUBNET, ensure it is 4 bytes long

function                                             old     new   delta
udhcp_run_script                                     795     801      +6

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agoudhcp: code shrink
Denys Vlasenko [Mon, 7 Jan 2019 14:23:18 +0000 (15:23 +0100)]
udhcp: code shrink

function                                             old     new   delta
attach_option                                        406     349     -57

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agosleep: support "inf"
Denys Vlasenko [Mon, 7 Jan 2019 14:20:56 +0000 (15:20 +0100)]
sleep: support "inf"

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agobuild system: fix compiler warnings
Denys Vlasenko [Sun, 6 Jan 2019 19:12:16 +0000 (20:12 +0100)]
build system: fix compiler warnings

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agofind: handle leading -- argument
Denys Vlasenko [Sun, 6 Jan 2019 18:58:18 +0000 (19:58 +0100)]
find: handle leading -- argument

function                                             old     new   delta
find_main                                            464     478     +14

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agotelnet: provide feedback after successful connect
Danijel Tasov [Sun, 6 Jan 2019 18:20:05 +0000 (19:20 +0100)]
telnet: provide feedback after successful connect

The real telnet provides some feedback:

Trying 127.0.0.1...
Connected to localhost.localdomain.
Escape character is '^]'.

We should do this to, because people are sitting there and think
a firewall is dropping packets.

function                                             old     new   delta
telnet_main                                         1270    1279      +9

Signed-off-by: Danijel Tasov <m@rbfh.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agotelnetd: fix bad interaction with vhangup() from login
Denys Vlasenko [Sun, 6 Jan 2019 18:06:01 +0000 (19:06 +0100)]
telnetd: fix bad interaction with vhangup() from login

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agotelnet: code shrink
Denys Vlasenko [Sun, 6 Jan 2019 17:45:38 +0000 (18:45 +0100)]
telnet: code shrink

function                                             old     new   delta
put_iac3_IAC_x_y_merged                                -      21     +21
put_iac4_msb_lsb                                       -      19     +19
put_iac2_msb_lsb                                       -      19     +19
put_iac                                               20      34     +14
iac_flush                                             32      36      +4
put_iac2_merged                                       46       -     -46
telnet_main                                         1492    1270    -222
------------------------------------------------------------------------------
(add/remove: 3/1 grow/shrink: 2/1 up/down: 77/-268)          Total: -191 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agotelnet: speed up processing of network input
Denys Vlasenko [Sun, 6 Jan 2019 17:41:11 +0000 (18:41 +0100)]
telnet: speed up processing of network input

function                                             old     new   delta
telnet_main                                         1482    1492     +10

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agoip: print dadfailed flag
Kaarle Ritvanen [Mon, 31 Dec 2018 17:52:32 +0000 (19:52 +0200)]
ip: print dadfailed flag

Signed-off-by: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agols: make -i compatible with coreutils: don't follow symlink by default
Martijn Dekker [Fri, 4 Jan 2019 17:54:52 +0000 (18:54 +0100)]
ls: make -i compatible with coreutils: don't follow symlink by default

Signed-off-by: Martijn Dekker <martijn@inlv.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agowget: notify on download begin and end
Martin Lewis [Fri, 4 Jan 2019 17:26:04 +0000 (18:26 +0100)]
wget: notify on download begin and end

When using -o to file the progress meter is not displayed, so write that
we started the download and that we finished it.

function                                             old     new   delta
retrieve_file_data                                   465     561     +96
wget_main                                           2412    2432     +20
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 116/0)             Total: 116 bytes
   text    data     bss     dec     hex filename
 979022     485    7296  986803   f0eb3 busybox_old
 979224     485    7296  987005   f0f7d busybox_unstripped

Signed-off-by: Martin Lewis <martin.lewis.x84@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agowget: add -o flag
Martin Lewis [Wed, 26 Dec 2018 15:28:45 +0000 (16:28 +0100)]
wget: add -o flag

function                                             old     new   delta
wget_main                                           2348    2412     +64
packed_usage                                       33062   33093     +31
static.wget_longopts                                 252     266     +14
progress_meter                                       158     159      +1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/0 up/down: 110/0)             Total: 110 bytes

Signed-off-by: Martin Lewis <martin.lewis.x84@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agobc: shorten "limits" output
Denys Vlasenko [Fri, 4 Jan 2019 15:26:19 +0000 (16:26 +0100)]
bc: shorten "limits" output

   text    data     bss     dec     hex filename
 979016     485    7296  986797   f0ead busybox_old
 978959     485    7296  986740   f0e74 busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agobc: formatting changes, added a FIXME comment, no logic changes
Denys Vlasenko [Fri, 4 Jan 2019 14:54:40 +0000 (15:54 +0100)]
bc: formatting changes, added a FIXME comment, no logic changes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agobc: support void functions (GNU compat)
Denys Vlasenko [Fri, 4 Jan 2019 12:58:46 +0000 (13:58 +0100)]
bc: support void functions (GNU compat)

function                                             old     new   delta
xc_program_print                                       -     689    +689
zxc_vm_process                                       814     869     +55
zxc_program_exec                                    4098    4116     +18
zxc_program_assign                                   385     392      +7
bc_result_free                                        43      46      +3
zxc_program_binOpPrep                                243     245      +2
zdc_program_execStr                                  518     520      +2
zxc_program_print                                    683       -    -683
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 6/0 up/down: 776/-683)           Total: 93 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agodc: fit returning of string
Denys Vlasenko [Fri, 4 Jan 2019 05:18:00 +0000 (06:18 +0100)]
dc: fit returning of string

function                                             old     new   delta
zxc_program_exec                                    4087    4098     +11

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agodc: fix '?'
Denys Vlasenko [Fri, 4 Jan 2019 04:41:47 +0000 (05:41 +0100)]
dc: fix '?'

function                                             old     new   delta
zdc_parse_expr                                       470     479      +9
zxc_vm_process                                       839     814     -25
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 9/-25)             Total: -16 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agobc: eliminate struct BcInstPtr::results_len_before_call, it is redundant
Denys Vlasenko [Thu, 3 Jan 2019 23:34:52 +0000 (00:34 +0100)]
bc: eliminate struct BcInstPtr::results_len_before_call, it is redundant

function                                             old     new   delta
zbc_program_call                                     332     318     -14
zxc_program_exec                                    4147    4087     -60
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-74)             Total: -74 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agobc: add a palceholder comment for "void" return
Denys Vlasenko [Thu, 3 Jan 2019 23:21:29 +0000 (00:21 +0100)]
bc: add a palceholder comment for "void" return

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agobc: remove extra div/0 test, remove test for string function parameter
Denys Vlasenko [Thu, 3 Jan 2019 23:05:07 +0000 (00:05 +0100)]
bc: remove extra div/0 test, remove test for string function parameter

function                                             old     new   delta
zbc_program_call                                     354     332     -22
zxc_program_assign                                   426     385     -41
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-63)             Total: -63 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agobc: fix "...; return}" to work, disallow "return ()"
Denys Vlasenko [Thu, 3 Jan 2019 22:34:36 +0000 (23:34 +0100)]
bc: fix "...; return}" to work, disallow "return ()"

function                                             old     new   delta
zbc_parse_expr                                        24    1865   +1841
zbc_parse_stmt_possibly_auto                        1425    1413     -12
bc_parse_expr_empty_ok                              1843       -   -1843
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/1 up/down: 1841/-1855)        Total: -14 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agobc: make error line number also size_t, like everything else
Denys Vlasenko [Wed, 2 Jan 2019 15:30:24 +0000 (16:30 +0100)]
bc: make error line number also size_t, like everything else

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agobc: generate large bc tests on the fly, -5 mbytes in the git tree
Denys Vlasenko [Wed, 2 Jan 2019 13:00:20 +0000 (14:00 +0100)]
bc: generate large bc tests on the fly, -5 mbytes in the git tree

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agobc: speed up string printing, fix print ""
Denys Vlasenko [Wed, 2 Jan 2019 04:03:53 +0000 (05:03 +0100)]
bc: speed up string printing, fix print ""

function                                             old     new   delta
static.esc                                             -       9      +9
zxc_program_print                                    681     683      +2
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/0 up/down: 11/0)               Total: 11 bytes
   text    data     bss     dec     hex filename
 979144     485    7296  986925   f0f2d busybox_old
 979062     485    7296  986843   f0edb busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agobc: upstream fixes
Denys Vlasenko [Tue, 1 Jan 2019 20:50:14 +0000 (21:50 +0100)]
bc: upstream fixes

function                                             old     new   delta
bc_parse_expr_empty_ok                              1764    1843     +79
bc_error_at                                            -      62     +62
bc_parse_inst_isLeaf                                   -      30     +30
zbc_func_insert                                      100     120     +20
bc_error_bad_function_definition                       -      10     +10
bc_error_bad_assignment                                -      10     +10
zxc_lex_next                                        1608    1614      +6
ok_in_expr                                            30       -     -30
zxc_vm_process                                       874     839     -35
------------------------------------------------------------------------------
(add/remove: 4/1 grow/shrink: 3/1 up/down: 217/-65)           Total: 152 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agosingle-applet build --help had extra \n, remove
Denys Vlasenko [Tue, 1 Jan 2019 15:54:30 +0000 (16:54 +0100)]
single-applet build --help had extra \n, remove

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agotls: pstm code shrink
Denys Vlasenko [Tue, 1 Jan 2019 14:40:43 +0000 (15:40 +0100)]
tls: pstm code shrink

Optimize ABI calling convention and "dead code" cases where return value
is known to be always "success".

function                                             old     new   delta
pstm_mod                                             113    1227   +1114
pstm_exptmod                                        1463    1532     +69
pstm_montgomery_reduce                               381     393     +12
pstm_sqr_comba                                       478     487      +9
pstm_mul_comba                                       447     452      +5
der_binary_to_pstm                                    42      45      +3
pstm_count_bits                                       48      46      -2
pstm_clear                                            72      70      -2
pstm_clamp                                            57      55      -2
pstm_zero                                             38      34      -4
pstm_init_size                                        46      42      -4
pstm_init_for_read_unsigned_bin                       24      20      -4
pstm_grow                                             72      68      -4
pstm_unsigned_bin_size                                37      32      -5
pstm_cmp_mag                                          78      72      -6
pstm_copy                                             92      84      -8
pstm_mul_d                                           224     215      -9
pstm_rshd                                            104      94     -10
pstm_mul_2                                           156     146     -10
tls_handshake                                       2085    2072     -13
psRsaEncryptPub                                      421     408     -13
pstm_lshd                                            109      95     -14
pstm_cmp                                              54      39     -15
s_pstm_sub                                           228     212     -16
pstm_init_copy                                        72      52     -20
pstm_read_unsigned_bin                               109      88     -21
pstm_mulmod                                          120      99     -21
s_pstm_add                                           337     314     -23
pstm_add                                             108      84     -24
pstm_mul_2d                                          186     161     -25
pstm_sub                                             102      74     -28
pstm_to_unsigned_bin                                 151     120     -31
pstm_set                                              34       -     -34
pstm_div_2d                                          409     373     -36
pstm_init                                             42       -     -42
pstm_exch                                             50       -     -50
pstm_montgomery_setup                                 89       -     -89
pstm_2expt                                            96       -     -96
pstm_montgomery_calc_normalization                   140       -    -140
pstm_div                                            1522       -   -1522
------------------------------------------------------------------------------
(add/remove: 0/7 grow/shrink: 6/27 up/down: 1212/-2343)     Total: -1131 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agobc: in xc_read_line(), check ^C on NUL input bytes too
Denys Vlasenko [Tue, 1 Jan 2019 01:19:02 +0000 (02:19 +0100)]
bc: in xc_read_line(), check ^C on NUL input bytes too

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agobc: remove superfluous assigment
Denys Vlasenko [Mon, 31 Dec 2018 18:50:06 +0000 (19:50 +0100)]
bc: remove superfluous assigment

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agobc: support ibase up to 36 (GNU compat)
Denys Vlasenko [Mon, 31 Dec 2018 18:42:13 +0000 (19:42 +0100)]
bc: support ibase up to 36 (GNU compat)

function                                             old     new   delta
zxc_program_num                                      995    1018     +23

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agobc: fold xc_lex_more_input() into peek_inbuf()
Denys Vlasenko [Mon, 31 Dec 2018 17:48:10 +0000 (18:48 +0100)]
bc: fold xc_lex_more_input() into peek_inbuf()

function                                             old     new   delta
peek_inbuf                                            69      56     -13

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agopmap: make 32-bit version work better on 64-bit kernels
Denys Vlasenko [Sun, 30 Dec 2018 19:24:59 +0000 (20:24 +0100)]
pmap: make 32-bit version work better on 64-bit kernels

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agomake_single_applets.sh: fix for BSS trick
Denys Vlasenko [Sun, 30 Dec 2018 19:07:54 +0000 (20:07 +0100)]
make_single_applets.sh: fix for BSS trick

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agoStart 1.31.0 development cycle
Denys Vlasenko [Sun, 30 Dec 2018 15:32:00 +0000 (16:32 +0100)]
Start 1.31.0 development cycle

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agoBump version to 1.30.0 1_30_0
Denys Vlasenko [Sun, 30 Dec 2018 15:15:57 +0000 (16:15 +0100)]
Bump version to 1.30.0

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agobc: tidying up, no logic changes
Denys Vlasenko [Sun, 30 Dec 2018 14:56:36 +0000 (15:56 +0100)]
bc: tidying up, no logic changes

function                                             old     new   delta
bc_ops_prec_and_assoc                                  -      25     +25
xc_vm_init                                           665     663      -2
bc_parse_ops                                          25       -     -25
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 0/1 up/down: 25/-27)             Total: -2 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agobc: simplify representation of 0.5 in sqrt()
Denys Vlasenko [Sat, 29 Dec 2018 15:23:34 +0000 (16:23 +0100)]
bc: simplify representation of 0.5 in sqrt()

function                                             old     new   delta
zxc_program_exec                                    4012    4149    +137
zdc_program_printStream                              144       -    -144
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/0 up/down: 137/-144)           Total: -7 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agobc: remove special-cased assignment to ibase, it works correctly with general rules
Denys Vlasenko [Sat, 29 Dec 2018 13:52:30 +0000 (14:52 +0100)]
bc: remove special-cased assignment to ibase, it works correctly with general rules

function                                             old     new   delta
zxc_program_print                                    683     681      -2
zxc_program_prep                                      91      89      -2
zxc_program_copyToVar                                300     298      -2
zdc_program_printStream                              146     144      -2
zdc_program_execStr                                  520     518      -2
zdc_program_asciify                                  370     368      -2
zxc_program_exec                                    4016    4012      -4
zdc_program_modexp                                   694     688      -6
zxc_program_num                                     1020     995     -25
zxc_program_binOpPrep                                306     243     -63
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/10 up/down: 0/-110)          Total: -110 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agobc: more fixes for unusual input bases
Denys Vlasenko [Sat, 29 Dec 2018 01:40:03 +0000 (02:40 +0100)]
bc: more fixes for unusual input bases

function                                             old     new   delta
zxc_program_num                                      990    1020     +30
zxc_lex_number                                       172     202     +30
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 60/0)               Total: 60 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agobc: fix handling of "digits" above 9
Denys Vlasenko [Sat, 29 Dec 2018 01:24:19 +0000 (02:24 +0100)]
bc: fix handling of "digits" above 9

function                                             old     new   delta
zxc_lex_next                                        1573    1608     +35
xc_parse_pushIndex                                    58      56      -2
xc_program_index                                      71      63      -8
zxc_program_num                                     1022     990     -32
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/3 up/down: 35/-42)             Total: -7 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agoconfig: dpkg_deb should be dpkg-deb
Denys Vlasenko [Fri, 28 Dec 2018 17:24:45 +0000 (18:24 +0100)]
config: dpkg_deb should be dpkg-deb

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agoconfig: more tweaks
Denys Vlasenko [Fri, 28 Dec 2018 16:45:35 +0000 (17:45 +0100)]
config: more tweaks

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agobc: bc enables FEATURE_DC_BIG, for correct dc testsuite operation
Denys Vlasenko [Fri, 28 Dec 2018 14:13:23 +0000 (15:13 +0100)]
bc: bc enables FEATURE_DC_BIG, for correct dc testsuite operation

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agoconfig: add size information for three more applets
Denys Vlasenko [Fri, 28 Dec 2018 12:37:44 +0000 (13:37 +0100)]
config: add size information for three more applets

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agobc: rename config options
Denys Vlasenko [Thu, 27 Dec 2018 21:52:13 +0000 (22:52 +0100)]
bc: rename config options

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agoconfig: add size information for udhcpc
Denys Vlasenko [Fri, 28 Dec 2018 12:03:48 +0000 (13:03 +0100)]
config: add size information for udhcpc

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agoconfig: update size information
Denys Vlasenko [Fri, 28 Dec 2018 02:20:17 +0000 (03:20 +0100)]
config: update size information

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agobc: rename functions common to bc and dc as xc_FOO()
Denys Vlasenko [Thu, 27 Dec 2018 17:23:58 +0000 (18:23 +0100)]
bc: rename functions common to bc and dc as xc_FOO()

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agobc: G.prog.zero does not need initializing num[] vector
Denys Vlasenko [Thu, 27 Dec 2018 17:08:30 +0000 (18:08 +0100)]
bc: G.prog.zero does not need initializing num[] vector

function                                             old     new   delta
bc_vm_init                                           676     665     -11

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agorandomconfig fixes
Denys Vlasenko [Thu, 27 Dec 2018 17:03:20 +0000 (18:03 +0100)]
randomconfig fixes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agobc: use ALIGN1 where appropriate
Denys Vlasenko [Wed, 26 Dec 2018 20:17:12 +0000 (21:17 +0100)]
bc: use ALIGN1 where appropriate

   text    data     bss     dec     hex filename
 980138     485    7296  987919   f130f busybox_old
 980128     485    7296  987909   f1305 busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agobc: undo debugging change, add a small optimization
Denys Vlasenko [Wed, 26 Dec 2018 20:01:41 +0000 (21:01 +0100)]
bc: undo debugging change, add a small optimization

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>