oweals/busybox.git
8 years agobusybox: fix uninitialized memory when displaying IPv6 addresses
Felix Fietkau [Mon, 18 Jan 2016 11:07:35 +0000 (12:07 +0100)]
busybox: fix uninitialized memory when displaying IPv6 addresses

After commit 8e74adab0107658e3dc04ed342206272a284f43e
("libbb: make INET[6]_rresolve use sockaddr2{host,dotted}_noport")
INET_sprint6 uses more than just sin6_addr, it also tries to display the
scope id, which is uninitialized when called from ife_print6.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agodd: support iflag=skip_bytes
Rafał Miłecki [Mon, 1 Feb 2016 01:17:28 +0000 (02:17 +0100)]
dd: support iflag=skip_bytes

It allows specifying amount of bytes directly (not only amount of
blocks) is also supported by GNU's Coreutils.

function                                             old     new   delta
parse_comma_flags                                      -      93     +93
static.iflag_words                                     -      12     +12
dd_main                                             1569    1580     +11
packed_usage                                       30591   30600      +9
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 2/0 up/down: 125/0)             Total: 125 bytes

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoFix compiling with musl's utmp stubs
Kylie McClain [Mon, 1 Feb 2016 00:36:05 +0000 (01:36 +0100)]
Fix compiling with musl's utmp stubs

This patch fixes compiling busybox with FEATURE_UTMP and _WTMP enabled.
musl, while not really support utmp/wtmp, provides stub functions, as well
as variables such as _PATH_UTMP, so that programs using utmp or wtmp can
still compile fine.

My reasoning for this patch is that on Exherbo, I'm currently trying to get
us to be able to use the same busybox config file for both glibc and musl
systems, using utmp/wtmp on systems that support it, and using the stubs
on musl without needing two different configs.

As of latest musl git, it provides all utmp functions needed; 1.1.12 doesn't,
but I sent a patch to Rich to add the utmp{,x}name functions expected to
exist, which was merged into musl upstream.

Signed-off-by: Kylie McClain <somasissounds@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoprintf: short-circuit output when argument to %b includes \c
Ron Yorston [Sun, 31 Jan 2016 21:22:25 +0000 (22:22 +0100)]
printf: short-circuit output when argument to %b includes \c

printf wasn't correctly handling \c in an argument to the %b format
specifier.

   printf %bXX OK\\c

returned 'OK\cXX' rather than the expected 'OK'.

function                                             old     new   delta
printf_main                                          886     899     +13

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agosed: make 's///w FILE' actually write to FILE. Closes 8251
Denys Vlasenko [Sun, 24 Jan 2016 14:52:16 +0000 (15:52 +0100)]
sed: make 's///w FILE' actually write to FILE. Closes 8251

function                                             old     new   delta
add_cmd                                             1167    1210     +43

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agopatch: correctly handle "patch FILE_TO_PATCH" form. Closes 7736
Denys Vlasenko [Sat, 23 Jan 2016 04:13:15 +0000 (05:13 +0100)]
patch: correctly handle "patch FILE_TO_PATCH" form. Closes 7736

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agodos2unix: try to preserve ownership. closes 8311
Denys Vlasenko [Sun, 17 Jan 2016 02:50:36 +0000 (03:50 +0100)]
dos2unix: try to preserve ownership. closes 8311

function                                             old     new   delta
dos2unix_main                                        426     441     +15

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agosetsid: implement -c
Denys Vlasenko [Sun, 17 Jan 2016 00:09:36 +0000 (01:09 +0100)]
setsid: implement -c

function                                             old     new   delta
setsid_main                                           53      96     +43
packed_usage                                       30846   30833     -13

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agotruncate: use O_WRONLY|O_NONBLOCK
Mike Frysinger [Wed, 13 Jan 2016 18:30:20 +0000 (13:30 -0500)]
truncate: use O_WRONLY|O_NONBLOCK

This matches coreutils behavior.  We don't read the fd, and truncation
does not need blocking.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
8 years agotruncate: always set mode when opening file to avoid fortify errors
Ari Sundholm [Mon, 4 Jan 2016 13:40:37 +0000 (15:40 +0200)]
truncate: always set mode when opening file to avoid fortify errors

