oweals/busybox.git
9 years agoaddgroup: mention -S in the help text
Denys Vlasenko [Fri, 15 Aug 2014 12:29:43 +0000 (14:29 +0200)]
addgroup: mention -S in the help text

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoash: make ${#var} unicode-aware
Denys Vlasenko [Wed, 13 Aug 2014 16:00:08 +0000 (18:00 +0200)]
ash: make ${#var} unicode-aware

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoash,hush: run reinit_unicode() only if makes sense
Denys Vlasenko [Wed, 13 Aug 2014 08:09:49 +0000 (10:09 +0200)]
ash,hush: run reinit_unicode() only if makes sense

With static Unicode support, no need to check $LANG et al.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agohush: make ${#var} unicode-aware
Denys Vlasenko [Wed, 13 Aug 2014 07:57:44 +0000 (09:57 +0200)]
hush: make ${#var} unicode-aware

This mimics bash

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoinit: if libc-based Unicode support is on, run setlocale(LC_ALL, "") at startup
Denys Vlasenko [Mon, 11 Aug 2014 18:33:18 +0000 (20:33 +0200)]
init: if libc-based Unicode support is on, run setlocale(LC_ALL, "") at startup

It is not clear why we were excluding init from this.
The "getpid() != 1" clause was there from the beginning (2001)
but not explained.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoftpd: add optional support for authentication
Morten Kvistgaard [Tue, 5 Aug 2014 19:57:18 +0000 (21:57 +0200)]
ftpd: add optional support for authentication

function                                             old     new   delta
cmdio_get_cmd_and_arg                                  -     237    +237
get_passwd                                             -      97     +97
check_password                                         -      82     +82
ftpd_main                                           2297    2178    -119
ask_and_check_password_extended                      206      84    -122
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 0/2 up/down: 416/-241)          Total: 175 bytes

Signed-off-by: Morten Kvistgaard <MK@pch-engineering.dk>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agosha3: tweak comments and indentation
Denys Vlasenko [Wed, 30 Jul 2014 14:26:09 +0000 (16:26 +0200)]
sha3: tweak comments and indentation

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agosha3: code shrink (and speedup for SHA3_SMALL=0)
Denys Vlasenko [Wed, 30 Jul 2014 12:18:57 +0000 (14:18 +0200)]
sha3: code shrink (and speedup for SHA3_SMALL=0)

function                                             old     new   delta
sha3_process_block72                                1454    1359     -95

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agotop: fix memset length (sizeof(ptr) vs sizeof(array) problem)
Denys Vlasenko [Tue, 29 Jul 2014 15:00:30 +0000 (17:00 +0200)]
top: fix memset length (sizeof(ptr) vs sizeof(array) problem)

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agotop: fix and merge code to parse /proc/meminfo
Timo Teräs [Mon, 21 Jul 2014 11:14:24 +0000 (14:14 +0300)]
top: fix and merge code to parse /proc/meminfo

display_header() code to parse meminfo as is was buggy:
- uninitialized variables were used if meminfo was not as expected
- meminfo parsing failed on new kernels (3.14+) as new field 'MemAvailable'
  was introduced between MemFree and Buffers
- shared memory was handled only for ancient kernels (2.4.x and earlier)

as result Buffers and shared memory fields were shown with bogus values
on current kernels.

The new code does not try to parse the old style summary header, as the
separated fields are always present (it saves code size). Additionally,
both Shmem (2.6+) and MemShared (2.4 and earlier) fields are now parsed
and summed for shared memory usage; as only one of them exists depending
on kernel version.

display_topmem_header() parses also meminfo so this makes it use the
same code for code shrink.

function                                             old     new   delta
display_header                                         -     681    +681
display_topmem_process_list                          465     684    +219
parse_meminfo                                          -     189    +189
static.fields                                          -     106    +106
static.match                                         132       -    -132
.rodata                                           120254  120117    -137
display_topmem_header                                513       -    -513
display_process_list                                1705     667   -1038
------------------------------------------------------------------------------
(add/remove: 3/2 grow/shrink: 1/2 up/down: 1195/-1820)       Total: -625 bytes

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agosha3: add 32-bit optimized bit-sliced implementation
Denys Vlasenko [Fri, 25 Jul 2014 15:24:13 +0000 (17:24 +0200)]
sha3: add 32-bit optimized bit-sliced implementation

It is an interesting trick, but so far I only managed to make it work
correctly, not to make it faster and/or smaller.
The code is ifdefed out for now.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agozcip: fix link-local IP conflict detection
Ken Sharp [Sun, 20 Jul 2014 12:01:49 +0000 (14:01 +0200)]
zcip: fix link-local IP conflict detection

During link-local IP resolution, if a regular ARP request is received
during the ARP probe period, it will incorrectly cause a target IP
conflict.  This then leads to a new IP being picked unnecessarily.

Per RFC 3927, section 2.2.1, we should flag a target IP conflict only if
the source IP is null, the target IP matches our IP, and the source
hw addr does not match our hw addr.

function                                             old     new   delta
zcip_main                                           1354    1322     -32

Signed-off-by: Ken Sharp <ken.sharp@ni.com>
Signed-off-by: Ben Shelton <ben.shelton@ni.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoudhcp: add PXELINUX path prefix option (code 210) definition
Jeremy Kerr [Tue, 15 Jul 2014 03:03:17 +0000 (11:03 +0800)]
udhcp: add PXELINUX path prefix option (code 210) definition

Like d3092c99, this change adds support for the DHCP "path-prefix"
option, as defined in RFC 5071. We use the string identifer
"pxepathprefix".

Adding this option makes string parsing in the hook scripts simpler.

function                                             old     new   delta
dhcp_option_strings                                  255     269     +14
dhcp_optflags                                         72      74      +2

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agontpd: add support for -I IFACE
Denys Vlasenko [Tue, 15 Jul 2014 13:06:54 +0000 (15:06 +0200)]
ntpd: add support for -I IFACE

function                                             old     new   delta
packed_usage                                       29908   29947     +39
ntp_init                                             428     460     +32
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 71/0)               Total: 71 bytes

Signed-off-by: Nikolaus Froehlich <nikolaus@mathematik.uni-marburg.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agomodinfo: fix module parsing with kernel >= 2.6.37
David Marchand [Thu, 3 Jul 2014 10:24:55 +0000 (12:24 +0200)]
modinfo: fix module parsing with kernel >= 2.6.37

display() function returns the length of the value we are displaying + 1.
As a consequence, if we have field=value\0field=value\0field=value in the
binary, then the second occurence will be skipped as ptr will miss the first
character of the following field.

Example trying to list aliases from ixgbe.ko on a 3.2 kernel.

- In the module we have:
alias=pci:v00008086d00001560sv*sd*bc*sc*i*\0
alias=pci:v00008086d0000154Asv*sd*bc*sc*i*\0
alias=pci:v00008086d00001557sv*sd*bc*sc*i*\0
alias=pci:v00008086d0000154Fsv*sd*bc*sc*i*\0
alias=pci:v00008086d0000154Dsv*sd*bc*sc*i*\0
...

- Using modinfo -F alias ixgbe returns:
alias:          pci:v00008086d00001560sv*sd*bc*sc*i*
alias:          pci:v00008086d00001557sv*sd*bc*sc*i*
alias:          pci:v00008086d0000154Dsv*sd*bc*sc*i*
...

This problem appeared with kernel commit "modules: no need to align .modinfo
strings" b6472776816af1ed52848c93d26e3edb3b17adab in 2.6.37.

Fix this by not trusting display() return value but increment ptr by strlen(ptr)
(the same way as depmod.c does).

Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agofatattr: use the standard type for 32-bit int
Denys Vlasenko [Fri, 4 Jul 2014 13:16:46 +0000 (15:16 +0200)]
fatattr: use the standard type for 32-bit int

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agosetlogcons: fix help text
Denys Vlasenko [Fri, 4 Jul 2014 11:58:57 +0000 (13:58 +0200)]
setlogcons: fix help text

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agosyslogd: make "reopen log file every second" logic work for multiple logs
Joshua Judson Rosen [Thu, 3 Jul 2014 12:51:47 +0000 (14:51 +0200)]
syslogd: make "reopen log file every second" logic work for multiple logs

Move last_log_time from a single global to *each logFile_t*
so that we can actually apply the logic to every log-file
in multi-file configurations, rather than working only
for the first file written in each 1-second interval
and then leaving the others connected to possibly wrong files.

Signed-off-by: Joshua Judson Rosen <jrosen@harvestai.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agosyslogd: syslogd: don't *decrement* log_file->size on write failures
Joshua Judson Rosen [Wed, 2 Jul 2014 17:41:41 +0000 (19:41 +0200)]
syslogd: syslogd: don't *decrement* log_file->size on write failures

Even if we fail to write to a log-file, and it's not growing,
it's not *shrinking* either....

Signed-off-by: Joshua Judson Rosen <jrosen@harvestai.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agosyslogd: make "-O -" log to stdout
Denys Vlasenko [Wed, 2 Jul 2014 13:21:30 +0000 (15:21 +0200)]
syslogd: make "-O -" log to stdout

function                                             old     new   delta
packed_usage                                       29871   29908     +37
log_locally                                          404     440     +36
syslogd_main                                        1966    1956     -10
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 73/-10)             Total: 63 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agotest: fix mishandling of "test '(' = '('" and similar
Denys Vlasenko [Tue, 1 Jul 2014 12:16:28 +0000 (14:16 +0200)]
test: fix mishandling of "test '(' = '('" and similar

function                                             old     new   delta
test_main                                            246     350    +104

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agolibbb: fix bb_ask() to flush input before prompt, not after. Closes 7190
Denys Vlasenko [Tue, 1 Jul 2014 11:20:22 +0000 (13:20 +0200)]
libbb: fix bb_ask() to flush input before prompt, not after. Closes 7190

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agocpio: reinstate "options:" line in help text
Denys Vlasenko [Mon, 30 Jun 2014 15:19:17 +0000 (17:19 +0200)]
cpio: reinstate "options:" line in help text

Otherwise, help text is confusing: where do operation modes end
and where options start?

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoRename INIT_LAST to INIT_FUNC to avoid confusion
Bartosz Golaszewski [Thu, 26 Jun 2014 12:31:05 +0000 (14:31 +0200)]
Rename INIT_LAST to INIT_FUNC to avoid confusion

We don't have an INIT_FIRST, so let's rename INIT_LAST to INIT_FUNC
to imply that the function is called at program start-up.

Also: the priority argument for __attribute__((constructor)) isn't
used, so let's remove it.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agofatattr: new applet
Pascal Bellard [Mon, 30 Jun 2014 11:06:39 +0000 (13:06 +0200)]
fatattr: new applet

function                                             old     new   delta
fatattr_main                                           -     281    +281
packed_usage                                       29821   29871     +50
bit_to_char                                            -      10     +10
applet_names                                        2472    2480      +8
applet_main                                         1436    1440      +4
applet_nameofs                                       718     720      +2
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 4/0 up/down: 355/0)             Total: 355 bytes

