oweals/busybox.git
9 years agoStart 1.24.0 development cycle
Denys Vlasenko [Wed, 24 Dec 2014 01:06:02 +0000 (02:06 +0100)]
Start 1.24.0 development cycle

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoBump version to 1.23.0 1_23_0
Denys Vlasenko [Wed, 24 Dec 2014 00:23:34 +0000 (01:23 +0100)]
Bump version to 1.23.0

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agolibbb: add sanity check in bb_arg_max()
Denys Vlasenko [Wed, 24 Dec 2014 00:46:29 +0000 (01:46 +0100)]
libbb: add sanity check in bb_arg_max()

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agorandomconfig fixes
Denys Vlasenko [Mon, 22 Dec 2014 18:37:05 +0000 (19:37 +0100)]
randomconfig fixes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoMake it possible to override LOGIN_FAIL_DELAY in CONFIG_EXTRA_CFLAGS
Peter Kümmel [Mon, 22 Dec 2014 00:55:54 +0000 (01:55 +0100)]
Make it possible to override LOGIN_FAIL_DELAY in CONFIG_EXTRA_CFLAGS

Signed-off-by: Peter Kümmel <syntheticpp@gmx.net>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoudhcpc: account for script run time
Denys Vlasenko [Sun, 21 Dec 2014 15:10:22 +0000 (16:10 +0100)]
udhcpc: account for script run time

Based on the following user report:

I ran into an issue where I was seeing a long delay in the scripts called
in udhcp_run_script. I was using an old version of OpenWrt (kamikaze)
and a satellite modem. An NTP script was being called and the modem
would sometimes take a long time to respond to the DNS lookup when
it was offline.

This delay started affecting my lease time. The lease that I would
get from my satellite modem before it was online would be short:
only 60 seconds. The delay with NTP and the modem would typically
be about 18 seconds. This would cause the first DHCP renew request
from dhcpc to be a little late. Under certain circumstances,
I could even see the first DHCP renew to occur after the lease
had expired!

function                                             old     new   delta
udhcpc_main                                         2816    2837     +21

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agonanddump: don't show --bb in usage when disabled
Baruch Siach [Wed, 17 Dec 2014 22:27:26 +0000 (00:27 +0200)]
nanddump: don't show --bb in usage when disabled

The --bb options now depends on LONG_OPTS. Omit mentions of --bb from usage
text when LONG_OPTS is disabled.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agonandwrite: fix build when long options are disabled
Baruch Siach [Wed, 17 Dec 2014 16:02:37 +0000 (17:02 +0100)]
nandwrite: fix build when long options are disabled

The Required_argument macro is only defined when long options are enabled.
Fixes the following build error:

miscutils/nandwrite.c: In function 'nandwrite_main':
miscutils/nandwrite.c:120:10: error: expected ',' or ';' before 'Required_argument'

Reported-by: Christian Kästner <kaestner at cs.cmu.edu>
Signed-off-by: Baruch Siach <baruch at tkos.co.il>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agolineedit: don't block when looking for escape sequence in vi-mode
Ron Yorston [Fri, 12 Dec 2014 08:29:41 +0000 (08:29 +0000)]
lineedit: don't block when looking for escape sequence in vi-mode

In vi-mode lineedit tries to detect some escape sequences.
After the ESC it reads the next character to check for certain
values.  This read should have a timeout or a user-entered ESC to
switch to command mode doesn't properly handle the next character.

Signed-off-by: Ron Yorston <rmy@tigress.co.uk>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agotar: fix "tar -cJ" ignoring -J option. closes 7706
Denys Vlasenko [Thu, 11 Dec 2014 14:33:07 +0000 (15:33 +0100)]
tar: fix "tar -cJ" ignoring -J option. closes 7706

function                                             old     new   delta
tar_main                                             895     938     +43
vfork_compressor                                     206     191     -15
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 43/-15)             Total: 28 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agolineedit: don't fall back to simple line input if tty is in raw mode
Denys Vlasenko [Wed, 10 Dec 2014 16:22:13 +0000 (17:22 +0100)]
lineedit: don't fall back to simple line input if tty is in raw mode

