oweals/busybox.git
7 years agofixes for bugs found by make_single_applets.sh
Denys Vlasenko [Mon, 3 Jul 2017 19:31:16 +0000 (21:31 +0200)]
fixes for bugs found by make_single_applets.sh

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agoBump version to 1.27.0 1_27_0
Denys Vlasenko [Mon, 3 Jul 2017 11:40:46 +0000 (13:40 +0200)]
Bump version to 1.27.0

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agoscripts/randomtest: update things which can't be tested on uclibc
Denys Vlasenko [Mon, 3 Jul 2017 00:33:08 +0000 (02:33 +0200)]
scripts/randomtest: update things which can't be tested on uclibc

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agorandomconfig fixes
Denys Vlasenko [Sun, 2 Jul 2017 23:22:13 +0000 (01:22 +0200)]
randomconfig fixes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agoash: fix $HOME/.profile reading if !ASH_EXPAND_PRMT, take 2
Denys Vlasenko [Sat, 1 Jul 2017 21:24:48 +0000 (23:24 +0200)]
ash: fix $HOME/.profile reading if !ASH_EXPAND_PRMT, take 2

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agoash: fix 'trap - 65'
Denys Vlasenko [Sat, 1 Jul 2017 19:09:27 +0000 (21:09 +0200)]
ash: fix 'trap - 65'

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agoudhcpc6: make -O OPT work
Denys Vlasenko [Wed, 28 Jun 2017 17:18:17 +0000 (19:18 +0200)]
udhcpc6: make -O OPT work

Patch is based on work by tiggerswelt.net.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agomodutils: delete unused replace_underscores()
Denys Vlasenko [Wed, 28 Jun 2017 17:10:29 +0000 (19:10 +0200)]
modutils: delete unused replace_underscores()

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agoudhcpc6: add comments about option 39, no code changes
Denys Vlasenko [Tue, 27 Jun 2017 16:31:08 +0000 (18:31 +0200)]
udhcpc6: add comments about option 39, no code changes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agoash: fix $HOME/.profile reading if !ASH_EXPAND_PRMT
Denys Vlasenko [Tue, 27 Jun 2017 15:51:07 +0000 (17:51 +0200)]
ash: fix $HOME/.profile reading if !ASH_EXPAND_PRMT

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agopgrep: implement -a
Denys Vlasenko [Mon, 26 Jun 2017 19:10:47 +0000 (21:10 +0200)]
pgrep: implement -a

function                                             old     new   delta
pgrep_main                                           640     726     +86

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agoudhcpc6: add support for timezones
Denys Vlasenko [Mon, 26 Jun 2017 17:42:48 +0000 (19:42 +0200)]
udhcpc6: add support for timezones

Basedon patch by Bernd Holzmüller <bernd.holzmueller@tiggerswelt.net>

function                                             old     new   delta
option_to_env                                        504     580     +76

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agopgrep: fix pgrep -flx "sleep 11" - saw "sleep 11" processes as "sleep 11 "
Denys Vlasenko [Mon, 26 Jun 2017 12:41:53 +0000 (14:41 +0200)]
pgrep: fix pgrep -flx "sleep 11" - saw "sleep 11" processes as "sleep 11 "

function                                             old     new   delta
pgrep_main                                           584     597     +13

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agoarchival: add option -k "keep" to gzip/bzip2/lzop, add -U "nokeep" to lzop
Denys Vlasenko [Thu, 15 Jun 2017 16:07:04 +0000 (18:07 +0200)]
archival: add option -k "keep" to gzip/bzip2/lzop, add -U "nokeep" to lzop

function                                             old     new   delta
bbunpack                                             745     779     +34
lzop_main                                             93     121     +28
do_lzo_compress                                      320     328      +8
packed_usage                                       31685   31653     -32
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/1 up/down: 70/-32)             Total: 38 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agofix "ifdef ENABLE_foo": should always be "#if ENABLE_foo"
Denys Vlasenko [Thu, 15 Jun 2017 15:11:59 +0000 (17:11 +0200)]
fix "ifdef ENABLE_foo": should always be "#if ENABLE_foo"

function                                             old     new   delta
pack_gzip                                           1729    1789     +60
fill_window                                          220     216      -4
static.gzip_level_config                              24       -     -24
gzip_main                                            275     192     -83
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/2 up/down: 60/-111)           Total: -51 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agounshare: fix help text; select LONG_OPTS instead depending on them
Denys Vlasenko [Wed, 14 Jun 2017 14:20:02 +0000 (16:20 +0200)]
unshare: fix help text; select LONG_OPTS instead depending on them

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agosetpriv: new applet
Assaf Gordon [Wed, 14 Jun 2017 09:46:52 +0000 (11:46 +0200)]
setpriv: new applet

Add a minimal 'setpriv' implementation supporting the NO_NEW_PRIVS bit.
Typical usage:

    $ busybox setpriv sudo uname
    Linux
    $ busybox setpriv --nnp sudo uname
    sudo: effective uid is not 0, is /usr/bin/sudo on a file system with
    the 'nosuid' option set or an NFS file system without root privileges?