Signed-off-by: Pascal Bellard <pascal.bellard@ads-lu.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agolzop: add overflow check
Denys Vlasenko [Mon, 30 Jun 2014 08:14:34 +0000 (10:14 +0200)]
lzop: add overflow check

See CVE-2014-4607
http://www.openwall.com/lists/oss-security/2014/06/26/20

function                                             old     new   delta
lzo1x_decompress_safe                               1010    1031     +21

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agostat: fix printing selinux context and null-dereference
Michael Gernoth [Fri, 27 Jun 2014 12:08:29 +0000 (14:08 +0200)]
stat: fix printing selinux context and null-dereference

busybox stat tries to always print the selinux context, even if it
is not requested which leads to a segmentation fault due to
dereferencing a null-pointer.

This also changes the format-string used to print the context to
so it actually produces useful output.

Signed-off-by: Michael Gernoth <michael@gernoth.net>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoftpd: do not use root_fd if we are not in chroot
Denys Vlasenko [Fri, 27 Jun 2014 11:53:35 +0000 (13:53 +0200)]
ftpd: do not use root_fd if we are not in chroot

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoftpd: for LIST, open current directory *in the child*
Denys Vlasenko [Fri, 27 Jun 2014 10:37:00 +0000 (12:37 +0200)]
ftpd: for LIST, open current directory *in the child*