Testcase: shell command input after python ^Z should still work

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoConfig: select PLATFORM_LINUX if using sendfile()
Bartosz Golaszewski [Wed, 10 Dec 2014 12:34:42 +0000 (13:34 +0100)]
Config: select PLATFORM_LINUX if using sendfile()

Man entry for sendfile:

  Not specified in POSIX.1-2001, or other standards.

  Other UNIX systems implement sendfile() with different  semantics  and
  prototypes. It should not be used in portable programs.

Select PLATFORM_LINUX if enabling FEATURE_USE_SENDFILE.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoflashcp: change BUFSIZE to 4k
Jacob Kjaergaard [Wed, 10 Dec 2014 12:44:27 +0000 (13:44 +0100)]
flashcp: change BUFSIZE to 4k

some flash partitions can be smaller than the existing BUFSIZE thus write
BUFSIZE will fail with "no space left on device"

Signed-off-by: Jacob Kjaergaard <jacob.kjaergaard@prevas.dk>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agomake xmalloc_open_zipped_read_close result NUL terminated
Denys Vlasenko [Sat, 6 Dec 2014 23:49:55 +0000 (00:49 +0100)]
make xmalloc_open_zipped_read_close result NUL terminated

Compat with xmalloc_open_read_close

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agolibarchive: add capability to unpack to mem.buffer
Denys Vlasenko [Sat, 6 Dec 2014 23:44:00 +0000 (00:44 +0100)]
libarchive: add capability to unpack to mem.buffer

The performance and number of processes for a "depmod -a" with gzipped
modules was abysmal. This patch adds a code path without fork,
benefiting all users of xmalloc_open_zipped_read_close.

"modinfo radeon.ko.gz", a single-file reader, got 30% faster.
"depmod -a", which used to fork over 800 times, got 20% faster.

Heavily based on a patch by Lauri Kasanen <curaga@operamail.com>

function                                             old     new   delta
setup_transformer_on_fd                                -     159    +159
transformer_write                                      -     122    +122
fork_transformer                                       -     112    +112
xmalloc_open_zipped_read_close                        63     118     +55
read_bunzip                                         1866    1896     +30
xtransformer_write                                     -      19     +19
unzip_main                                          2449    2462     +13
bbunpack                                             755     766     +11
unpack_lzma_stream                                  2717    2723      +6
unpack_xz_stream                                    2393    2397      +4
unpack_Z_stream                                     1173    1175      +2
inflate_unzip                                        111     105      -6
check_signature16                                     70      63      -7
unpack_bz2_stream                                    359     349     -10
unpack_unxz                                           12       -     -12
unpack_unlzma                                         12       -     -12
unpack_uncompress                                     12       -     -12
unpack_gunzip                                         12       -     -12
unpack_bunzip2                                        12       -     -12
open_transformer                                     106      92     -14
inflate_unzip_internal                              1945    1916     -29
unpack_gz_stream                                     693     655     -38
open_zipped                                           89      47     -42
setup_unzip_on_fd                                    142      53     -89
------------------------------------------------------------------------------
(add/remove: 4/5 grow/shrink: 7/8 up/down: 533/-295)          Total: 238 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoRename transformer_aux_data_t -> transformer_state_t
Denys Vlasenko [Sat, 6 Dec 2014 23:42:49 +0000 (00:42 +0100)]
Rename transformer_aux_data_t -> transformer_state_t

No code changes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoman: do not mangle $MANPATH in memory
Denys Vlasenko [Sun, 30 Nov 2014 18:39:58 +0000 (19:39 +0100)]
man: do not mangle $MANPATH in memory

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agolibbb: use sendfile() to copy data between file descriptors
Bartosz Golaszewski [Thu, 27 Nov 2014 12:20:24 +0000 (13:20 +0100)]
libbb: use sendfile() to copy data between file descriptors

Busybox already uses sendfile in httpd. This patch proposes to use it
globally to copy data between file descriptors.

It speeds up the copying on slow systems a lot - below are the times needed
to copy a 450Mb file with and without this option enabled on a BeagleBone
Black:

sendfile:
user    0m0.000s
sys     0m8.170s

read/write 4k:
user    0m0.470s
sys     0m16.300s