function                                             old     new   delta
packed_usage                                       31580   31685    +105
setpriv_main                                           -      87     +87
prctl                                                  -      53     +53
static.setpriv_longopts                                -      22     +22
applet_names                                        2620    2628      +8
applet_main                                         1516    1520      +4
------------------------------------------------------------------------------
(add/remove: 5/0 grow/shrink: 3/0 up/down: 279/0)             Total: 279 bytes

Signed-off-by: Assaf Gordon <assafgordon@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agoiproute: support for filtering by and printing of scope
André Draszik [Tue, 13 Jun 2017 17:59:59 +0000 (19:59 +0200)]
iproute: support for filtering by and printing of scope

This patch adds filtering by and printing of 'scope' to the
ip route command, taken from the upstream ip command.

x86_64:
function                                             old     new   delta
iproute_list_or_flush                               1548    1674    +126
print_route                                         2394    2469     +75
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 201/0)             Total: 201 bytes

mipsel:
iproute_list_or_flush                               1952    2096    +144
print_route                                         2580    2696    +116
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 2/0 up/down: 260/0)             Total: 260 bytes

Signed-off-by: André Draszik <git@andred.net>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agotar: add IF_FEATURE_* checks
Ming Liu [Fri, 2 Jun 2017 08:47:23 +0000 (10:47 +0200)]
tar: add IF_FEATURE_* checks

A following linking error was observed:
| ==========
| archival/lib.a(tar.o): In function `tar_main':
| archival/tar.c:1168: undefined reference to `unpack_Z_stream'
| archival/tar.c:1168: undefined reference to `unpack_Z_stream'
| ld: busybox_unstripped: hidden symbol `unpack_Z_stream' isn't defined
| ld: final link failed: Bad value

this happened with clang compiler, with the following configs:
| CONFIG_TAR=y
| # CONFIG_FEATURE_SEAMLESS_Z is not set

which can be fixed by adding IF_FEATURE_* checks in.

Signed-off-by: Ming Liu <peter.x.liu@external.atlascopco.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agoip rule: add suppress_{prefixlength,ifgroup} options
Stefan Tomanek [Tue, 13 Jun 2017 17:06:09 +0000 (19:06 +0200)]
ip rule: add suppress_{prefixlength,ifgroup} options

function                                             old     new   delta
iprule_modify                                        816     887     +71
print_rule                                           610     680     +70
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 141/0)             Total: 141 bytes

Signed-off-by: Stefan Tomanek <stefan.tomanek@wertarbyte.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agoash: fix incorrect path in describe_command
Youfu Zhang [Fri, 26 May 2017 07:31:29 +0000 (15:31 +0800)]
ash: fix incorrect path in describe_command

$ PATH=/extra/path:/usr/sbin:/usr/bin:/sbin:/bin \
> busybox sh -xc 'command -V ls; command -V ls; command -Vp ls; command -vp ls'
+ command -V ls
ls is /bin/ls
+ command -V ls
ls is a tracked alias for /bin/ls
+ command -Vp ls
ls is a tracked alias for (null)
+ command -vp ls
Segmentation fault