Last change introduced an open fd leak. This is the fix.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoftpd: escape chroot prior to re-executing ls helper
Denys Vlasenko [Fri, 27 Jun 2014 10:24:39 +0000 (12:24 +0200)]
ftpd: escape chroot prior to re-executing ls helper

When we merely chdir to saved "real" root fd,
exec("proc/self/exe") works for static executables but not
for dynamic ones (they can't find their interpreter).

With this patch, we also *chroot* to real root.
As a bonus, this gives us proper usernames, timezone conversion
etc.

function                                             old     new   delta
popen_ls                                             203     259     +56
ftpd_main                                           2362    2366      +4

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoawk: fix handling of "if ... break ; else ..." - closes 7226
Denys Vlasenko [Thu, 26 Jun 2014 14:40:28 +0000 (16:40 +0200)]
awk: fix handling of "if ... break ; else ..." - closes 7226

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoftpd: optimize writes of LIST results a bit
Denys Vlasenko [Thu, 26 Jun 2014 10:07:48 +0000 (12:07 +0200)]
ftpd: optimize writes of LIST results a bit

function                                             old     new   delta
handle_dir_common                                    201     207      +6

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agonanddump: change default to --bb=skipbad
Richard Genoud [Wed, 25 Jun 2014 15:38:30 +0000 (17:38 +0200)]
nanddump: change default to --bb=skipbad

since mtd-utils 1.4.7, the default behaviour of nanddump is skipbad
(commit 2521d4f1b6b9866a9c89f3c11a4f6a3d763ff1d7)

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agonanddump: kill -b Omit bad block
Richard Genoud [Wed, 25 Jun 2014 15:33:34 +0000 (17:33 +0200)]
nanddump: kill -b Omit bad block

since mtd-utils 1.4.7, the omit bad block method has been removed.
(cf commit d8b8f780ec3c916f3990e9227d6bfbb22bf42ef8)

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agonanddump: add options --bb=skipbad and padbad
Richard Genoud [Tue, 24 Jun 2014 10:12:59 +0000 (12:12 +0200)]
nanddump: add options --bb=skipbad and padbad

In mtd-utils, the bad block options changed in favor of
--bb=[skipbad|padbad|dumpbad] and omitbad has been removed.

This patch add the --bb=skipbad and padbad methods to busybox' nanddump.
padbad is the current default behaviour.
The difference between skipbad and omitbad is this one:
On a 16K block NAND, if the 1st block of mtd0 is bad, we'll have:
nanddump  -b -l 16384 /dev/mtd0 | wc -c
0
nanddump  --bb=skipbad -l 16384 /dev/mtd0 | wc -c
16384 <- data from 1st good block

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agonanddump: correct rounding to next page (lead to infinite loop)
Richard Genoud [Tue, 24 Jun 2014 10:12:58 +0000 (12:12 +0200)]
nanddump: correct rounding to next page (lead to infinite loop)

The rounding to next page formula was wrong:
ex: (len | ~(meminfo->writesize - 1)) + 1;
len=128K
writesize=4K
(len | ~(meminfo->writesize - 1)) + 1 => 4 294 963 201 ?!

correct rounding formula:
((len - 1) | (meminfo->writesize - 1)) + 1 => 128K
len = 130K
((len - 1) | (meminfo->writesize - 1)) + 1 => 132K

modprobe nandsim parts="20,20" badblocks="22,23"

without patch:
nanddump  /dev/mtd1 | wc -c
[...] infinite loop

with the patch:
nanddump /dev/mtd1 | wc -c
327680

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoftpd: support deprecated XPWD command
Denys Vlasenko [Wed, 25 Jun 2014 14:23:59 +0000 (16:23 +0200)]
ftpd: support deprecated XPWD command

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agolibbb: fix compile failure if both ARG_MAX and _SC_ARG_MAX are defined
Denys Vlasenko [Wed, 25 Jun 2014 13:39:27 +0000 (15:39 +0200)]
libbb: fix compile failure if both ARG_MAX and _SC_ARG_MAX are defined

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agounlink: new applet
Isaac Dunham [Sun, 22 Jun 2014 18:44:25 +0000 (20:44 +0200)]
unlink: new applet

function                                             old     new   delta
unlink_main                                            -      45     +45
packed_usage                                       29667   29686     +19

Signed-off-by: Isaac Dunham <ibid.ag@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agounit-tests: implement the unit-testing framework
Bartosz Golaszewski [Sun, 22 Jun 2014 14:30:41 +0000 (16:30 +0200)]
unit-tests: implement the unit-testing framework

This set of patches adds a simple unit-testing framework to Busybox

unit-tests: add some helper macros for unit-test framework implementation
unit-tests: implement the unit-testing framework
unit-tests: add basic documentation on writing the unit test cases
unit-tests: modify the Makefile 'test' target to run unit-tests too
unit-tests: add two example test cases
unit-tests: modify the existing strrstr test code to use the unit-test framework

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agolibbb: use a wrapper around sysconf(_SC_CLK_TCK) to save a few bytes
Bartosz Golaszewski [Sun, 22 Jun 2014 12:01:13 +0000 (14:01 +0200)]
libbb: use a wrapper around sysconf(_SC_CLK_TCK) to save a few bytes

function                                             old     new   delta
bb_sc_clk_tck                                          -      10     +10
timescmd                                             118     113      -5
print_route                                         1763    1758      -5
mpstat_main                                         1288    1283      -5
iostat_main                                         1947    1942      -5
INET_setroute                                        879     871      -8
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/5 up/down: 10/-28)            Total: -18 bytes
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agofind: use sysconf(_SC_ARG_MAX) to determine the command-line size limit
Denys Vlasenko [Sun, 22 Jun 2014 11:54:40 +0000 (13:54 +0200)]
find: use sysconf(_SC_ARG_MAX) to determine the command-line size limit