Busybox crashes due to no mode being given when opening:
$ ./busybox truncate -s 1M foo
*** invalid open64 call: O_CREAT without mode ***: ./busybox terminated
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x7338f)[0x7f66d921338f]
/lib/x86_64-linux-gnu/libc.so.6(__fortify_fail+0x5c)[0x7f66d92aac9c]
/lib/x86_64-linux-gnu/libc.so.6(+0xeb6aa)[0x7f66d928b6aa]
./busybox[0x4899f9]
======= Memory map: ========
00400000-004d0000 r-xp 00000000 00:1a 137559                             /home/ari/busybox/busybox
006cf000-006d0000 r--p 000cf000 00:1a 137559                             /home/ari/busybox/busybox
006d0000-006d1000 rw-p 000d0000 00:1a 137559                             /home/ari/busybox/busybox
006d1000-006d4000 rw-p 00000000 00:00 0
014e7000-01508000 rw-p 00000000 00:00 0                                  [heap]
7f66d8f8a000-7f66d8fa0000 r-xp 00000000 08:07 1579008                    /lib/x86_64-linux-gnu/libgcc_s.so.1
7f66d8fa0000-7f66d919f000 ---p 00016000 08:07 1579008                    /lib/x86_64-linux-gnu/libgcc_s.so.1
7f66d919f000-7f66d91a0000 rw-p 00015000 08:07 1579008                    /lib/x86_64-linux-gnu/libgcc_s.so.1
7f66d91a0000-7f66d935b000 r-xp 00000000 08:07 1578994                    /lib/x86_64-linux-gnu/libc-2.19.so
7f66d935b000-7f66d955a000 ---p 001bb000 08:07 1578994                    /lib/x86_64-linux-gnu/libc-2.19.so
7f66d955a000-7f66d955e000 r--p 001ba000 08:07 1578994                    /lib/x86_64-linux-gnu/libc-2.19.so
7f66d955e000-7f66d9560000 rw-p 001be000 08:07 1578994                    /lib/x86_64-linux-gnu/libc-2.19.so
7f66d9560000-7f66d9565000 rw-p 00000000 00:00 0
7f66d9565000-7f66d966a000 r-xp 00000000 08:07 1579020                    /lib/x86_64-linux-gnu/libm-2.19.so
7f66d966a000-7f66d9869000 ---p 00105000 08:07 1579020                    /lib/x86_64-linux-gnu/libm-2.19.so
7f66d9869000-7f66d986a000 r--p 00104000 08:07 1579020                    /lib/x86_64-linux-gnu/libm-2.19.so
7f66d986a000-7f66d986b000 rw-p 00105000 08:07 1579020                    /lib/x86_64-linux-gnu/libm-2.19.so
7f66d986b000-7f66d988e000 r-xp 00000000 08:07 1578981                    /lib/x86_64-linux-gnu/ld-2.19.so
7f66d9a64000-7f66d9a67000 rw-p 00000000 00:00 0
7f66d9a8a000-7f66d9a8d000 rw-p 00000000 00:00 0
7f66d9a8d000-7f66d9a8e000 r--p 00022000 08:07 1578981                    /lib/x86_64-linux-gnu/ld-2.19.so
7f66d9a8e000-7f66d9a8f000 rw-p 00023000 08:07 1578981                    /lib/x86_64-linux-gnu/ld-2.19.so
7f66d9a8f000-7f66d9a90000 rw-p 00000000 00:00 0
7ffc47761000-7ffc47782000 rw-p 00000000 00:00 0                          [stack]
7ffc477ab000-7ffc477ad000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
Aborted (core dumped)
$

Fix this by simply always setting the mode, as it doesn't hurt even
when O_CREAT is not specified.

This bug is a regression introduced in fc3e40e, as xopen(), which
was originally used, would automatically set the mode.

Signed-off-by: Ari Sundholm <ari@tuxera.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
8 years agologin: add commented-out PAM double password avoidance from BZ 4003
Denys Vlasenko [Sun, 3 Jan 2016 21:43:40 +0000 (22:43 +0100)]
login: add commented-out PAM double password avoidance from BZ 4003

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agonandwrite: implement -n (read/write without ecc)
Aaro Koskinen [Sat, 19 Dec 2015 20:34:44 +0000 (22:34 +0200)]
nandwrite: implement -n (read/write without ecc)

Implement -n (read/write without ecc).

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoblkdiscard: new applet
Ari Sundholm [Sat, 2 Jan 2016 00:18:32 +0000 (01:18 +0100)]
blkdiscard: new applet

function                                             old     new   delta
blkdiscard_main                                        -     264    +264

Signed-off-by: Ari Sundholm <ari@tuxera.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoash: suppress a compilation warning
Cristian Ionescu-Idbohrn [Fri, 1 Jan 2016 23:52:29 +0000 (00:52 +0100)]
ash: suppress a compilation warning

Reported by gcc (Debian 5.3.1-4) 5.3.1 20151219

shell/ash.c: In function 'evaltree':
shell/ash.c:8432:19: warning: logical not is only applied to the left hand side of comparison

Signed-off-by: Cristian Ionescu-Idbohrn <cristian.ionescu-idbohrn@axis.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agomount: support "nofail" option. Closes 8551
Denys Vlasenko [Wed, 30 Dec 2015 19:11:34 +0000 (20:11 +0100)]
mount: support "nofail" option. Closes 8551

function                                             old     new   delta
singlemount                                         1045    1060     +15
mount_option_str                                     338     345      +7
mount_it_now                                         355     361      +6
mount_options                                        172     176      +4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/0 up/down: 32/0)               Total: 32 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoiproute: support "scope". Closes 8561
Denys Vlasenko [Wed, 30 Dec 2015 16:32:51 +0000 (17:32 +0100)]
iproute: support "scope". Closes 8561