function                                             old     new   delta
bb_full_fd_action                                    394     474     +80

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoman: accept a list of dirs in $MANPATH
Denys Vlasenko [Wed, 26 Nov 2014 23:40:08 +0000 (00:40 +0100)]
man: accept a list of dirs in $MANPATH

function                                             old     new   delta
add_MANPATH                                            -     143    +143
man_main                                             852     731    -121
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/1 up/down: 143/-121)           Total: 22 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agolibbb: use ARG_MAX for bb_arg_max() only if it's 60k+
Denys Vlasenko [Wed, 26 Nov 2014 14:17:59 +0000 (15:17 +0100)]
libbb: use ARG_MAX for bb_arg_max() only if it's 60k+

Sometimes ARG_MAX is small (like 32k) yet sysconf(_SC_ARG_MAX)
is big, and people prefer using the bigger value.

OTOH, with sufficiently large ARG_MAX, further wins from
sysconf(_SC_ARG_MAX) being bigger are exponentially smaller:
you can see 4 times fewer fork+execs when you run find, but
when each execed process already takes a thousand parameters
it's likely execution time is dominated by what that process
does with each parameter.

Thus, with this change ARG_MAX is used if it's sufficiently big,
otherwise sysconf(_SC_ARG_MAX) is used.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agobbunit: fix WANT_TIMING compilation
Denys Vlasenko [Wed, 26 Nov 2014 13:04:51 +0000 (14:04 +0100)]
bbunit: fix WANT_TIMING compilation

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agogitignore: add testsuite/echo-ne
Bartosz Golaszewski [Wed, 26 Nov 2014 12:28:54 +0000 (13:28 +0100)]
gitignore: add testsuite/echo-ne

Signed-off-by: Bartosz Golaszewski <bartekgola at gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoudhcpd: if a lease from lease file coincides with a static one, ignore it
Denys Vlasenko [Tue, 25 Nov 2014 17:49:14 +0000 (18:49 +0100)]
udhcpd: if a lease from lease file coincides with a static one, ignore it

function                                             old     new   delta
read_leases                                          269     328     +59

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoinit: do not run shutdown/reexec actions from signal handler
Denys Vlasenko [Fri, 21 Nov 2014 19:10:57 +0000 (20:10 +0100)]
init: do not run shutdown/reexec actions from signal handler

this is racy wrt various libc functions such as syslog()

function                                             old     new   delta
check_delayed_sigs                                   182     352    +170
init_main                                            772     728     -44
restart_handler                                       74       -     -74
halt_reboot_pwoff                                     79       -     -79
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 1/1 up/down: 170/-197)          Total: -27 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agomodprobe,rmmod: reject module names with slashes
Denys Vlasenko [Thu, 20 Nov 2014 17:24:33 +0000 (18:24 +0100)]
modprobe,rmmod: reject module names with slashes

function                                             old     new   delta
add_probe                                             86     113     +27

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agotypo fix in comment
Denys Vlasenko [Thu, 20 Nov 2014 00:43:30 +0000 (01:43 +0100)]
typo fix in comment

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoash,hush: do not segfault on $((2**63 / -1))
Denys Vlasenko [Tue, 18 Nov 2014 13:32:58 +0000 (14:32 +0100)]
ash,hush: do not segfault on $((2**63 / -1))

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoash: fix handling of negative start value in ${v:start:len}
Denys Vlasenko [Mon, 17 Nov 2014 19:27:18 +0000 (20:27 +0100)]
ash: fix handling of negative start value in ${v:start:len}

function                                             old     new   delta
subevalvar                                          1140    1168     +28

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoiproute: support onelink route option and print route flags
Michael Tokarev [Mon, 28 Jul 2014 06:05:41 +0000 (10:05 +0400)]
iproute: support onelink route option and print route flags

function                                             old     new   delta
print_route                                         1797    1865     +68
do_iproute                                          2097    2112     +15
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 83/0)               Total: 83 bytes

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoexit with 127 if appled name wasn't found - it's more POSIXy
Denys Vlasenko [Mon, 17 Nov 2014 16:03:47 +0000 (17:03 +0100)]
exit with 127 if appled name wasn't found - it's more POSIXy

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agozcip: Add environment variable for overriding log functionality
Michel Stam [Tue, 4 Nov 2014 11:19:04 +0000 (12:19 +0100)]
zcip: Add environment variable for overriding log functionality