The find utility uses a hardcoded value of 32 * 1024 as the limit of
the command-line length when calling 'find -exec ... {} +'. This results
in over 4 times more execve() calls than in coreutils' find.

This patch uses the limit defined in system headers.

Based on the patch by  Bartosz Golaszewski <bartekgola@gmail.com>.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agofind: exit code fixes for find -exec
Denys Vlasenko [Thu, 19 Jun 2014 09:32:11 +0000 (11:32 +0200)]
find: exit code fixes for find -exec

function                                             old     new   delta
func_exec                                            127     100     -27

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agofind: add optional support for '-exec ... {} +'
Bartosz Golaszewski [Tue, 17 Jun 2014 15:09:17 +0000 (17:09 +0200)]
find: add optional support for '-exec ... {} +'

function                                             old     new   delta
do_exec                                                -     309    +309
parse_params                                        1416    1487     +71
find_main                                            342     406     +64
packed_usage                                       29958   30014     +56
func_exec                                            138     127     -11
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 3/1 up/down: 500/-11)           Total: 489 bytes

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoudhcpc: make hostname sanitization optional. Closes 3979
Denys Vlasenko [Sun, 15 Jun 2014 22:17:00 +0000 (00:17 +0200)]
udhcpc: make hostname sanitization optional. Closes 3979

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agosyslogd: Unify unlink/truncate + unlock log-rotation logic
Joshua Judson Rosen [Tue, 20 May 2014 05:02:20 +0000 (01:02 -0400)]
syslogd: Unify unlink/truncate + unlock log-rotation logic

Always unlink + reopen, rather than sometimes using ftruncate();
using a single code-path reduces the opportunity for either
mistakes or duplicate code.

Signed-off-by: Joshua Judson Rosen <jrosen@harvestai.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agosyslogd: remember to un-writelock log-files even when called with "-b 0"
Joshua Judson Rosen [Tue, 20 May 2014 05:02:19 +0000 (01:02 -0400)]
syslogd: remember to un-writelock log-files even when called with "-b 0"