function                                             old     new   delta
iproute_modify                                      1051    1120     +69

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoswaponoff: fix compile-time warning
Denys Vlasenko [Fri, 18 Dec 2015 18:02:31 +0000 (19:02 +0100)]
swaponoff: fix compile-time warning

  CC      util-linux/swaponoff.o
cc1: warnings being treated as errors
util-linux/swaponoff.c: In function 'swap_enable_disable':
util-linux/swaponoff.c:100: warning: passing argument 1 of 'resolve_mount_spec' from incompatible pointer type
make[1]: *** [util-linux/swaponoff.o] Error 1

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agochpasswd: support -c argument and respect DEFAULT_PASSWD_ALGO
Pascal Bach [Fri, 18 Dec 2015 18:01:14 +0000 (19:01 +0100)]
chpasswd: support -c argument and respect DEFAULT_PASSWD_ALGO

Signed-off-by: Pascal Bach <pascal.bach@siemens.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoinclude/platform.h: Remove extra #endif introduced in 6df9612.
Ari Sundholm [Thu, 17 Dec 2015 18:43:12 +0000 (20:43 +0200)]
include/platform.h: Remove extra #endif introduced in 6df9612.

It causes the compilation to fail.

Signed-off-by: Ari Sundholm <ari@tuxera.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
8 years agoResolve linker issues with Android API 21 (dprintf, tcdrain)
Chris Renshaw [Thu, 17 Dec 2015 15:42:01 +0000 (16:42 +0100)]
Resolve linker issues with Android API 21 (dprintf, tcdrain)

Signed-off-by: Chris Renshaw <osm0sis@outlook.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoblkid: add bcache support
Mike Frysinger [Wed, 16 Dec 2015 19:42:25 +0000 (14:42 -0500)]
blkid: add bcache support

URL: https://bugs.gentoo.org/508596
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
8 years agoswapon/swapoff: refine the -e (ifexists) option
Mike Frysinger [Wed, 16 Dec 2015 17:59:08 +0000 (12:59 -0500)]
swapon/swapoff: refine the -e (ifexists) option

The -e option should only apply to swapon, and it should swallow all
errors/warnings when the device does not exist.  So delete the flag
from the swapoff patch and unify the check in the swapoff path.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
8 years agotrylink: include LDFLAGS when checking linkage
Mike Frysinger [Tue, 1 Dec 2015 16:25:10 +0000 (11:25 -0500)]
trylink: include LDFLAGS when checking linkage

The user might be including options in their LDFLAGS (like -fuse-ld=gold)
that change the behavior of the linker and thus change the results of the
flag tests.  Make sure we include the user's LDFLAGS when running these
tests so we filter out flags that will fail when used later on.

URL: https://bugs.gentoo.org/499712
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
8 years agomodutils: fix build error with !DEPMOD
Denys Vlasenko [Fri, 6 Nov 2015 14:50:28 +0000 (15:50 +0100)]
modutils: fix build error with !DEPMOD

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agomodutils: merge module_entry and module_info to common
Timo Teräs [Thu, 5 Nov 2015 17:54:55 +0000 (18:54 +0100)]
modutils: merge module_entry and module_info to common

This merges the in-memory module info structures of modprobe
and depmod. This allows sharing hashing by modulename code
improving depmod runtime with almost factor of 2x.

function                                             old     new   delta
get_or_add_modentry                                    -      17     +17
do_modprobe                                          590     601     +11
moddb_get_or_create                                    -      10     +10
load_modules_dep                                     195     205     +10
moddb_get                                              -       7      +7
add_probe                                             81      78      -3
modprobe_main                                        721     714      -7
depmod_main                                          553     543     -10
config_file_action                                   434     421     -13
helper_get_module                                    160     144     -16
parse_module                                         343     320     -23
order_dep_list                                       105      82     -23
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 2/7 up/down: 55/-95)            Total: -40 bytes

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoTODO file: remove mpstat, iostat, powertop - we have them now
Denys Vlasenko [Wed, 4 Nov 2015 18:39:54 +0000 (19:39 +0100)]
TODO file: remove mpstat, iostat, powertop - we have them now

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoash: add support for bash 'function' keyword
Ron Yorston [Tue, 3 Nov 2015 09:42:23 +0000 (09:42 +0000)]
ash: add support for bash 'function' keyword

Where the POSIX shell allows functions to be defined as:

   name () compound-command [ redirections ]

bash adds the alternative syntax:

   function name [()] compound-command [ redirections ]

Implement this in ash's bash compatibility mode.  Most compound
commands work (for/while/until/if/case/[[]]/{}); one exception is:

   function f (echo "no way!")

The other two variants work:

   f() (echo "ok")
   function f() (echo "also ok")