function                                             old     new   delta
bb_logenv_override                                     -      70     +70
packed_usage                                       29969   30033     +64
zcip_main                                           1426    1431      +5
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 2/0 up/down: 139/0)             Total: 139 bytes

Signed-off-by: Michel Stam <m.stam@fugro.nl>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agozcip: allow our own class B range to be used for ZeroConf
Michel Stam [Thu, 30 Oct 2014 12:43:09 +0000 (13:43 +0100)]
zcip: allow our own class B range to be used for ZeroConf

169.254 may already be used by a local network. This patch allows
specifying your own IP range.

Our particular use case is a mesh network, in which the nodes partaking
were using an IP range specifically assigned for the meshing purpose.
As the LAN side of the mesh node could use 169.254, this default range
was not an option.

function                                             old     new   delta
zcip_main                                           1342    1426     +84
pick_nip                                               -      40     +40
packed_usage                                       29974   29969      -5
pick                                                  34       -     -34
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 1/1 up/down: 124/-39)            Total: 85 bytes

Signed-off-by: Michel Stam <m.stam@fugro.nl>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoudhcpd: add option for tweaking arpping
Michel Stam [Thu, 30 Oct 2014 10:59:04 +0000 (11:59 +0100)]
udhcpd: add option for tweaking arpping

Some clients have a very short timeout for sending the DHCP
DISCOVER, shorter than the arpping timeout of 2000 milliseconds
that udhcpd uses by default.

This patch allows tweaking the timeout, or disabling of arpping
altogether, at the risk of handing out addresses which are
already in use.

function                                             old     new   delta
udhcpd_main                                         1460    1501     +41
udhcpc_main                                         2814    2851     +37
packed_usage                                       29957   29974     +17
arpping                                              477     493     +16
find_free_or_expired_nip                             161     174     +13
send_offer                                           285     292      +7
nobody_responds_to_arp                                85      89      +4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 7/0 up/down: 135/0)             Total: 135 bytes

Signed-off-by: Michel Stam <m.stam@fugro.nl>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agontpd: calculate offset to jitter ratio before updating jitter
Miroslav Lichvar [Sun, 5 Oct 2014 01:10:15 +0000 (03:10 +0200)]
ntpd: calculate offset to jitter ratio before updating jitter

The offset to jitter ratio is now calculated before updating
jitter to make the test more sensitive.

function                                             old     new   delta
ntp_init                                             460     474     +14
update_local_clock                                   752     764     +12
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 26/0)               Total: 26 bytes

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agosed: fix "sed CMD -i nonexistent_file". Closes 7484
Denys Vlasenko [Sun, 5 Oct 2014 00:44:34 +0000 (02:44 +0200)]
sed: fix "sed CMD -i nonexistent_file". Closes 7484

function                                             old     new   delta
sed_main                                             643     676     +33

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agontpd: don't stay at short polling interval
Miroslav Lichvar [Thu, 2 Oct 2014 15:18:43 +0000 (17:18 +0200)]
ntpd: don't stay at short polling interval

To avoid polling servers frequently slowly increase the interval up
to BIGPOLL when
- no replies are received from a peer
- no source can be selected
- peer claims to be unsynchronized (e.g. we are polling it too
  frequently)

When recv() returns with an error, drop code to try to continue
on network errors: I'm not convinced those cases happen in real life.

function                                             old     new   delta
recv_and_process_peer_pkt                            919     838     -81

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agogetty: set tty attrs so that control chars are shown as ^c
Denys Vlasenko [Thu, 2 Oct 2014 11:45:21 +0000 (13:45 +0200)]
getty: set tty attrs so that control chars are shown as ^c

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agontpd: be less eager to use shorter poll intervals
Denys Vlasenko [Sat, 27 Sep 2014 20:56:09 +0000 (22:56 +0200)]
ntpd: be less eager to use shorter poll intervals

* on step, poll interval drops to 8.5 mins instead of 32 seconds
* on total loss of all replies (no replies from any peer
  for last 8 requests), also drop poll interval to 8.5 mins
  instead of 32 seconds
* on send abd recv errors, RETRY_INTERVAL is now 32 seconds,
  not 5 seconds