Signed-off-by: Joshua Judson Rosen <jrosen@harvestai.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agosyslogd: avoid spurious ftrunctate() calls for "-b 0"
Joshua Judson Rosen [Tue, 20 May 2014 05:02:18 +0000 (01:02 -0400)]
syslogd: avoid spurious ftrunctate() calls for "-b 0"

Forgetting to re-set log_file->size after truncating to zero
discards log-data for the next 1 second following an oversize-induced purge,
when we shouldn't necessarily throw that data away.

Signed-off-by: Joshua Judson Rosen <jrosen@harvestai.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agomodprobe-small: fix safe_strncpy truncating last char of module name
Denys Vlasenko [Mon, 26 May 2014 13:01:13 +0000 (15:01 +0200)]
modprobe-small: fix safe_strncpy truncating last char of module name

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoAdd conditional support for -v / --verbose
Denys Vlasenko [Mon, 19 May 2014 14:23:50 +0000 (16:23 +0200)]
Add conditional support for -v / --verbose

With FEATURE_VERBOSE off, practically no size change.
With it on:

function                                             old     new   delta
remove_file                                          493     556     +63
install_main                                         719     765     +46
bb_make_directory                                    383     419     +36
rmdir_main                                           162     191     +29
copy_file                                           1516    1544     +28
mv_main                                              502     525     +23
cmp_main                                             677     693     +16
bbconfig_config_bz2                                 5264    5279     +15
mkdir_main                                           158     168     +10
install_longopts                                      66      76     +10
rm_main                                              167     175      +8
nexpr                                                840     846      +6
scan_tree                                            275     280      +5
fsck_main                                           1807    1811      +4
ed_main                                             2541    2545      +4
expand_one_var                                      1574    1575      +1
swap_on_off_main                                     420     418      -2
parse_command                                       1443    1440      -3
redirect                                            1279    1274      -5
do_load                                              946     918     -28
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 16/4 up/down: 304/-38)          Total: 266 bytes

Based on the patch by Igor Živković.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agogetty: explain when setsid() fails. no code changes
Denys Vlasenko [Sat, 10 May 2014 22:00:52 +0000 (00:00 +0200)]
getty: explain when setsid() fails. no code changes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoMerge branch 'master' of git+ssh://vda@busybox.net/var/lib/git/busybox
Denys Vlasenko [Sat, 10 May 2014 22:00:51 +0000 (00:00 +0200)]
Merge branch 'master' of git+ssh://vda@busybox.net/var/lib/git/busybox

10 years agotrylink: emit names of linked executables
Denys Vlasenko [Sat, 3 May 2014 14:35:15 +0000 (16:35 +0200)]
trylink: emit names of linked executables

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agowhich: rewrite
Tito Ragusa [Sat, 3 May 2014 14:34:36 +0000 (16:34 +0200)]
which: rewrite

function                                             old     new   delta
which_main                                           237     212     -25

Signed-off-by: Tito Ragusa <farmatito@tiscali.it>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agotrylink: emit names of linked executables
Denys Vlasenko [Sat, 3 May 2014 14:35:15 +0000 (16:35 +0200)]
trylink: emit names of linked executables

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agowhich: rewrite
Timo Teräs [Sat, 3 May 2014 14:34:36 +0000 (16:34 +0200)]
which: rewrite

function                                             old     new   delta
which_main                                           237     212     -25

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agolibbb: rename execable -> executable. No code changes
Denys Vlasenko [Fri, 2 May 2014 15:15:58 +0000 (17:15 +0200)]
libbb: rename execable -> executable. No code changes

English speakers complained that it sounded awfully broken.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agolibbb: fix empty PATH components handling
Denys Vlasenko [Fri, 2 May 2014 15:08:29 +0000 (17:08 +0200)]
libbb: fix empty PATH components handling

function                                             old     new   delta
find_execable                                         81      86      +5
exists_execable                                       71      66      -5

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agortcwake: fix incorrect (reversed) rtc/sys adjuestment; code shrink
Denys Vlasenko [Fri, 2 May 2014 10:46:15 +0000 (12:46 +0200)]
rtcwake: fix incorrect (reversed) rtc/sys adjuestment; code shrink

function                                             old     new   delta
rtcwake_main                                         482     462     -20

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agolibbb: fix thinko in rtc_xopen()
Denys Vlasenko [Fri, 2 May 2014 07:07:16 +0000 (09:07 +0200)]
libbb: fix thinko in rtc_xopen()

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agolibbb: make rtc_xopen try harder on EBUSY
Denys Vlasenko [Fri, 2 May 2014 07:05:03 +0000 (09:05 +0200)]
libbb: make rtc_xopen try harder on EBUSY