describe_command should respect `path' argument. Looking up in the hash table
may gives incorrect index in entry.u.index and finally causes incorrect output
or SIGSEGV.

function                                             old     new   delta
describe_command                                     386     313     -73

Signed-off-by: Youfu Zhang <zhangyoufu@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agols: fix support for long options when FEATURE_LS_COLOR is deselected
Laurent Bercot [Fri, 26 May 2017 14:50:53 +0000 (16:50 +0200)]
ls: fix support for long options when FEATURE_LS_COLOR is deselected

Declaration of ls_longopts and initialization of applet_long_options
were incorrectly guarded with ENABLE_FEATURE_LS_COLOR; that yielded a
"ls: NO_OPT: \xff" error message when long options were selected and
color support was not. This patch ensures long options are
initialized separately from color support.

Signed-off-by: Laurent Bercot <ska-dietlibc@skarnet.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agoadd/remove-shell: copy /etc/shells mode to new file
Denys Vlasenko [Fri, 26 May 2017 14:45:28 +0000 (16:45 +0200)]
add/remove-shell: copy /etc/shells mode to new file

function                                             old     new   delta
add_remove_shell_main                                259     300     +41

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agoash,hush: fix SIGCHLD interrupting read builtin
Denys Vlasenko [Mon, 22 May 2017 17:34:45 +0000 (19:34 +0200)]
ash,hush: fix SIGCHLD interrupting read builtin

function                                             old     new   delta
readcmd                                              169     217     +48
shell_builtin_read                                  1087    1097     +10
localcmd                                             366     364      -2
builtin_read                                         197     193      -4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/2 up/down: 58/-6)              Total: 52 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agosv: update to match version 2.1.2 of runit
James Byrne [Mon, 15 May 2017 19:39:51 +0000 (21:39 +0200)]
sv: update to match version 2.1.2 of runit

Backport from upstream versions:
2.1.2
Sun, 10 Aug 2014 18:01:54 +0000
  * sv.c: properly format status command's output on failure cases.
  * sv.c: support optional LSB init script actions reload and
    try-restart.
  * sv.c: fix typo that may lead to wrong output from sv when reporting
    status of multiple service directories.

2.1.1
Sun, 04 Oct 2009 20:28:38 +0000
  * sv.c: on 'down', send runsv the 'down' command properly if not yet
    done (e.g. when taken up with 'once').

    [Remove previous workaround added to BusyBox version].

1.9.0
Mon, 05 May 2008 22:00:13 +0000
  * sv.c: service name is also relative to the current directory if it
    ends with a slash.

1.8.0
Fri, 21 Sep 2007 00:33:56 +0000
  * sv.c: fix race on check for down if pid is 0 and state is run or
    finish.

1.7.1
Sat, 04 Nov 2006 19:23:29 +0000
  * sv.c: properly wait for a service to be restarted on 'restart';
    support checks through -v for pause, cont, kill.

function                                             old     new   delta
sv                                                  1184    1280     +96
control                                              132     180     +48
status                                               118     139     +21
out                                                   64      85     +21
svstatus_print                                       334     344     +10
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 5/0 up/down: 196/0)             Total: 196 bytes

Signed-off-by: James Byrne <james.byrne at origamienergy.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agorunsv: update to match version 2.1.2 of runit
Denys Vlasenko [Mon, 15 May 2017 17:44:48 +0000 (19:44 +0200)]
runsv: update to match version 2.1.2 of runit

Backport from upstream versions:
2.1.0
Thu, 24 Sep 2009 22:49:33 +0000
  * runsv.c: exit with error if [log/]supervise/control exists, but is
    not a fifo.
    [Code abstracted into a separate function to make it more compact
    for BusyBox.]

1.9.0
Mon, 05 May 2008 22:00:13 +0000
  * runsv.c: create temporary new status files for log/supervise/
    actually in log/supervise/.

1.7.2
Tue, 21 Nov 2006 15:13:47 +0000
  * runsv.c: really don't act on commands in state finish; minor.

function                                             old     new   delta
open_control                                           -     135    +135
update_status                                        553     612     +59
custom                                               223     242     +19
ctrl                                                 426     422      -4
warn_cannot                                           21      10     -11
runsv_main                                          1786    1662    -124
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 2/3 up/down: 213/-139)           Total: 74 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agosvlogd.c: support -ttt (dateTtime instead of date_time)
Denys Vlasenko [Mon, 15 May 2017 17:12:09 +0000 (19:12 +0200)]
svlogd.c: support -ttt (dateTtime instead of date_time)

Backport from upstream version:
1.7.0
Sat, 07 Oct 2006 18:24:17 +0000
  * svlogd.c: new option -ttt: prefix log messages with sortable UTC
    timestamp YYYY-MM-DDTHH:MM:SS.xxxxx.

function                                             old     new   delta
svlogd_main                                         1429    1454     +25
packed_usage                                       31575   31580      +5

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agoudhcpc: do not accept --background on NOMMU (same as -b)
Denys Vlasenko [Mon, 8 May 2017 13:11:02 +0000 (15:11 +0200)]
udhcpc: do not accept --background on NOMMU (same as -b)

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agoudhcpc: fix "udhcpc -x hostname:<name> not working on nommu"
Denys Vlasenko [Mon, 8 May 2017 13:02:07 +0000 (15:02 +0200)]
udhcpc: fix "udhcpc -x hostname:<name> not working on nommu"

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agodiff: fix -N and nonexistent files. Closes 7454
Denys Vlasenko [Fri, 5 May 2017 16:39:22 +0000 (18:39 +0200)]
diff: fix -N and nonexistent files. Closes 7454

function                                             old     new   delta
diffreg                                             1253    1310     +57
diff_main                                           1329    1355     +26
create_J                                            1819    1821      +2
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 85/0)               Total: 85 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agovi: survive if stdin is nonblocking. closes 9851
Denys Vlasenko [Tue, 2 May 2017 18:39:02 +0000 (20:39 +0200)]
vi: survive if stdin is nonblocking. closes 9851

function                                             old     new   delta
readit                                                55      69     +14

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agotime: inplement -f FMT
Denys Vlasenko [Fri, 28 Apr 2017 16:01:18 +0000 (18:01 +0200)]
time: inplement -f FMT

function                                             old     new   delta
time_main                                           1076    1134     +58
packed_usage                                       31577   31572      -5

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agotime: implement -a, -o FILE
Tommi Rantala [Fri, 28 Apr 2017 15:54:14 +0000 (17:54 +0200)]
time: implement -a, -o FILE

function                                             old     new   delta
time_main                                           1052    1076     +24
packed_usage                                       31571   31577      +6

Signed-off-by: Tommi Rantala <tommi.t.rantala@nokia.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agotime: document -p in usage
Tommi Rantala [Mon, 24 Apr 2017 16:08:53 +0000 (19:08 +0300)]
time: document -p in usage

Signed-off-by: Tommi Rantala <tommi.t.rantala@nokia.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agolsscsi: new applet
Markus Gothe [Tue, 18 Apr 2017 17:25:49 +0000 (19:25 +0200)]
lsscsi: new applet

function                                             old     new   delta
lsscsi_main                                            -     326    +326
applet_names                                        2613    2620      +7
applet_main                                         1512    1516      +4
applet_install_loc                                   189     190      +1
packed_usage                                       31566   31560      -6
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 3/1 up/down: 338/-6)            Total: 332 bytes

Signed-off-by: Markus Gothe <nietzsche@lysator.liu.se>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agoSpelling fixes in comments, documentation, tests and examples
Denys Vlasenko [Mon, 17 Apr 2017 14:13:32 +0000 (16:13 +0200)]
Spelling fixes in comments, documentation, tests and examples

By klemens <ka7@github.com>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agofactor: fix stray semicolon
Denys Vlasenko [Mon, 17 Apr 2017 13:57:07 +0000 (15:57 +0200)]
factor: fix stray semicolon

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agofactor: support "no-argvs" usage
Denys Vlasenko [Fri, 14 Apr 2017 12:23:49 +0000 (14:23 +0200)]
factor: support "no-argvs" usage

function                                             old     new   delta
factorize_numstr                                       -      72     +72
packed_usage                                       31562   31566      +4
factor_main                                          109     101      -8
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/1 up/down: 76/-8)              Total: 68 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agolibbb: fix "error: redefinition of 'is_tty_secure'"
Denys Vlasenko [Thu, 13 Apr 2017 15:55:05 +0000 (17:55 +0200)]
libbb: fix "error: redefinition of 'is_tty_secure'"

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agofactor: improve comments for sieving logic... also fix a typo
Denys Vlasenko [Thu, 13 Apr 2017 11:38:16 +0000 (13:38 +0200)]
factor: improve comments for sieving logic... also fix a typo

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agofix "loginutils/Config.in:319 error: Overlong line"
Denys Vlasenko [Thu, 13 Apr 2017 11:37:05 +0000 (13:37 +0200)]
fix "loginutils/Config.in:319 error: Overlong line"

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agofactor: improve comments for sieving logic
Denys Vlasenko [Thu, 13 Apr 2017 11:34:40 +0000 (13:34 +0200)]
factor: improve comments for sieving logic

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agolibbb: make check_password() also return CHECKPASS_PW_HAS_EMPTY_PASSWORD
Denys Vlasenko [Thu, 13 Apr 2017 11:04:05 +0000 (13:04 +0200)]
libbb: make check_password() also return CHECKPASS_PW_HAS_EMPTY_PASSWORD

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agosu: FEATURE_SU_BLANK_PW_NEEDS_SECURE_TTY
Denys Vlasenko [Thu, 13 Apr 2017 10:57:04 +0000 (12:57 +0200)]
su: FEATURE_SU_BLANK_PW_NEEDS_SECURE_TTY

When this feature is enabled, blank passwords are not accepted by su
unless the user is on a secure TTY defined in /etc/securetty. This
resembles the default PAM configuration of some Linux distros which
specify the nullok_secure option for pam_unix.so.

Based on patch by Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agologin: move check_securetty to libbb
Kaarle Ritvanen [Fri, 1 Jan 2016 22:20:39 +0000 (00:20 +0200)]
login: move check_securetty to libbb

Signed-off-by: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agofactor: tweak comments
Denys Vlasenko [Thu, 13 Apr 2017 08:51:13 +0000 (10:51 +0200)]
factor: tweak comments

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agoash: implement "exec -a ARGV0 CMD ARGV1..."
Denys Vlasenko [Wed, 12 Apr 2017 19:31:32 +0000 (21:31 +0200)]
ash: implement "exec -a ARGV0 CMD ARGV1..."

function                                             old     new   delta
execcmd                                               71     112     +41
shellexec                                            221     224      +3
evalcommand                                         1158    1161      +3
localcmd                                             364     366      +2
unaliascmd                                           163     154      -9
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/1 up/down: 49/-9)              Total: 40 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agoash: make shellexec capable of using separate argv[0] and filename to exec
Denys Vlasenko [Wed, 12 Apr 2017 19:02:33 +0000 (21:02 +0200)]
ash: make shellexec capable of using separate argv[0] and filename to exec

function                                             old     new   delta
execcmd                                               71      78      +7
shellexec                                            221     224      +3
evalcommand                                         1158    1161      +3
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 13/0)               Total: 13 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agoTweak GETOPT_RESET comment
Denys Vlasenko [Wed, 12 Apr 2017 18:21:34 +0000 (20:21 +0200)]
Tweak GETOPT_RESET comment

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agolibbb: GETOPT_RESET macro
Kaarle Ritvanen [Tue, 11 Apr 2017 21:58:46 +0000 (00:58 +0300)]
libbb: GETOPT_RESET macro

Signed-off-by: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agogrep: FEATURE_GREP_CONTEXT should be available for "fgrep only" too
Denys Vlasenko [Wed, 12 Apr 2017 15:53:54 +0000 (17:53 +0200)]
grep: FEATURE_GREP_CONTEXT should be available for "fgrep only" too

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agocatv: convert this bbox-specific applet into "cat -v"
Denys Vlasenko [Wed, 12 Apr 2017 15:17:29 +0000 (17:17 +0200)]
catv: convert this bbox-specific applet into "cat -v"

function                                             old     new   delta
cat_main                                             150     320    +170
packed_usage                                       31511   31552     +41
applet_install_loc                                   190     189      -1
applet_main                                         1516    1512      -4
applet_names                                        2618    2613      -5
catv_main                                            227       -    -227
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 2/3 up/down: 211/-237)          Total: -26 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agofix errors found with make_single_applets.sh
Denys Vlasenko [Wed, 12 Apr 2017 13:48:19 +0000 (15:48 +0200)]
fix errors found with make_single_applets.sh

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agoSort more misplaced applets into coreutils or util-linux
Denys Vlasenko [Wed, 12 Apr 2017 12:16:29 +0000 (14:16 +0200)]
Sort more misplaced applets into coreutils or util-linux

No code changes

Surprisingly, nice and renice are coming from different packages :)

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agoSort some miscutils/ applets into coreutils or util-linux
Denys Vlasenko [Wed, 12 Apr 2017 11:58:40 +0000 (13:58 +0200)]
Sort some miscutils/ applets into coreutils or util-linux

No code changes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agopartprobe: new applet
Denys Vlasenko [Tue, 11 Apr 2017 17:17:59 +0000 (19:17 +0200)]
partprobe: new applet

function                                             old     new   delta
partprobe_main                                         -      79     +79
packed_usage                                       31485   31511     +26
applet_names                                        2608    2618     +10
applet_main                                         1512    1516      +4
applet_install_loc                                   189     190      +1
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 4/0 up/down: 120/0)             Total: 120 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agow: new applet, alias to "who -H"
Denys Vlasenko [Tue, 11 Apr 2017 16:17:03 +0000 (18:17 +0200)]
w: new applet, alias to "who -H"

function                                             old     new   delta
who_main                                             451     463     +12
packed_usage                                       31477   31485      +8
applet_main                                         1508    1512      +4
applet_names                                        2606    2608      +2
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/0 up/down: 26/0)               Total: 26 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agofallocate: new applet
Denys Vlasenko [Tue, 11 Apr 2017 11:33:54 +0000 (13:33 +0200)]
fallocate: new applet

NAME
       fallocate - preallocate or deallocate space to a file
SYNOPSIS
       fallocate [-c|-p|-z] [-o offset] -l length [-n] filename
       fallocate -d [-o offset] [-l length] filename
DESCRIPTION
       fallocate  is  used  to manipulate the allocated disk space for a file,
       either to deallocate or preallocate it.  For filesystems which  support
       the  fallocate system call, preallocation is done quickly by allocating
       blocks and marking them as uninitialized, requiring no IO to  the  data
       blocks.   This  is  much faster than creating a file by filling it with
       zeroes.

function                                             old     new   delta
fallocate_main                                         -     179    +179
applet_names                                        2597    2606      +9
applet_main                                         1504    1508      +4
applet_suid                                           94      95      +1
applet_install_loc                                   188     189      +1

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agofsfreeze: new applet
Denys Vlasenko [Tue, 11 Apr 2017 09:53:05 +0000 (11:53 +0200)]
fsfreeze: new applet

NAME
       fsfreeze - suspend access to a filesystem (Ext3/4, ReiserFS, JFS, XFS)
SYNOPSIS
       fsfreeze --freeze|--unfreeze mountpoint
DESCRIPTION
       fsfreeze suspends or resumes access to a filesystem.
       fsfreeze halts any new access to the filesystem and creates a stable
       image on disk.
AVAILABILITY
       The fsfreeze command is part of the util-linux 2.28

function                                             old     new   delta
fsfreeze_main                                          -      81     +81
applet_names                                        2597    2606      +9
applet_main                                         1504    1508      +4
applet_suid                                           94      95      +1
applet_install_loc                                   188     189      +1

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agofactor: remove debug code
Denys Vlasenko [Tue, 11 Apr 2017 05:50:42 +0000 (07:50 +0200)]
factor: remove debug code

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agolibbb: move isqrt from factor, use it in diff too
Denys Vlasenko [Tue, 11 Apr 2017 05:34:56 +0000 (07:34 +0200)]
libbb: move isqrt from factor, use it in diff too

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agofactor: much faster, and very slightly larger isqrt()
Denys Vlasenko [Tue, 11 Apr 2017 05:02:42 +0000 (07:02 +0200)]
factor: much faster, and very slightly larger isqrt()

function                                             old     new   delta
isqrt_odd                                             70      88     +18

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agofactor: don't be too clever in isqrt - be small instead
Denys Vlasenko [Mon, 10 Apr 2017 16:30:35 +0000 (18:30 +0200)]
factor: don't be too clever in isqrt - be small instead

function                                             old     new   delta
isqrt_odd                                            111      70     -41

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agofactor: add code to test isqrt() correctness
Denys Vlasenko [Mon, 10 Apr 2017 11:53:57 +0000 (13:53 +0200)]
factor: add code to test isqrt() correctness

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agofactor: 25% faster sieving
Denys Vlasenko [Mon, 10 Apr 2017 10:10:46 +0000 (12:10 +0200)]
factor: 25% faster sieving

function                                             old     new   delta
factorize                                            287     260     -27

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agofactor: better comments, slightl more clever conversion even->odd
Denys Vlasenko [Mon, 10 Apr 2017 09:47:48 +0000 (11:47 +0200)]
factor: better comments, slightl more clever conversion even->odd

function                                             old     new   delta
isqrt_odd                                            114     111      -3

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agofactor: fix HALF_FMT usage
Denys Vlasenko [Mon, 10 Apr 2017 08:13:14 +0000 (10:13 +0200)]
factor: fix HALF_FMT usage

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agofactor: fix comments
Denys Vlasenko [Sun, 9 Apr 2017 22:41:11 +0000 (00:41 +0200)]
factor: fix comments

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agofactor: a bit more simple isqrt
Denys Vlasenko [Sun, 9 Apr 2017 22:28:26 +0000 (00:28 +0200)]
factor: a bit more simple isqrt

function                                             old     new   delta
isqrt_odd                                             87      80      -7

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agofactor: simpler isqrt
Denys Vlasenko [Sun, 9 Apr 2017 22:24:16 +0000 (00:24 +0200)]
factor: simpler isqrt

function                                             old     new   delta
isqrt_odd                                            102      87     -15

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agofactor: factor2 variable is unused now, drop it
Denys Vlasenko [Sun, 9 Apr 2017 21:19:47 +0000 (23:19 +0200)]
factor: factor2 variable is unused now, drop it

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agofactor: expand comments
Denys Vlasenko [Sun, 9 Apr 2017 21:12:38 +0000 (23:12 +0200)]
factor: expand comments

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agofactor: 30% faster code (estimate max possible factor just once)
Denys Vlasenko [Sun, 9 Apr 2017 20:54:57 +0000 (22:54 +0200)]
factor: 30% faster code (estimate max possible factor just once)

function                                             old     new   delta
factorize                                              -     161    +161
isqrt_odd                                              -     102    +102
factor_main                                          281     110    -171
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 0/1 up/down: 263/-171)           Total: 92 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agonl: fix copyright message
Denys Vlasenko [Sun, 9 Apr 2017 19:19:29 +0000 (21:19 +0200)]
nl: fix copyright message

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agofactor: new applet
Denys Vlasenko [Sun, 9 Apr 2017 19:18:43 +0000 (21:18 +0200)]
factor: new applet

thus far only able to factor up to ULLONG_MAX

function                                             old     new   delta
factor_main                                            -     378    +378
packed_usage                                       31427   31502     +75
applet_names                                        2590    2597      +7
applet_main                                         1500    1504      +4
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 3/0 up/down: 464/0)             Total: 464 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agonproc: new applet
Denys Vlasenko [Fri, 7 Apr 2017 19:47:53 +0000 (21:47 +0200)]
nproc: new applet

function                                             old     new   delta
nproc_main                                             -      98     +98
applet_names                                        2584    2590      +6
applet_main                                         1496    1500      +4
applet_install_loc                                   187     188      +1

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agoshred: smaller code
Denys Vlasenko [Fri, 7 Apr 2017 19:10:00 +0000 (21:10 +0200)]
shred: smaller code

function                                             old     new   delta
shred_main                                           361     356      -5

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agoshred: new applet
Denys Vlasenko [Fri, 7 Apr 2017 18:45:08 +0000 (20:45 +0200)]
shred: new applet

function                                             old     new   delta
shred_main                                             -     361    +361
packed_usage                                       31427   31467     +40
applet_names                                        2578    2584      +6
applet_main                                         1492    1496      +4
run_applet_and_exit                                  679     682      +3
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 4/0 up/down: 414/0)             Total: 414 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agoinit: dont send "Sent SIGTERM to all" msg to syslog: we just TERMed it!
Denys Vlasenko [Fri, 7 Apr 2017 17:13:09 +0000 (19:13 +0200)]
init: dont send "Sent SIGTERM to all" msg to syslog: we just TERMed it!

While at it, explain FEATURE_INIT_SYSLOG

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agoipaddress: tweak help text more: mention "brd +" syntax
Denys Vlasenko [Fri, 7 Apr 2017 16:22:41 +0000 (18:22 +0200)]
ipaddress: tweak help text more: mention "brd +" syntax

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agoipaddress: tweak help text
Denys Vlasenko [Fri, 7 Apr 2017 16:14:46 +0000 (18:14 +0200)]
ipaddress: tweak help text

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agoiproute: add "a" command as a synonym to "add"
Denys Vlasenko [Fri, 7 Apr 2017 15:33:26 +0000 (17:33 +0200)]
iproute: add "a" command as a synonym to "add"

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agolibiproute: FACT_FUNCization
Denys Vlasenko [Fri, 7 Apr 2017 15:15:40 +0000 (17:15 +0200)]
libiproute: FACT_FUNCization

function                                             old     new   delta
get_addr_1                                           258     287     +29
next_arg                                               -      22     +22
print_neigh                                          885     902     +17
do_iplink                                           1269    1276      +7
get_unsigned                                          54      55      +1
get_u32                                               54      55      +1
get_u16                                               62      63      +1
rt_addr_n2a                                           53      52      -1
ipaddr_modify                                       1229    1226      -3
get_addr32                                            58      54      -4
invarg_1_to_2                                         18      12      -6
inet_addr_match                                      109     103      -6
duparg2                                               18      12      -6
duparg                                                18      12      -6
print_addrinfo                                      1231    1223      -8
ipneigh_list_or_flush                                724     714     -10
incomplete_command                                    10       -     -10
iproute_get                                          847     835     -12
ipaddr_list_or_flush                                1265    1253     -12
get_prefix                                           356     344     -12
do_add_or_delete                                    1162    1150     -12
get_addr                                              73      58     -15
iproute_list_or_flush                               1210    1191     -19
parse_args                                          1434    1412     -22
print_rule                                           634     610     -24
iprule_modify                                        864     816     -48
print_route                                         1621    1565     -56
iproute_modify                                      1221    1164     -57
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 6/20 up/down: 78/-349)         Total: -271 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agoiproute: support advmss option
Denys Vlasenko [Fri, 7 Apr 2017 15:00:53 +0000 (17:00 +0200)]
iproute: support advmss option

function                                             old     new   delta
iproute_modify                                      1164    1221     +57
str_is_lock                                            -      22     +22
packed_usage                                       31372   31382     +10
do_iproute                                           157     132     -25
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 2/1 up/down: 89/-25)             Total: 64 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agoiproute: update help text, add commented-out code for unsupported options
Denys Vlasenko [Thu, 6 Apr 2017 15:54:38 +0000 (17:54 +0200)]
iproute: update help text, add commented-out code for unsupported options

function                                             old     new   delta
packed_usage                                       31327   31372     +45
do_iproute                                           132     157     +25
iproute_modify                                      1162    1164      +2
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 72/0)               Total: 72 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agoiplink: implement "set promisc on|off". Closes 4682
Denys Vlasenko [Thu, 6 Apr 2017 14:06:04 +0000 (16:06 +0200)]
iplink: implement "set promisc on|off". Closes 4682

function                                             old     new   delta
do_iplink                                           1232    1269     +37
packed_usage                                       31337   31327     -10

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agoip link: tidying up
Denys Vlasenko [Thu, 6 Apr 2017 13:55:29 +0000 (15:55 +0200)]
ip link: tidying up

Misplaced comment. --help was wrong: dynamic on|off is not supported.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agomodprobe: do not descend into /etc/modprobe.d/DIR/. Closes 8686
Denys Vlasenko [Thu, 6 Apr 2017 13:22:24 +0000 (15:22 +0200)]
modprobe: do not descend into /etc/modprobe.d/DIR/. Closes 8686

Also expanded comments in recursive_action.c

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agomodprobe-small: fix "modprobe non-existing-module" exitcode (should be 1)
Denys Vlasenko [Thu, 6 Apr 2017 11:45:00 +0000 (13:45 +0200)]
modprobe-small: fix "modprobe non-existing-module" exitcode (should be 1)

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agomodprobe: read modules.builtin
Ben Hutchings [Thu, 6 Apr 2017 09:54:04 +0000 (11:54 +0200)]
modprobe: read modules.builtin

This allows explicit probing to succeed when the requested module
is actually built-in, and corrects the error message for removal.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agoexamples: make udhcpc script handle /32 netmasks
Denys Vlasenko [Wed, 5 Apr 2017 22:53:43 +0000 (00:53 +0200)]
examples: make udhcpc script handle /32 netmasks

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agoAdd help text for 'uniq -i'
Jody Bruchon [Thu, 30 Mar 2017 16:24:56 +0000 (12:24 -0400)]
Add help text for 'uniq -i'

Signed-off-by: Jody Bruchon <jody@jodybruchon.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agonl: use CONFIG_NL, not CONFIG_UNIQ
Denys Vlasenko [Wed, 5 Apr 2017 16:31:19 +0000 (18:31 +0200)]
nl: use CONFIG_NL, not CONFIG_UNIQ

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agonl: new applet; also implement cat -nb (similar functionality to nl)
Denys Vlasenko [Wed, 5 Apr 2017 16:17:17 +0000 (18:17 +0200)]
nl: new applet; also implement cat -nb (similar functionality to nl)

function                                             old     new   delta
nl_main                                                -     201    +201
print_numbered_lines                                   -     115    +115
cat_main                                              36     149    +113
static.nl_longopts                                     -     106    +106
packed_usage                                       31081   31182    +101
applet_main                                         1488    1492      +4
applet_names                                        2575    2578      +3
applet_suid                                           93      94      +1
applet_install_loc                                   186     187      +1
------------------------------------------------------------------------------
(add/remove: 4/0 grow/shrink: 6/0 up/down: 645/0)             Total: 645 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agotls: do not compile in TLS_RSA_WITH_NULL_SHA256 code if unreachable
Denys Vlasenko [Mon, 3 Apr 2017 23:41:15 +0000 (01:41 +0200)]
tls: do not compile in TLS_RSA_WITH_NULL_SHA256 code if unreachable

function                                             old     new   delta
tls_handshake                                       1595    1588      -7
xwrite_encrypted                                     244     209     -35

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agotls: avoid using int16 in pstm code
Denys Vlasenko [Mon, 3 Apr 2017 19:53:29 +0000 (21:53 +0200)]
tls: avoid using int16 in pstm code

function                                             old     new   delta
pstm_div                                            1472    1522     +50
psRsaEncryptPub                                      403     413     +10
pstm_2expt                                            91      96      +5
pstm_clear                                            68      72      +4
pstm_init                                             39      42      +3
pstm_unsigned_bin_size                                36      37      +1
pstm_montgomery_reduce                               398     399      +1
pstm_init_size                                        45      46      +1
pstm_zero                                             39      38      -1
pstm_set                                              35      34      -1
pstm_read_unsigned_bin                               112     109      -3
pstm_mulmod                                          123     120      -3
pstm_mod                                             116     113      -3
pstm_cmp                                              57      54      -3
pstm_sub                                             107     102      -5
pstm_to_unsigned_bin                                 157     151      -6
pstm_clamp                                            63      57      -6
pstm_add                                             116     108      -8
pstm_grow                                             81      72      -9
pstm_count_bits                                       57      48      -9
pstm_init_copy                                        84      72     -12
pstm_cmp_mag                                          93      78     -15
pstm_sqr_comba                                       567     551     -16
pstm_montgomery_calc_normalization                   158     140     -18
pstm_copy                                            115      92     -23
pstm_lshd                                            133     109     -24
pstm_mul_comba                                       525     500     -25
pstm_mul_d                                           251     224     -27
s_pstm_sub                                           256     228     -28
s_pstm_add                                           370     337     -33
pstm_div_2d                                          444     409     -35
pstm_mul_2                                           195     156     -39
pstm_rshd                                            154     104     -50
pstm_mul_2d                                          247     186     -61
pstm_exptmod                                        1524    1463     -61
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 8/27 up/down: 75/-524)         Total: -449 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agotls: merge sha1 and sha256 hmac functions
Denys Vlasenko [Mon, 3 Apr 2017 15:43:44 +0000 (17:43 +0200)]
tls: merge sha1 and sha256 hmac functions

function                                             old     new   delta
hmac_begin                                             -     196    +196
hmac_sha256                                           61      68      +7
hmac                                                 250      87    -163
hmac_sha256_begin                                    190       -    -190
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 1/1 up/down: 203/-353)         Total: -150 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agotls: replace aes encryption/decryption by much smaller one
Denys Vlasenko [Sat, 1 Apr 2017 18:11:59 +0000 (20:11 +0200)]
tls: replace aes encryption/decryption by much smaller one

The replacement code is ~6 times slower,
but drastically decreases size of tls_aes.o:

text data bss dec hex filename
8050 0 0 8050 1f72 tls_aes_OLD.o
2461 0 0 2461 99d tls_aes.o

function                                             old     new   delta
sbox                                                   -     256    +256
rsbox                                                  -     256    +256
KeyExpansion                                           -     197    +197
Subword                                                -      66     +66
AddRoundKey                                            -      61     +61
static.Rcon                                            -      10     +10
rcon                                                  40       -     -40
setup_mix                                             80       -     -80
setup_mix2                                           123       -    -123
aes_cbc_decrypt                                     1377     971    -406
aes_cbc_encrypt                                     1375     644    -731
psAesInit                                            848       -    -848
Te4                                                 1024       -   -1024
TE0                                                 1024       -   -1024
TD0                                                 1024       -   -1024
Td4                                                 1040       -   -1040
------------------------------------------------------------------------------
(add/remove: 6/8 grow/shrink: 0/2 up/down: 846/-6340)       Total: -5494 bytes

This code is based on public domain "tiny-AES128-C" code.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agouniq: add -i option to ignore case
Jody Bruchon [Thu, 30 Mar 2017 16:15:54 +0000 (18:15 +0200)]
uniq: add -i option to ignore case

Signed-off-by: Jody Bruchon <jody@jodybruchon.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
7 years agoUpdate depmod & modprobe upstream help text in comments
Kang-Che Sung [Thu, 9 Feb 2017 14:48:51 +0000 (22:48 +0800)]
Update depmod & modprobe upstream help text in comments

No code changes.

Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>