* on timing out listening to reply, instead of unconditional
  shortening poll interval by x4, clamp it to NOREPLY_INTERVAL
  (512 seconds)
* if a largish offset is seen, clamp nexp poll interval
  to 128 seconds, not 64 seconds

function                                             old     new   delta
clamp_pollexp_and_set_MAXSTRAT                         -      37     +37
recv_and_process_peer_pkt                            861     869      +8
poll_interval                                         52      48      -4
update_local_clock                                   762     752     -10
ntpd_main                                           1063    1050     -13
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/3 up/down: 45/-27)             Total: 18 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoubiupdatevol: fix -t to not require an option. Closes 7466
Denys Vlasenko [Thu, 25 Sep 2014 20:10:32 +0000 (22:10 +0200)]
ubiupdatevol: fix -t to not require an option. Closes 7466

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoinstall: fix help text
Denys Vlasenko [Wed, 24 Sep 2014 20:16:24 +0000 (22:16 +0200)]
install: fix help text

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agontpd: split out poll adjusting code
Miroslav Lichvar [Thu, 18 Sep 2014 14:19:05 +0000 (16:19 +0200)]
ntpd: split out poll adjusting code

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agontpd: don't wait for good offset before disabling burst mode
Miroslav Lichvar [Thu, 18 Sep 2014 14:19:03 +0000 (16:19 +0200)]
ntpd: don't wait for good offset before disabling burst mode

The burst mode needs to be stopped even when no replies are received.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoinstall: implement -t DIR
Aaro Koskinen [Wed, 24 Sep 2014 00:52:08 +0000 (02:52 +0200)]
install: implement -t DIR

Some packages want to install themselves using "-t" to specify
the directory (as supported by GNU coreutils). Add support for the option
for compatibility reasons.

function                                             old     new   delta
install_longopts                                      76      95     +19
install_main                                         769     777      +8
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 27/0)               Total: 27 bytes

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoless: make -E work
Aaro Koskinen [Tue, 23 Sep 2014 20:58:18 +0000 (22:58 +0200)]
less: make -E work

function                                             old     new   delta
buffer_print                                          71     104     +33

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoless: trivial code shrink
Denys Vlasenko [Mon, 22 Sep 2014 19:17:24 +0000 (21:17 +0200)]
less: trivial code shrink

function                                             old     new   delta
read_lines                                           715     695     -20

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoless: move "retry-on-EAGAIN" logic closer to read ops
Denys Vlasenko [Mon, 22 Sep 2014 19:14:02 +0000 (21:14 +0200)]
less: move "retry-on-EAGAIN" logic closer to read ops

This makes "G" (goto end of input) command work as well as
/search_for_nonexistent_string: both will read to EOF now
even from somewhat slow input (such as kernel's "git log").

function                                             old     new   delta
ndelay_on                                             35      43      +8
ndelay_off                                            35      43      +8
read_lines                                           695     691      -4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 16/-4)              Total: 12 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoless: disable "suppress empty wraparound" optimization
Denys Vlasenko [Sun, 21 Sep 2014 20:10:55 +0000 (22:10 +0200)]
less: disable "suppress empty wraparound" optimization

It is buggy wrt another use case...

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agodf: fix -T option when ENABLE_FEATURE_HUMAN_READABLE=0
Ari Sundholm [Thu, 18 Sep 2014 12:41:57 +0000 (15:41 +0300)]
df: fix -T option when ENABLE_FEATURE_HUMAN_READABLE=0

Signed-off-by: Ari Sundholm <ari@tuxera.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agofalse: make "false --help" exit with 1
Denys Vlasenko [Wed, 17 Sep 2014 22:47:05 +0000 (00:47 +0200)]
false: make "false --help" exit with 1

function                                             old     new   delta
run_applet_no_and_exit                               447     445      -2

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agodf: implement -T option
Ari Sundholm [Wed, 17 Sep 2014 18:53:58 +0000 (20:53 +0200)]
df: implement -T option

function                                             old     new   delta
df_main                                              863     998    +135
packed_usage                                       29827   29861     +34
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 169/0)             Total: 169 bytes