function                                             old     new   delta
rtc_xopen                                             77     139     +62

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoFix compile failures
Denys Vlasenko [Fri, 2 May 2014 05:18:55 +0000 (07:18 +0200)]
Fix compile failures

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agocrond: implement "SHELL=prog" in crontab. Export LOGNAME as POSIX wants
Denys Vlasenko [Wed, 30 Apr 2014 15:38:27 +0000 (17:38 +0200)]
crond: implement "SHELL=prog" in crontab. Export LOGNAME as POSIX wants

function                                             old     new   delta
fork_job                                             343     456    +113
load_crontab                                         688     777     +89
crond_main                                          1456    1434     -22
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 202/-22)           Total: 180 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agocrond: simplify logging code
Denys Vlasenko [Wed, 30 Apr 2014 12:49:52 +0000 (14:49 +0200)]
crond: simplify logging code

Slight change in behavior: now -l 5 will enable the same messages
formerly only enabled for -d 5. (Old behavior was non-sensical).

function                                             old     new   delta
reopen_logfile_to_stderr                               -      34     +34
log8                                                   -      26     +26
log7                                                   -      26     +26
log5                                                   -      26     +26
load_crontab                                         706     688     -18
rescan_crontab_dir                                   157     137     -20
crond_main                                          1486    1456     -30
fork_job                                             389     343     -46
crondlog                                             108      38     -70
------------------------------------------------------------------------------
(add/remove: 4/0 grow/shrink: 0/5 up/down: 112/-184)          Total: -72 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agolibbb: make syslog level for bb_error_msg's configurable. use it in crond
Denys Vlasenko [Wed, 30 Apr 2014 12:48:28 +0000 (14:48 +0200)]
libbb: make syslog level for bb_error_msg's configurable. use it in crond

function                                             old     new   delta
bb_verror_msg                                        380     386      +6
syslog_level                                           -       1      +1
crondlog                                             165     108     -57

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agocrond: tweak help text, make course less cryptic
Denys Vlasenko [Wed, 30 Apr 2014 12:47:28 +0000 (14:47 +0200)]
crond: tweak help text, make course less cryptic

function                                             old     new   delta
packed_usage                                       29736   29740      +4
crond_main                                          1485    1486      +1
load_crontab                                         712     706      -6

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agomodprobe-small: (un)load all modules which match the alias, not only first one
Denys Vlasenko [Mon, 21 Apr 2014 14:59:36 +0000 (16:59 +0200)]
modprobe-small: (un)load all modules which match the alias, not only first one

Closes 627 and 7034.

Commonly seen case is (un)loading of an alias
which matches ata_generic and a more specific ata module.

For example:

modprobe [-r] pci:v00008086d00007010sv00000000sd00000000bc01sc01i80
(ata_generic and pata_acpi)

modprobe [-r] pci:v00001106d00000571sv00001509sd00009022bc01sc01i8a
(ata_generic and pata_via)

function                                             old     new   delta
process_module                                       615     728    +113
parse_module                                         309     395     +86
find_alias                                           621     653     +32
pathname_matches_modname                              78      79      +1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/0 up/down: 232/0)             Total: 232 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agontpd: fix wrong delay value in one of the printed messages
Denys Vlasenko [Sun, 20 Apr 2014 11:04:23 +0000 (13:04 +0200)]
ntpd: fix wrong delay value in one of the printed messages

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agontpd: truly ignore high delay packet
Denys Vlasenko [Sat, 19 Apr 2014 17:00:16 +0000 (19:00 +0200)]
ntpd: truly ignore high delay packet

Before this cahnge, sometimes they were used after the next packet
from another peer was received, because we did updare some peer stats
from high delay packet before dropping it.

function                                             old     new   delta
recv_and_process_peer_pkt                            922     966     +44

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agomodprobe-small: remove redundant aliases from modules.dep.bb
Denys Vlasenko [Sat, 19 Apr 2014 14:17:27 +0000 (16:17 +0200)]
modprobe-small: remove redundant aliases from modules.dep.bb

function                                             old     new   delta
parse_module                                         309     395     +86

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agomodprobe-small: fix help messages for aliased module-related applets
Denys Vlasenko [Sat, 19 Apr 2014 13:04:39 +0000 (15:04 +0200)]
modprobe-small: fix help messages for aliased module-related applets

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoadjtimex: make its help text and printed data a bit less cryptic
Denys Vlasenko [Thu, 17 Apr 2014 09:29:34 +0000 (11:29 +0200)]
adjtimex: make its help text and printed data a bit less cryptic

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agolibbb/obscure.c: code shrink. Suggested by Tito.
Denys Vlasenko [Wed, 16 Apr 2014 17:51:34 +0000 (19:51 +0200)]
libbb/obscure.c: code shrink. Suggested by Tito.

function                                             old     new   delta
string_checker                                        97      92      -5

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoash,hush: set $HOSTNAME is bash compat. Closes 7028
Denys Vlasenko [Tue, 15 Apr 2014 09:43:29 +0000 (11:43 +0200)]
ash,hush: set $HOSTNAME is bash compat. Closes 7028

function                                             old     new   delta
hush_main                                           1056    1128     +72
ash_main                                            1442    1487     +45

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agolibbb: provide usleep() fallback implementation
Bernhard Reutner-Fischer [Sun, 13 Apr 2014 14:37:57 +0000 (16:37 +0200)]
libbb: provide usleep() fallback implementation