function                                             old     new   delta
parse_command                                       1555    1744    +189
tokname_array                                        232     240      +8
.rodata                                           155612  155566     -46
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 197/-46)           Total: 151 bytes

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agohush-misc/func_args1.tests: remove "UNFIXED BUG", it does not fail
Denys Vlasenko [Wed, 4 Nov 2015 13:50:19 +0000 (14:50 +0100)]
hush-misc/func_args1.tests: remove "UNFIXED BUG", it does not fail

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoash: copy function tests from hush testsuite
Ron Yorston [Tue, 3 Nov 2015 09:37:40 +0000 (09:37 +0000)]
ash: copy function tests from hush testsuite

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoi2c_tools: suppress "'blen' may be used uninitialized in this function"
Denys Vlasenko [Sun, 1 Nov 2015 19:57:34 +0000 (20:57 +0100)]
i2c_tools: suppress "'blen' may be used uninitialized in this function"

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoi2cdump: display the numeric value for block read ioctl() errors
Bartosz Golaszewski [Tue, 27 Oct 2015 16:15:05 +0000 (17:15 +0100)]
i2cdump: display the numeric value for block read ioctl() errors

This makes busybox i2cdump compatible with the upstream version, which
also displays the numeric error value in case of a block read failure.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoi2cdump: bail-out if block read fails
Bartosz Golaszewski [Tue, 27 Oct 2015 16:15:04 +0000 (17:15 +0100)]
i2cdump: bail-out if block read fails

We should bail-out if i2c_smbus_read_block_data() or
i2c_smbus_read_i2c_block_data() return 0 or less. Add the missing check
for the former and fix the existing for the latter.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoi2cdump: use I2C block mode for the 'i' mode parameter
Bartosz Golaszewski [Tue, 27 Oct 2015 16:15:03 +0000 (17:15 +0100)]
i2cdump: use I2C block mode for the 'i' mode parameter

Currently we're calling i2c_smbus_read_block_data() for both 'i' and 's'
mode parameters. If the bus doesn't support SMBus block mode, then the
i2c access ioctl() fails. Make i2cdump behave compatibly with upstream
version by calling i2c_smbus_read_i2c_block_data() for I2C block.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoi2cdump: don't read block data in non-block modes
Bartosz Golaszewski [Tue, 27 Oct 2015 16:15:02 +0000 (17:15 +0100)]
i2cdump: don't read block data in non-block modes

We currently read data twice in byte mode. Add a check to avoid calling
i2c_smbus_read_i2c_block_data() if we're not in I2C or SMBus block mode.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoi2cdetect: coding style: add a space after 'for'
Bartosz Golaszewski [Tue, 27 Oct 2015 16:15:01 +0000 (17:15 +0100)]
i2cdetect: coding style: add a space after 'for'

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoi2cdetect: fix address skipping in auto mode
Bartosz Golaszewski [Tue, 27 Oct 2015 16:15:00 +0000 (17:15 +0100)]
i2cdetect: fix address skipping in auto mode

If the bus doesn't support SMBus Quick Write or Receive Byte commands
and we're running in auto mode all addresses will be skipped resulting
in an empty table being printed.

This is caused by not restoring the auto mode after it's been changed
for certain address ranges - we need an additional variable to hold the
temporary state.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoifupdown: use -x hostname:NAME with udhcpc
Natanael Copa [Wed, 19 Sep 2012 14:55:08 +0000 (16:55 +0200)]
ifupdown: use -x hostname:NAME with udhcpc

The -H NAME is deprecated in udhcpc. See commit
2017d48c0d70bef8768efb42909e605ea8eb5a21

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years ago[g]unzip: fix recent breakage.
Denys Vlasenko [Fri, 30 Oct 2015 22:41:53 +0000 (23:41 +0100)]
[g]unzip: fix recent breakage.

Also, do emit error message we so painstakingly pass from gzip internals

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoash: allow popredir to be called if the stack is empty
Ron Yorston [Fri, 30 Oct 2015 19:07:37 +0000 (19:07 +0000)]
ash: allow popredir to be called if the stack is empty

If /tmp/test.sh is a script that tries to run a second script which
happens to be non-executable this:

   command . /tmp/test.sh

causes a seg fault.

This is because clearredir is called in the error path to clear the
stack of redirections.  The normal path then calls popredir, but popredir
fails when the stack is empty.

Reported-by: Bastian Bittorf <bittorf@bluebottle.com>
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoash: fix EXEXEC status clobbering
Ron Yorston [Fri, 30 Oct 2015 19:06:47 +0000 (19:06 +0000)]
ash: fix EXEXEC status clobbering

evalcommand always clobbers the exit status in case of an EXEXEC
which means that exec always fails with exit status 2 regardless
of what it actually returns.

This patch adds the missing check for EXEXEC so that the correct
exit status is preserved.  It causes the test ash-misc/exec.tests
to succeed.

Based on commit 7f68426 in dash git, by Herbert Xu.

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoash: add tests for failures of the exec and command builtins
Ron Yorston [Fri, 30 Oct 2015 19:05:55 +0000 (19:05 +0000)]
ash: add tests for failures of the exec and command builtins