Signed-off-by: Ari Sundholm <ari@tuxera.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agosed: fix a buglet in s///NUM handling
Denys Vlasenko [Mon, 15 Sep 2014 23:11:13 +0000 (01:11 +0200)]
sed: fix a buglet in s///NUM handling

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoftpd: make LIST command show dotfiles too
Denys Vlasenko [Mon, 15 Sep 2014 21:35:58 +0000 (23:35 +0200)]
ftpd: make LIST command show dotfiles too

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agovi: fix incorrect memory access on brace matching. Closes 7256
Denys Vlasenko [Mon, 15 Sep 2014 15:06:10 +0000 (17:06 +0200)]
vi: fix incorrect memory access on brace matching. Closes 7256

While at it, fix brace matching to actually show the match
(missed fflush was causing cursor positioning to be buffered);
shorten brace matching code; remove unused macro indirection
in indicate_error().

Custom linker script 'busybox_ldscript' found, using it
function                                             old     new   delta
indicate_error                                         -      61     +61
mysleep                                               43      56     +13
char_insert                                          483     486      +3
find_pair                                            167     124     -43
Indicate_Error                                        61       -     -61
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 2/1 up/down: 77/-104)           Total: -27 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agomdev: treat zero-length /dev/mdev.seq the same as "\n" one. Closes 7334
Denys Vlasenko [Mon, 8 Sep 2014 16:19:15 +0000 (18:19 +0200)]
mdev: treat zero-length /dev/mdev.seq the same as "\n" one. Closes 7334

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoash: fix off-by-one in "jobs %4" handling. closes 7310
Denys Vlasenko [Mon, 8 Sep 2014 15:21:52 +0000 (17:21 +0200)]
ash: fix off-by-one in "jobs %4" handling. closes 7310

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoash: factor out ASH_HELP config option
Denys Vlasenko [Mon, 8 Sep 2014 14:52:39 +0000 (16:52 +0200)]
ash: factor out ASH_HELP config option

It used to be aliased to !FEATURE_SH_EXTRA_QUIET for ash,
while hush had it separate from FEATURE_SH_EXTRA_QUIET.

Bring ash in line with hush.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agofind: support -perm /BITS. Closes 7340
Denys Vlasenko [Fri, 5 Sep 2014 10:16:15 +0000 (12:16 +0200)]
find: support -perm /BITS. Closes 7340

function                                             old     new   delta
parse_params                                        1487    1497     +10
func_perm                                             57      61      +4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 14/0)               Total: 14 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agotftpd: tweak HP PA-RISC firmware bug compatibility
Denys Vlasenko [Thu, 4 Sep 2014 10:24:03 +0000 (12:24 +0200)]
tftpd: tweak HP PA-RISC firmware bug compatibility

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agotftpd: support full 512-byte requests
Denys Vlasenko [Wed, 3 Sep 2014 16:35:38 +0000 (18:35 +0200)]
tftpd: support full 512-byte requests

Some HP PA-RISC firmware always sends fixed 512-byte requests,
with trailing garbage.

function                                             old     new   delta
tftpd_main                                           578     572      -6

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agotaskset: fix logic error in "if it doesn't start with 0x..."
Denys Vlasenko [Sat, 30 Aug 2014 23:35:45 +0000 (01:35 +0200)]
taskset: fix logic error in "if it doesn't start with 0x..."

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agogrep: fix "grep -r PATTRN SYMLINK_TO_DIR"
Denys Vlasenko [Thu, 28 Aug 2014 13:50:09 +0000 (15:50 +0200)]
grep: fix "grep -r PATTRN SYMLINK_TO_DIR"

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoping: add -p to specify data pattern
Florian Fainelli [Wed, 27 Aug 2014 14:01:25 +0000 (16:01 +0200)]
ping: add -p to specify data pattern

function                                             old     new   delta
common_ping_main                                    1788    1831     +43
sendping6                                             56      82     +26
sendping4                                             82     108     +26
packed_usage                                       29959   29938     -21
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/1 up/down: 95/-21)             Total: 74 bytes

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agotaskset: support CPU masks for more than 64 CPUs
Denys Vlasenko [Sun, 17 Aug 2014 17:36:22 +0000 (19:36 +0200)]
taskset: support CPU masks for more than 64 CPUs

function                                             old     new   delta
taskset_main                                         522     631    +109

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>