POSIX.1-2008 removed the usleep function, provide a fallback
implementaion using the recommended nanosleep().

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoless: fix bugs discovered with "git log -p | less -m" on kernel tree
Denys Vlasenko [Mon, 7 Apr 2014 21:32:29 +0000 (23:32 +0200)]
less: fix bugs discovered with "git log -p | less -m" on kernel tree

function                                             old     new   delta
read_lines                                           685     733     +48

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agovi: some simplifications
Denys Vlasenko [Sat, 5 Apr 2014 20:57:46 +0000 (22:57 +0200)]
vi: some simplifications

function                                             old     new   delta
file_insert                                          301     315     +14
init_text_buffer                                     179     171      -8
colon                                               2889    2878     -11
file_size                                             37       -     -37
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/2 up/down: 14/-56)            Total: -42 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agovi: clear undo buffer when we change to another file
Denys Vlasenko [Thu, 3 Apr 2014 10:47:48 +0000 (12:47 +0200)]
vi: clear undo buffer when we change to another file

function                                             old     new   delta
init_text_buffer                                     156     190     +34
undo_push                                            360     382     +22
count_lines                                           74      72      -2
undo_pop                                             246     222     -24
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/2 up/down: 56/-26)             Total: 30 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agovi: undo code shrink
Denys Vlasenko [Wed, 2 Apr 2014 23:45:05 +0000 (01:45 +0200)]
vi: undo code shrink

function                                             old     new   delta
undo_push                                            414     395     -19
do_cmd                                              4803    4761     -42

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agovi: undo support for vi with intermediate queuing
Jody Bruchon [Wed, 2 Apr 2014 11:49:26 +0000 (13:49 +0200)]
vi: undo support for vi with intermediate queuing

function                                             old     new   delta
undo_push                                              -     411    +411
undo_pop                                               -     288    +288
do_cmd                                              4160    4426    +266
char_insert                                          363     483    +120
undo_queue_commit                                      -      61     +61
text_hole_delete                                     108     163     +55
string_insert                                         94     127     +33
colon                                               2864    2882     +18
yank_delete                                           92     101      +9
vi_main                                              273     280      +7
dot_scroll                                            88      93      +5
dot_right                                             29      34      +5
dot_prev                                              20      25      +5
dot_next                                              20      25      +5
dot_left                                              24      29      +5
dot_end                                               20      25      +5
dot_begin                                             20      25      +5
init_text_buffer                                     154     156      +2
text_hole_make                                       145     142      -3
file_insert                                          333     318     -15
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 15/2 up/down: 1305/-18)        Total: 1287 bytes

(without queuing it's ~870 bytes)

Signed-off-by: Jody Bruchon <jody@jodybruchon.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agobuild system: specify '-nostldlib' when linking to .o files
Drew Moseley [Wed, 2 Apr 2014 10:12:46 +0000 (12:12 +0200)]
build system: specify '-nostldlib' when linking to .o files

For certain cross build scenarios the LD variable is overridden
to use the gcc executive to ensure all the target tuning parameters
are used.  In these cases, the executive errors out as shown below
but since this step is only linking to a .o file the standard libs
are not needed.

    $ make LD=gcc applets/built-in.o
      LD      applets/built-in.o
    /usr/bin/ld: cannot find -lgcc_s
    /usr/bin/ld: cannot find -lgcc_s
    collect2: ld returned 1 exit status
    make[1]: *** [applets/built-in.o] Error 1
    make: *** [applets_dir] Error 2

Signed-off-by: Drew Moseley <drew_moseley@mentor.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoswapon/swapoff: -a returns 0 on ignored errors
Tito Ragusa [Tue, 1 Apr 2014 07:51:27 +0000 (09:51 +0200)]
swapon/swapoff: -a returns 0 on ignored errors

Signed-off-by: Tito Ragusa <farmatito@tiscali.it>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoswapon/swapoff: size reduction, cleanup, fixes, improvements
Tito Ragusa [Mon, 31 Mar 2014 14:39:26 +0000 (16:39 +0200)]
swapon/swapoff: size reduction, cleanup, fixes, improvements

1) real swapon/swapoff handles also devices on the commandline with -a;
2) xstat(device)  in  swap_enable_disable aborts on error when cycling through
   fstab so some devices  are not handled;
3) duplicated code for ENABLE_FEATURE_SWAPON_DISCARD and
   ENABLE_FEATURE_SWAPON_PRI was moved to functions.
4) silence some error messages with -a;
5) minor cleanups and code refactoring reduced the size as per bloat-check:
6) I also added support for /proc/swaps handling to swapoff:
"When the -a flag is given, swapping is disabled on all known  swap  devices
 and  files  (as  found  in  /proc/swaps  or /etc/fstab)."
So now swapoff first cycles through  /proc/swaps and then through fstab
to swapoff all devices.