The exec builtin should return an exit status of 127 if the command
can't be found.  It doesn't:  it returns 2.

If the command builtin is used to source a script that runs a second
script that doesn't exist ash should issue an error.  Instead it seg
faults.

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agostat: make -f optional. This allows to build stat for non-linux systems
Denys Vlasenko [Fri, 30 Oct 2015 21:10:44 +0000 (22:10 +0100)]
stat: make -f optional. This allows to build stat for non-linux systems

function                                             old     new   delta
packed_usage                                       30761   30706     -55

Based on the patch by Ron Yorston.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agolineedit: FEATURE_REVERSE_SEARCH should not depend on SAVEHISTORY
Denys Vlasenko [Fri, 30 Oct 2015 20:39:19 +0000 (21:39 +0100)]
lineedit: FEATURE_REVERSE_SEARCH should not depend on SAVEHISTORY

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agolineedit: search applets as well as PATH for tab completion
Ron Yorston [Fri, 29 May 2015 10:31:40 +0000 (11:31 +0100)]
lineedit: search applets as well as PATH for tab completion

In standalone shell mode search the applet table as well as PATH
when tab completing a command.

Use a stupid linear search:  we're also about to read all the
directories on PATH so efficiency isn't a big concern.

function                                             old     new   delta
add_match                                              -      53     +53
complete_cmd_dir_file                                687     724     +37
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/0 up/down: 90/0)               Total: 90 bytes

Signed-off-by: Ron Yorston <rmy@frippery.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agobusybox: alter help message in standalone shell mode
Ron Yorston [Sat, 30 May 2015 16:13:52 +0000 (17:13 +0100)]
busybox: alter help message in standalone shell mode

Signed-off-by: Ron Yorston <rmy@frippery.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agohush: copy for.tests from ash testsuite
Denys Vlasenko [Thu, 29 Oct 2015 21:37:25 +0000 (22:37 +0100)]
hush: copy for.tests from ash testsuite

This test passes for hush

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoash: simplify EOF/newline handling in list parser
Ron Yorston [Thu, 29 Oct 2015 11:30:55 +0000 (11:30 +0000)]
ash: simplify EOF/newline handling in list parser

Processing of here documents in ash has had a couple of breakages
which are now the subject of tests.  This commit should fix both.

It is based on the following commit in dash git by Herbert Xu:

   <7c245aa> [PARSER] Simplify EOF/newline handling in list parser

(See git://git.kernel.org/pub/scm/utils/dash/dash.git)

Reported-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoRevert "ash: fix a SEGV case in an invalid heredoc" xxx
Ron Yorston [Thu, 29 Oct 2015 11:30:22 +0000 (11:30 +0000)]
Revert "ash: fix a SEGV case in an invalid heredoc" xxx

This reverts commit 7e66102f762a7d80715f0c7e5925433256b78cee but
leaves the test in place as it's still valid.

Reported-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoash: fix error during recursive processing of here document
Ron Yorston [Thu, 29 Oct 2015 16:44:56 +0000 (16:44 +0000)]
ash: fix error during recursive processing of here document

Save the value of the checkkwd flag to prevent it being clobbered
during recursion.

Based on commit ec2c84d from git://git.kernel.org/pub/scm/utils/dash/dash.git
by Herbert Xu.

function                                             old     new   delta
readtoken                                            190     203     +13
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/0 up/down: 13/0)               Total: 13 bytes

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoash tests: make test print test name before it is run
Denys Vlasenko [Thu, 29 Oct 2015 19:29:05 +0000 (20:29 +0100)]
ash tests: make test print test name before it is run

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoash: only allow local variables in functions
Ron Yorston [Thu, 29 Oct 2015 16:19:14 +0000 (16:19 +0000)]
ash: only allow local variables in functions

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoash: respect -p flag when command builtin is run with -v/-V
Ron Yorston [Mon, 3 Aug 2015 12:47:33 +0000 (13:47 +0100)]
ash: respect -p flag when command builtin is run with -v/-V

The command builtin should only check the default path, not $PATH,
when the -p flag is used along with -v/-V.

Based on commits 65ae84b (by Harald van Dijk) and 29ee27d (by Herbert
Xu) from git://git.kernel.org/pub/scm/utils/dash/dash.git).

function                                             old     new   delta
commandcmd                                            72      87     +15
describe_command                                     437     450     +13
typecmd                                               84      86      +2
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 30/0)               Total: 30 bytes

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoash: fix command -- crash
Denys Vlasenko [Thu, 29 Oct 2015 18:46:40 +0000 (19:46 +0100)]
ash: fix command -- crash

busybox sh -c 'command --' segfaults because parse_command_args
returns a pointer to a null pointer.

Based on commit 18071c7 from git://git.kernel.org/pub/scm/utils/dash/dash.git
by Gerrit Pape.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoash: save a few bytes in code to parse case statements
Ron Yorston [Mon, 3 Aug 2015 12:46:25 +0000 (13:46 +0100)]
ash: save a few bytes in code to parse case statements

Based on commit 49b82fc from git://git.kernel.org/pub/scm/utils/dash/dash.git
by Herbert Xu.

function                                             old     new   delta
parse_command                                       1563    1555      -8
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-8)               Total: -8 bytes

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoash: allow newline after variable name in for loop
Ron Yorston [Mon, 3 Aug 2015 12:46:00 +0000 (13:46 +0100)]
ash: allow newline after variable name in for loop

Newline is a valid delimiter between the variable name and `in`
keyword in for loops.

Based on commit 22e8fb4 from git://git.kernel.org/pub/scm/utils/dash/dash.git
by Herbert Xu.

function                                             old     new   delta
parse_command                                       1568    1563      -5
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-5)               Total: -5 bytes

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoash: add test for issue with here document
Ron Yorston [Thu, 29 Oct 2015 11:29:59 +0000 (11:29 +0000)]
ash: add test for issue with here document

This used to work but doesn't now:

foo () {
cat <<EOF && { echo "$1" ; }
$1
EOF
}

foo "bar"

Reported-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agomodinfo: fix "-F firmware", add "intree" field display
Denys Vlasenko [Wed, 28 Oct 2015 17:07:46 +0000 (18:07 +0100)]
modinfo: fix "-F firmware", add "intree" field display

function                                             old     new   delta
shortcuts                                              -      52     +52
modinfo                                              317     330     +13
display                                               77      87     +10
packed_usage                                       30752   30761      +9
modinfo_main                                         351     345      -6
static.shortcuts                                      48       -     -48
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 3/1 up/down: 84/-54)             Total: 30 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agolzop: eliminate variable, use "int" as return type
Denys Vlasenko [Wed, 28 Oct 2015 14:33:19 +0000 (15:33 +0100)]
lzop: eliminate variable, use "int" as return type

Based on patch by Maxin B. John <maxin.john@intel.com>

function                                             old     new   delta
pack_lzop                                            870     859     -11

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agofbsplash: use virtual y size in mmap size calculations
Timo Teräs [Mon, 26 Oct 2015 07:40:31 +0000 (09:40 +0200)]
fbsplash: use virtual y size in mmap size calculations

The virtual y can be larger - and we can be even writing there since
we are taking into account the y offset. Avoids possible crash.
But use it only if set, seems it is not set if virtual area is not
allocated (though, often fbcon allocates some scrollback area).

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agogzip: add support for --no-name long option
Aaro Koskinen [Mon, 26 Oct 2015 21:42:33 +0000 (23:42 +0200)]
gzip: add support for --no-name long option

Add support for --no-name long option. Just silently ignore it
like the short -n option.

This allows to use busybox gzip with Lynx browser.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agogunzip: add support for long options
Aaro Koskinen [Mon, 26 Oct 2015 21:42:32 +0000 (23:42 +0200)]
gunzip: add support for long options

Add support for long options.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agounzip: test for bad archive SEGVing
Denys Vlasenko [Mon, 26 Oct 2015 18:33:05 +0000 (19:33 +0100)]
unzip: test for bad archive SEGVing

function                                             old     new   delta
huft_build                                          1296    1300      +4

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agotr: support octal ranges
Richard Genoud [Mon, 26 Oct 2015 09:10:28 +0000 (10:10 +0100)]
tr: support octal ranges

now, we can do printf "a\tb\tcdef\n" | ./busybox tr -d "\1-\14b-e"
af

and bonus, we save some bytes.

function                                             old     new   delta
expand                                               718     699     -19
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-19)             Total: -19
bytes

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoifupdown: pass interface device name for ipv6 route commands
Timo Teräs [Mon, 26 Oct 2015 16:06:12 +0000 (17:06 +0100)]
ifupdown: pass interface device name for ipv6 route commands

IPv6 routes need the device argument for link-local routes, or they
cannot be used at all. E.g. "gateway fe80::def" seems to be used in
some places, but kernel refuses to insert the route unless device
name is explicitly specified in the route addition.

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agotweak defconfig
Denys Vlasenko [Sun, 25 Oct 2015 19:36:03 +0000 (20:36 +0100)]
tweak defconfig

MONOTONIC_SYSCALL=y by default

FEATURE_LAST_SMALL is gone: now FEATURE_LAST_FANCY is a "bool", not a "choice".

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoinetd: make FEATURE_INETD_RPC off by default
Denys Vlasenko [Sun, 25 Oct 2015 19:10:46 +0000 (20:10 +0100)]
inetd: make FEATURE_INETD_RPC off by default

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agolibiproute: use if_nametoindex
Ron Yorston [Wed, 21 Oct 2015 15:57:25 +0000 (16:57 +0100)]
libiproute: use if_nametoindex