function                                             old     new   delta
set_discard_flag                                       -     106    +106
swap_enable_disable                                  147     238     +91
set_priority_flag                                      -      79     +79
retrieve_file_data                                   470     467      -3
swap_on_off_main                                     638     418    -220
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 1/2 up/down: 276/-223)           Total: 53 bytes

Signed-off-by: Tito Ragusa <farmatito@tiscali.it>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agowget: fix a case where progress bar isn't updated if writes are very slow
Denys Vlasenko [Thu, 27 Mar 2014 15:50:29 +0000 (16:50 +0100)]
wget: fix a case where progress bar isn't updated if writes are very slow

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoadd discard option -d to swapon
Matt Whitlock [Sat, 22 Mar 2014 23:21:01 +0000 (19:21 -0400)]
add discard option -d to swapon

Signed-off-by: Matt Whitlock <busybox@mattwhitlock.name>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agofix interaction of -a and -p options in swapon
Matt Whitlock [Sat, 22 Mar 2014 23:10:08 +0000 (19:10 -0400)]
fix interaction of -a and -p options in swapon

Swap entries in /etc/fstab inherit the priority specified on the command line unless they have 'pri' in their mount options.

Signed-off-by: Matt Whitlock <busybox@mattwhitlock.name>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoavoid calling bb_strtou twice in MIN macro expansion
Matt Whitlock [Sat, 22 Mar 2014 22:54:24 +0000 (18:54 -0400)]
avoid calling bb_strtou twice in MIN macro expansion

Also, the maximum allowable value of swap priority is technically SWAP_FLAG_PRIO_MASK >> SWAP_FLAG_PRIO_SHIFT.

Signed-off-by: Matt Whitlock <busybox@mattwhitlock.name>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agontpd: add optional support for /etc/ntp.conf
Denys Vlasenko [Sun, 23 Mar 2014 14:06:38 +0000 (15:06 +0100)]
ntpd: add optional support for /etc/ntp.conf

function                                             old     new   delta
add_peers                                              -      98     +98
packed_usage                                       29470   29511     +41
ntp_init                                             407     428     +21
pw_encrypt                                            14      27     +13
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 3/0 up/down: 173/0)             Total: 173 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agodocs/new-applet-HOWTO.txt: tweak a bit
Denys Vlasenko [Mon, 17 Mar 2014 14:06:29 +0000 (15:06 +0100)]
docs/new-applet-HOWTO.txt: tweak a bit

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agolibbb: fix a bad check for uclibc >= 0.9.31
Denys Vlasenko [Sun, 16 Mar 2014 19:53:40 +0000 (20:53 +0100)]
libbb: fix a bad check for uclibc >= 0.9.31

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agodocs: update new-applet-HOWTO.txt
Bartosz Golaszewski [Wed, 12 Mar 2014 21:43:50 +0000 (22:43 +0100)]
docs: update new-applet-HOWTO.txt

This patch adds some information about the gen_build_files.sh script and how
it allows to keep the Kbuild, Config.in etc. declarations in .c files.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoash: make "locak VAR" unset VAR (bash does that)
Denys Vlasenko [Sun, 16 Mar 2014 17:41:11 +0000 (18:41 +0100)]
ash: make "locak VAR" unset VAR (bash does that)

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoscript: make it work even if fd 0 is closed
Denys Vlasenko [Sun, 16 Mar 2014 11:34:53 +0000 (12:34 +0100)]
script: make it work even if fd 0 is closed

Testcase:
script -q -c "echo hey" /dev/null 0>&-

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agobuild system: for "find", use POSIX not operator (!) instead of -not
Denys Vlasenko [Sun, 16 Mar 2014 11:05:58 +0000 (12:05 +0100)]
build system: for "find", use POSIX not operator (!) instead of -not

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agosu: add a delay if the password is incorrect
Romain Naour [Sun, 16 Mar 2014 10:18:19 +0000 (11:18 +0100)]
su: add a delay if the password is incorrect

Signed-off-by: Romain Naour <romain.naour@openwide.fr>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoash,hush: fix a thinko about 2^64-1 factorization
Denys Vlasenko [Sat, 15 Mar 2014 08:25:46 +0000 (09:25 +0100)]
ash,hush: fix a thinko about 2^64-1 factorization

function                                             old     new   delta
next_random                                          113     119      +6

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agohush: make "true" built-in
Denys Vlasenko [Fri, 14 Mar 2014 11:43:57 +0000 (12:43 +0100)]
hush: make "true" built-in

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agorandom: cosmetic tweaks in debug code
Denys Vlasenko [Thu, 13 Mar 2014 12:03:27 +0000 (13:03 +0100)]
random: cosmetic tweaks in debug code

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoash,hush: improve randomness of $RANDOM, add easy-ish way to test it
Denys Vlasenko [Thu, 13 Mar 2014 11:52:43 +0000 (12:52 +0100)]
ash,hush: improve randomness of $RANDOM, add easy-ish way to test it

function                                             old     new   delta
next_random                                           68     113     +45
change_random                                        103     121     +18

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoshuf: trim help text
Denys Vlasenko [Fri, 7 Mar 2014 13:41:53 +0000 (14:41 +0100)]
shuf: trim help text

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