Saves 87 bytes.  Assuming, of course, all platforms have it.

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoxargs: make -I imply -r
Aaro Koskinen [Sat, 24 Oct 2015 20:01:29 +0000 (22:01 +0200)]
xargs: make -I imply -r

Make -I imply -r (GNU findutils seems to do the same).

Fixes the following bug:

        $ echo -n | xargs -I% echo %
        Segmentation fault

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agodumpleases: string reuse
Denys Vlasenko [Sat, 24 Oct 2015 18:45:10 +0000 (20:45 +0200)]
dumpleases: string reuse

   text    data     bss     dec     hex filename
 926254     906   17160  944320   e68c0 busybox_old
 926242     906   17160  944308   e68b4 busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agodumpleases: new option -d to show time in seconds
Isaac Dunham [Sat, 24 Oct 2015 18:28:04 +0000 (20:28 +0200)]
dumpleases: new option -d to show time in seconds

function                                             old     new   delta
dumpleases_main                                      493     534     +41
static.dumpleases_longopts                            31      41     +10
packed_usage                                       30777   30752     -25
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 51/-25)             Total: 26 bytes

Signed-off-by: Isaac Dunham <ibid.ag@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agozcip: ...ad suppress the warning
Denys Vlasenko [Sat, 24 Oct 2015 17:15:44 +0000 (19:15 +0200)]
zcip: ...ad suppress the warning

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agozcip: do not query current time if we won't use the result
Denys Vlasenko [Sat, 24 Oct 2015 17:14:04 +0000 (19:14 +0200)]
zcip: do not query current time if we won't use the result

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agotweak zcip service example
Denys Vlasenko [Sat, 24 Oct 2015 16:57:32 +0000 (18:57 +0200)]
tweak zcip service example

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoTweak README
Denys Vlasenko [Sat, 24 Oct 2015 12:58:58 +0000 (14:58 +0200)]
Tweak README

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoupdate network service examples
Denys Vlasenko [Sat, 24 Oct 2015 12:55:33 +0000 (14:55 +0200)]
update network service examples

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoNew example of a service: examples/var_service/zcip_if
Denys Vlasenko [Sat, 24 Oct 2015 03:30:58 +0000 (05:30 +0200)]
New example of a service: examples/var_service/zcip_if

Zeroconf for IPv4

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agodumpleases: make host names sanitized to shell-friendly condition
Denys Vlasenko [Sat, 24 Oct 2015 02:45:22 +0000 (04:45 +0200)]
dumpleases: make host names sanitized to shell-friendly condition

function                                             old     new   delta
add_lease                                            271     298     +27

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoreuse a string
Denys Vlasenko [Sat, 24 Oct 2015 02:19:56 +0000 (04:19 +0200)]
reuse a string

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agormmod: fix bad error message
Denys Vlasenko [Sat, 24 Oct 2015 02:17:04 +0000 (04:17 +0200)]
rmmod: fix bad error message

    Before:

    ># busybox_old rmmod gtrhfhdfghdf
    rmmod: can't unload 'gtrhfhdfghdf': unknown symbol in module, or unknown parameter

    After:

    ># busybox rmmod gtrhfhdfghdf
    rmmod: can't unload module 'gtrhfhdfghdf': No such file or directory

function                                             old     new   delta
modprobe_main                                        726     721      -5
do_modprobe                                          599     590      -9
rmmod_main                                           187     169     -18
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-32)             Total: -32 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoMODPROBE_SMALL is not experimental anymore
Denys Vlasenko [Sat, 24 Oct 2015 02:13:16 +0000 (04:13 +0200)]
MODPROBE_SMALL is not experimental anymore

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agopmap: fix bogus {no such process} comm field text
Denys Vlasenko [Sat, 24 Oct 2015 01:45:57 +0000 (03:45 +0200)]
pmap: fix bogus {no such process} comm field text

function                                             old     new   delta
read_cmdline                                         246     266     +20
procps_get_maps                                      196     193      -3
packed_usage                                       30413   30404      -9
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/2 up/down: 20/-12)              Total: 8 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agotidy up strtok use
Denys Vlasenko [Fri, 23 Oct 2015 16:43:16 +0000 (18:43 +0200)]
tidy up strtok use

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agohttpd: fix heap buffer overflow. Closes 8426
Denys Vlasenko [Fri, 23 Oct 2015 09:49:04 +0000 (11:49 +0200)]
httpd: fix heap buffer overflow. Closes 8426

function                                             old     new   delta
send_headers                                         654     677     +23

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agowget: if stderr is not a tty, progress bar shouldn't use tty-tricks
Denys Vlasenko [Fri, 23 Oct 2015 00:01:38 +0000 (02:01 +0200)]
wget: if stderr is not a tty, progress bar shouldn't use tty-tricks

function                                             old     new   delta
bb_progress_update                                   706     768     +62

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agolibbb: factor out code which queries screen width
Denys Vlasenko [Thu, 22 Oct 2015 23:44:22 +0000 (01:44 +0200)]
libbb: factor out code which queries screen width

function                                             old     new   delta
get_terminal_width                                     -      17     +17
stty_main                                           1196    1197      +1
pstree_main                                          321     319      -2
ls_main                                              735     731      -4
watch_main                                           232     225      -7
bb_progress_update                                   714     706      -8
ps_main                                              555     543     -12
run_applet_and_exit                                  708     695     -13
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/6 up/down: 18/-46)            Total: -28 byte

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agotar: add a test that we don't write into symlinks
Denys Vlasenko [Thu, 22 Oct 2015 14:37:01 +0000 (16:37 +0200)]
tar: add a test that we don't write into symlinks

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoremove systemd support
Denys Vlasenko [Thu, 22 Oct 2015 14:01:57 +0000 (16:01 +0200)]
remove systemd support

systemd people are not willing to play nice with the rest of the world.
Therefore there is no reason for the rest of the world to cooperate with them.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agotar: fix files skipped with --strip_components not resetting selinux context
Denys Vlasenko [Thu, 22 Oct 2015 11:38:09 +0000 (13:38 +0200)]
tar: fix files skipped with --strip_components not resetting selinux context

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agotar: shrink hardlink name handling code
Denys Vlasenko [Thu, 22 Oct 2015 11:30:34 +0000 (13:30 +0200)]
tar: shrink hardlink name handling code

function                                             old     new   delta
data_extract_all                                    1069    1040     -29

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agotar: implement --version for buildroot
Denys Vlasenko [Thu, 22 Oct 2015 11:22:26 +0000 (13:22 +0200)]
tar: implement --version for buildroot

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agotar: add support for --strip-components=N
Denys Vlasenko [Wed, 21 Oct 2015 23:07:13 +0000 (01:07 +0200)]
tar: add support for --strip-components=N

function                                             old     new   delta
data_extract_all                                     882     995    +113
tar_longopts                                         290     309     +19
tar_main                                             938     942      +4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 136/0)             Total: 136 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agologin: explain -h HOST option better
Denys Vlasenko [Wed, 21 Oct 2015 14:06:40 +0000 (16:06 +0200)]
login: explain -h HOST option better

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agowget: make Bartosz's "wget --passive-ftp -nd -t 3" work
Denys Vlasenko [Tue, 20 Oct 2015 19:51:52 +0000 (21:51 +0200)]
wget: make Bartosz's "wget --passive-ftp -nd -t 3" work

function                                             old     new   delta
static.wget_longopts                                 166     234     +68
wget_main                                           2608    2610      +2

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agotypo fix
Denys Vlasenko [Tue, 20 Oct 2015 16:15:01 +0000 (18:15 +0200)]
typo fix

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoscripts/trylink: remove $CPPFLAGS
Denys Vlasenko [Tue, 20 Oct 2015 14:40:43 +0000 (16:40 +0200)]
scripts/trylink: remove $CPPFLAGS

We don't use it in final link, should not use it in check_FOO then.
This uncovered a logic bug in glibc check...

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoscripts/trylink: fix bit-rotted linker option verification
Denys Vlasenko [Tue, 20 Oct 2015 14:16:16 +0000 (16:16 +0200)]
scripts/trylink: fix bit-rotted linker option verification

To that end, *make it complain* when check_cc fails on options
we usually want to succeed.

   text    data     bss     dec     hex filename
 929697     932   17692  948321   e7861 busybox-1.23.2/busybox
 915361     911   17484  933756   e3f7c busybox-1.23.2.fixed/busybox

 927725     932   17448  946105   e6fb9 busybox-1.24.0/busybox
 913630     911   17240  931781   e37c5 busybox-1.24.0.fixed/busybox

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoqemu_multiarch_testing/README: add a list of qemu's needed
Denys Vlasenko [Tue, 20 Oct 2015 10:58:37 +0000 (12:58 +0200)]
qemu_multiarch_testing/README: add a list of qemu's needed

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agosetarch: add support for '-R' (disable randomization)
Denys Vlasenko [Mon, 19 Oct 2015 21:26:50 +0000 (23:26 +0200)]
setarch: add support for '-R' (disable randomization)

This commit adds support for the -R flag of setarch, which disables
randomization of the virtual address space.

function                                             old     new   delta
setarch_main                                         115     150     +35
packed_usage                                       30664   30651     -13

Signed-off-by: Jan Heylen <heyleke@gmail.com>
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agosort: fix ENDCHAR handling in "-kSTART,N.ENDCHAR"
Denys Vlasenko [Mon, 19 Oct 2015 17:27:26 +0000 (19:27 +0200)]
sort: fix ENDCHAR handling in "-kSTART,N.ENDCHAR"

function                                             old     new   delta
get_key                                              505     503      -2

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agosort: code shrink
Denys Vlasenko [Mon, 19 Oct 2015 17:13:06 +0000 (19:13 +0200)]
sort: code shrink

function                                             old     new   delta
compare_keys                                         738     695     -43

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