oweals/busybox.git
11 years agoifplugd: make -k send SIGINT, not SIGQUIT
Denys Vlasenko [Thu, 28 Feb 2013 11:50:09 +0000 (12:50 +0100)]
ifplugd: make -k send SIGINT, not SIGQUIT

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agopgrep: fix -x option
Bernhard Walle [Thu, 28 Feb 2013 11:42:38 +0000 (12:42 +0100)]
pgrep: fix -x option

Because when -x is used (exact match), then we cannot compile the
regular expression with REG_NOSUB. The manual page regcomp(3) states
in section "Byte offsets":

    Unless REG_NOSUB was set for the compilation of the pattern
    buffer, it is possible to obtain substring match addressing
    information.

The problem was detected on an ARM system with glibc 2.16.
Signed-off-by: Bernhard Walle <bernhard@bwalle.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoFix config help text
Denys Vlasenko [Thu, 28 Feb 2013 11:39:27 +0000 (12:39 +0100)]
Fix config help text

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agomake --help return exitcode 0. Closes 5612
Denys Vlasenko [Thu, 28 Feb 2013 11:34:18 +0000 (12:34 +0100)]
make --help return exitcode 0. Closes 5612

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agorun-parts: fix unicode creep in --help
Peter Korsgaard [Thu, 28 Feb 2013 11:25:49 +0000 (12:25 +0100)]
run-parts: fix unicode creep in --help

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agonc_bloaty: support -ll and -lk. Closes 2245
Denys Vlasenko [Thu, 28 Feb 2013 11:20:06 +0000 (12:20 +0100)]
nc_bloaty: support -ll and -lk. Closes 2245

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agonc: don't redirect stderr to network in -e PROG mode
Denys Vlasenko [Thu, 28 Feb 2013 10:09:14 +0000 (11:09 +0100)]
nc: don't redirect stderr to network in -e PROG mode

This in incompatible with nc-1.10, but makes a lot of sense.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agonameif: fix use-after-free in ENABLE_FEATURE_CLEAN_UP code
Thomas De Schampheleire [Thu, 28 Feb 2013 09:31:54 +0000 (10:31 +0100)]
nameif: fix use-after-free in ENABLE_FEATURE_CLEAN_UP code

Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agorun-parts: stop providing incompatible short options
Denys Vlasenko [Thu, 28 Feb 2013 09:22:49 +0000 (10:22 +0100)]
run-parts: stop providing incompatible short options

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agorun-parts: add --exit-on-error | -e support
Peter Korsgaard [Thu, 28 Feb 2013 08:59:23 +0000 (09:59 +0100)]
run-parts: add --exit-on-error | -e support

The "big" run-parts supports a handy --exit-on-error to stop execution on
errors, so lets support it as well.

Upstream doesn't have a short option for it, but I've used '-e' for busybox.

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoxz: fix put_unaligned_{l,b}e32
Leonid Lisovskiy [Wed, 27 Feb 2013 17:32:58 +0000 (18:32 +0100)]
xz: fix put_unaligned_{l,b}e32

Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agolineedit: initialize delptr
Shawn J. Goff [Wed, 27 Feb 2013 17:30:05 +0000 (18:30 +0100)]
lineedit: initialize delptr

In vi mode, the 'p' and 'P' commands caused a segfault when nothing had
been put in the buffer yet because the delptr was not initialized.

Signed-off-by: Shawn J. Goff <shawn7400@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoxz: support concatenated .xz streams
Lasse Collin [Wed, 27 Feb 2013 16:26:40 +0000 (17:26 +0100)]
xz: support concatenated .xz streams

function                                             old     new   delta
xz_dec_reset                                           -      77     +77
unpack_xz_stream                                    2402    2397      -5

Signed-off-by: Lasse Collin <lasse.collin@tukaani.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoxz: mention xzminidec.c in README
Lasse Collin [Wed, 27 Feb 2013 15:41:36 +0000 (16:41 +0100)]
xz: mention xzminidec.c in README

Signed-off-by: Lasse Collin <lasse.collin@tukaani.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoxz: fix incorrect XZ_BUF_ERROR
Lasse Collin [Wed, 27 Feb 2013 15:39:56 +0000 (16:39 +0100)]
xz: fix incorrect XZ_BUF_ERROR

xz_dec_run() could incorrectly return XZ_BUF_ERROR if
all of the following was true:

  - The caller knows how many bytes of output to expect
    and only provides that much output space.

  - When the last output bytes are decoded, the
    caller-provided input buffer ends right before
    the LZMA2 end of payload marker. So LZMA2 won't
    provide more output anymore, but it won't know it
    yet and thus won't return XZ_STREAM_END yet.

  - A BCJ filter is in use and it hasn't left any
    unfiltered bytes in the temp buffer. This can happen
    with any BCJ filter, but in practice it's more likely
    with filters other than the x86 BCJ.

This fixes <https://bugzilla.redhat.com/show_bug.cgi?id=735408>
where Squashfs thinks that a valid file system is corrupt.
Thanks to Jindrich Novy for telling me that such a bug report
exists, Phillip Lougher for providing excellent debug info,
and other people on #fedora-ppc.

This also fixes a similar bug in single-call mode where the
uncompressed size of a XZ Block using BCJ + LZMA2 was 0 bytes
and caller provided no output space. Many empty .xz files
don't contain any Blocks and thus don't trigger this bug.

This also tweaks a closely related detail: xz_dec_bcj_run()
could call xz_dec_lzma2_run() to decode into temp buffer when
it was known to be useless. This was harmless although it
wasted a minuscule number of CPU cycles.

Signed-off-by: Lasse Collin <lasse.collin@tukaani.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoxz: fix decoding of LZMA2 streams having no uncompressed data.
Lasse Collin [Wed, 27 Feb 2013 15:38:06 +0000 (16:38 +0100)]
xz: fix decoding of LZMA2 streams having no uncompressed data.

No .xz encoder creates files with empty LZMA2 streams,
but such files would still be valid and decompressors
must accept them.

Note that empty .xz files are a different thing than
empty LZMA2 streams. This bug didn't affect typical .xz
files that had no uncompressed data.

Signed-off-by: Lasse Collin <lasse.collin@tukaani.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agocz: add C++ support to xz.h
Lasse Collin [Wed, 27 Feb 2013 15:37:18 +0000 (16:37 +0100)]
cz: add C++ support to xz.h

Signed-off-by: Lasse Collin <lasse.collin@tukaani.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoxz: remove an empty line from xz_dec_lzma2.c
Lasse Collin [Wed, 27 Feb 2013 15:36:17 +0000 (16:36 +0100)]
xz: remove an empty line from xz_dec_lzma2.c

Signed-off-by: Lasse Collin <lasse.collin@tukaani.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoxz: make bcj_x86_test_msbyte() an inline function
Lasse Collin [Wed, 27 Feb 2013 15:34:06 +0000 (16:34 +0100)]
xz: make bcj_x86_test_msbyte() an inline function

Signed-off-by: Lasse Collin <lasse.collin@tukaani.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoxz: add a comment about using uint32_t as vli_type
Lasse Collin [Wed, 27 Feb 2013 15:32:03 +0000 (16:32 +0100)]
xz: add a comment about using uint32_t as vli_type

Signed-off-by: Lasse Collin <lasse.collin@tukaani.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoxz: avoid "NOTE:" in xz.h
Lasse Collin [Wed, 27 Feb 2013 15:28:33 +0000 (16:28 +0100)]
xz: avoid "NOTE:" in xz.h

Signed-off-by: Lasse Collin <lasse.collin@tukaani.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoxz: update README
Lasse Collin [Wed, 27 Feb 2013 15:26:03 +0000 (16:26 +0100)]
xz: update README

Signed-off-by: Lasse Collin <lasse.collin@tukaani.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoxz: omit explicit \0 from HEADER_MAGIC
Lasse Collin [Wed, 27 Feb 2013 15:23:05 +0000 (16:23 +0100)]
xz: omit explicit \0 from HEADER_MAGIC

Signed-off-by: Lasse Collin <lasse.collin@tukaani.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoFix move_to_unaligned16
Denys Vlasenko [Wed, 27 Feb 2013 14:49:38 +0000 (15:49 +0100)]
Fix move_to_unaligned16

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agomdev: improve $SEQ handling; improve debug logging
Denys Vlasenko [Wed, 27 Feb 2013 09:51:41 +0000 (10:51 +0100)]
mdev: improve $SEQ handling; improve debug logging

Sequential run of concurrent mdev's was too simplistic:
they waited for /dev/mdev.seq to match. This could sometimes
cause cumulative loss of time on the order of a second.

Added SIGCHLD signaling from exiting mdev to all other mdev's.
Added debugging required to see that code actually works as intended.

Example of /dev/mdev.log (with "woken up" elevated from dbg lvl 3 to 2):

mdev[1023]: first seq written
     ^^^^ seq, not pid
mdev[1023]: 35.022395 ACTION:add SUBSYSTEM:module DEVNAME:(null) DEVPATH:/module/lib80211
mdev[1023]: rule matched, line -1
                          ^^^^^^^ means "default rule"
mdev[1023]: 35.022676 exiting
            ^^^^^^^^^ second,usec timestamp
mdev[1024]: 35.069691 ACTION:add SUBSYSTEM:vc DEVNAME:vcs9 DEVPATH:/devices/virtual/vc/vcs9
mdev[1024]: dev 7,9
mdev[1025]: 35.069889 waiting for '1024'
mdev[1026]: 35.069946 waiting for '1024'
mdev[1027]: 35.070151 waiting for '1024'
mdev[1024]: rule matched, line -1
mdev[1024]: mknod vcs9 (7,9) 20660 0:0
mdev[1024]: 35.070346 exiting
mdev[1025]: woken up
mdev[1026]: woken up
mdev[1025]: 35.071213 ACTION:add SUBSYSTEM:vc DEVNAME:vcsa9 DEVPATH:/devices/virtual/vc/vcsa9
            ^^^^^^^^^ took only a millisecond to start running after prev mdev exited
mdev[1025]: dev 7,137
mdev[1027]: woken up
mdev[1025]: rule matched, line -1
mdev[1025]: mknod vcsa9 (7,137) 20660 0:0
mdev[1025]: 35.072109 exiting

function                                             old     new   delta
mdev_main                                            849    1372    +523
curtime                                                -      59     +59
dirAction                                             87     134     +47
static.ts                                              -       8      +8
keywords                                              19      12      -7
make_device                                         2189    2119     -70

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoudhcpc: tweak math shell style with the metric var
Mike Frysinger [Wed, 27 Feb 2013 06:05:34 +0000 (01:05 -0500)]
udhcpc: tweak math shell style with the metric var

Some shells (like dash) are lame and omit the POSIX increment/decrement
feature (because it is listed as optional).  Tweak the shell script to
work in all POSIX variants.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
11 years agoudhcpc: support resolv.conf symlinks
Mike Frysinger [Wed, 27 Feb 2013 06:01:43 +0000 (01:01 -0500)]
udhcpc: support resolv.conf symlinks

Often it is desirable to have /etc/ be on read-only storage (well, the
whole rootfs) but have things like /etc/resolv.conf be symlinks to a
writable location.  Tweak the simple script to support that.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
11 years agomdev: add environment variable match
Denys Vlasenko [Mon, 25 Feb 2013 23:40:46 +0000 (00:40 +0100)]
mdev: add environment variable match

function                                             old     new   delta
make_device                                         1998    2189    +191
clean_up_cur_rule                                     61      96     +35
dirAction                                             75      87     +12
mdev_main                                            838     849     +11
packed_usage                                       29272   29273      +1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 5/0 up/down: 250/0)             Total: 250 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agomove endofname() to libbb
Denys Vlasenko [Mon, 25 Feb 2013 23:36:53 +0000 (00:36 +0100)]
move endofname() to libbb

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agotail: make help text for -n +N syntax more correct
Denys Vlasenko [Mon, 25 Feb 2013 06:24:44 +0000 (07:24 +0100)]
tail: make help text for -n +N syntax more correct

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agohead: support -n -NUM and -c -NUM
Denys Vlasenko [Mon, 25 Feb 2013 00:26:09 +0000 (01:26 +0100)]
head: support -n -NUM and -c -NUM

function                                             old     new   delta
head_main                                            406     832    +426
packed_usage                                       29234   29252     +18
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 444/0)             Total: 444 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agohead,tail: use common suffix struct. simplify help text.
Denys Vlasenko [Mon, 25 Feb 2013 00:24:32 +0000 (01:24 +0100)]
head,tail: use common suffix struct. simplify help text.

function                                             old     new   delta
head_tail_suffixes                                     -      32     +32
head_main                                            415     406      -9
packed_usage                                       29252   29234     -18
tail_suffixes                                         32       -     -32
head_suffixes                                         32       -     -32
------------------------------------------------------------------------------
(add/remove: 2/2 grow/shrink: 0/2 up/down: 32/-91)            Total: -59 bytes
   text    data     bss     dec     hex filename
 890474     497    7584  898555   db5fb busybox_old
 890415     497    7584  898496   db5c0 busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agorpm: unmap rpm file before working with next one
Denys Vlasenko [Wed, 20 Feb 2013 15:01:48 +0000 (16:01 +0100)]
rpm: unmap rpm file before working with next one

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agorpm: stop using statics; move main() to the end of the source file
Denys Vlasenko [Wed, 20 Feb 2013 15:01:10 +0000 (16:01 +0100)]
rpm: stop using statics; move main() to the end of the source file

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agorpm: use "create+rename" method of replacing existing files
Denys Vlasenko [Wed, 20 Feb 2013 14:58:42 +0000 (15:58 +0100)]
rpm: use "create+rename" method of replacing existing files

Users were reporting getting errors like
"ls: error while loading shared libraries: libc.so.6: ELF load command past end of file"
while rpm was unpacking glibc tarball.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agorpm: make -ql display more compatible; improve help text
Denys Vlasenko [Wed, 20 Feb 2013 14:57:39 +0000 (15:57 +0100)]
rpm: make -ql display more compatible; improve help text

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agofdisk_sun: fix partition alignment
Aaro Koskinen [Sat, 9 Feb 2013 19:12:26 +0000 (21:12 +0200)]
fdisk_sun: fix partition alignment

When the display unit is sectors, the partition alignment will convert
the partition start to a wrong unit (it should always be in sectors). Fix
this.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agofdisk_sun: fix corrupted partition data with blank disk
Aaro Koskinen [Sat, 9 Feb 2013 19:12:25 +0000 (21:12 +0200)]
fdisk_sun: fix corrupted partition data with blank disk

After creating Sun disk label for the first time for a blank disk,
the partition table appears corrupted because current_label_type will
never get set to a proper type. Fix this by calling check_sun_label()
after BusyBox has created the label.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agovasprintf: return -1 on strdup failure
Denys Vlasenko [Sun, 10 Feb 2013 22:03:38 +0000 (23:03 +0100)]
vasprintf: return -1 on strdup failure

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agovasprintf: do not use xmalloc, it will deadlock on OOM
Denys Vlasenko [Thu, 7 Feb 2013 15:06:54 +0000 (16:06 +0100)]
vasprintf: do not use xmalloc, it will deadlock on OOM

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agomdev: chdir back to /dev after trying to read firmware
Denys Vlasenko [Mon, 4 Feb 2013 22:35:27 +0000 (23:35 +0100)]
mdev: chdir back to /dev after trying to read firmware

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoarp: code shrink
Denys Vlasenko [Mon, 4 Feb 2013 15:18:58 +0000 (16:18 +0100)]
arp: code shrink

function                                             old     new   delta
packed_usage                                       29257   29252      -5
arp_main                                            1487    1471     -16

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoarp: fix -H/-t handling.
Kuleshov Aleksey [Mon, 4 Feb 2013 14:14:20 +0000 (15:14 +0100)]
arp: fix -H/-t handling.

While at it, shrank code.
function                                             old     new   delta
arp_main                                            1558    1487     -71

Signed-off-by: Kuleshov Aleksey <rndfax@yandex.ru>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agomdev: extend debug logging output
Denys Vlasenko [Wed, 30 Jan 2013 15:51:22 +0000 (16:51 +0100)]
mdev: extend debug logging output

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoudhcpc6: fix port numbers used if !FEATURE_UDHCP_PORT
Denys Vlasenko [Mon, 28 Jan 2013 14:25:35 +0000 (15:25 +0100)]
udhcpc6: fix port numbers used if !FEATURE_UDHCP_PORT

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agotestsuite/du/du-k-works: fix false positive
Kang Kai [Mon, 28 Jan 2013 13:02:51 +0000 (14:02 +0100)]
testsuite/du/du-k-works: fix false positive

Signed-off-by: Kang Kai <kai.kang@windriver.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoflashcp: trivial code shrink
Denys Vlasenko [Mon, 28 Jan 2013 11:26:29 +0000 (12:26 +0100)]
flashcp: trivial code shrink

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agops: seconds_since_boot: uint64_t -> ulong
Denys Vlasenko [Sat, 26 Jan 2013 13:21:15 +0000 (14:21 +0100)]
ps: seconds_since_boot: uint64_t -> ulong

Even if long is 32-bit, 4 billion second uptime isn't likely :)

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agogetopt: improve help text; code shrink
Denys Vlasenko [Thu, 24 Jan 2013 10:36:00 +0000 (11:36 +0100)]
getopt: improve help text; code shrink

function                                             old     new   delta
generate_output                                      356     351      -5
packed_usage                                       29271   29257     -14

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoflashcp: pad output to BUFSIZE. Hopefully closes 5882
Denys Vlasenko [Wed, 23 Jan 2013 10:41:22 +0000 (11:41 +0100)]
flashcp: pad output to BUFSIZE. Hopefully closes 5882

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agounzip: add missing fflush; code shrink
Denys Vlasenko [Tue, 22 Jan 2013 10:16:08 +0000 (11:16 +0100)]
unzip: add missing fflush; code shrink

function                                             old     new   delta
my_fgets80                                             -      41     +41
unzip_main                                          2291    2242     -49

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agomount: whitespace fix. no code changes
Denys Vlasenko [Tue, 22 Jan 2013 10:00:45 +0000 (11:00 +0100)]
mount: whitespace fix. no code changes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years ago*: reuse more strings
Denys Vlasenko [Tue, 22 Jan 2013 09:13:52 +0000 (10:13 +0100)]
*: reuse more strings

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agops: fix sscanf format specifier (%l); make uptime unsigned
Denys Vlasenko [Tue, 22 Jan 2013 09:07:23 +0000 (10:07 +0100)]
ps: fix sscanf format specifier (%l); make uptime unsigned

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoStart 1.22.0 development cycle
Denys Vlasenko [Mon, 21 Jan 2013 07:56:21 +0000 (08:56 +0100)]
Start 1.22.0 development cycle

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoBump version to 1.21.0 1_21_0
Denys Vlasenko [Mon, 21 Jan 2013 07:51:23 +0000 (08:51 +0100)]
Bump version to 1.21.0

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agofix testsuite false positive
Denys Vlasenko [Mon, 21 Jan 2013 07:28:37 +0000 (08:28 +0100)]
fix testsuite false positive

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agomdev: fix mode of dir1 in =dir1/dir2/file rule
Denys Vlasenko [Mon, 21 Jan 2013 00:22:12 +0000 (01:22 +0100)]
mdev: fix mode of dir1 in =dir1/dir2/file rule

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoifconfig: do not accept "ifconfig eth0 up 1.2.3.4/17" (ip with mask). Closes 5786
Denys Vlasenko [Sun, 20 Jan 2013 17:10:12 +0000 (18:10 +0100)]
ifconfig: do not accept "ifconfig eth0 up 1.2.3.4/17" (ip with mask). Closes 5786

function                                             old     new   delta
ifconfig_main                                       1221    1237     +16

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agogrep: fix grep -Fw not respecting the -w option. Closes 5792
Denys Vlasenko [Sun, 20 Jan 2013 15:57:19 +0000 (16:57 +0100)]
grep: fix grep -Fw not respecting the -w option. Closes 5792

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agosyslogd: do not segfault on parse error when using default config. Closes 5762
Denys Vlasenko [Sun, 20 Jan 2013 15:05:41 +0000 (16:05 +0100)]
syslogd: do not segfault on parse error when using default config. Closes 5762

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agosha3: code shrink
Denys Vlasenko [Sat, 19 Jan 2013 23:38:09 +0000 (00:38 +0100)]
sha3: code shrink

function                                             old     new   delta
sha3_hash                                            155     101     -54

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agosyslogd: convert dummy functions to statics and get rid of IF_FEATURE_* checks
Peter Korsgaard [Sun, 6 Jan 2013 12:11:04 +0000 (13:11 +0100)]
syslogd: convert dummy functions to statics and get rid of IF_FEATURE_* checks

As suggested by Mike. No bloat-o-meter difference, but a bit nicer to look at.
We cannot convert the call to log_to_shmem() as it checks for G.shbuf outside
the function, and G.shbuf is only available when IPC support is enabled.

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agodc: code shrink
Denys Vlasenko [Fri, 18 Jan 2013 12:30:13 +0000 (13:30 +0100)]
dc: code shrink

function                                             old     new   delta
stack_machine                                        103     101      -2
operators                                            176     168      -8

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoash: revert wrong "fix" for an apparent memory leak. Closes 5822
Denys Vlasenko [Thu, 17 Jan 2013 12:02:27 +0000 (13:02 +0100)]
ash: revert wrong "fix" for an apparent memory leak. Closes 5822

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agocode shrink
Denys Vlasenko [Thu, 17 Jan 2013 10:02:21 +0000 (11:02 +0100)]
code shrink

function                                             old     new   delta
applet_name_compare                                   36      31      -5
find_applet_by_name                                   43      25     -18

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agofix a typo in config help text. Closes 5714
Denys Vlasenko [Thu, 17 Jan 2013 09:24:51 +0000 (10:24 +0100)]
fix a typo in config help text. Closes 5714

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agomount: fix -o user=foo mishandling, fix unc= generation, add prefixpath=
Bernhard Reutner-Fischer [Thu, 17 Jan 2013 01:30:35 +0000 (02:30 +0100)]
mount: fix -o user=foo mishandling, fix unc= generation, add prefixpath=

function                                             old     new   delta
singlemount                                         1019    1049     +30
packed_usage                                       29252   29257      +5
parse_mount_options                                  230     232      +2
mount_option_str                                     337     338      +1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/0 up/down: 38/0)               Total: 38 bytes

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agosha3: s/sha3_process_block76/sha3_process_block72/
Denys Vlasenko [Wed, 16 Jan 2013 11:23:23 +0000 (12:23 +0100)]
sha3: s/sha3_process_block76/sha3_process_block72/

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agosha3: rename KeccakF->sha3_process_block76.
Denys Vlasenko [Wed, 16 Jan 2013 01:20:31 +0000 (02:20 +0100)]
sha3: rename KeccakF->sha3_process_block76.

This brings the naming more in line with other hashes.
Pulled most statics and constants into it.
Also noticed that two byte arrays are 1 element too big.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agomount: add unc option to CIFS mount (needed for Linux 3.4+)
Martin Santesson [Tue, 15 Jan 2013 23:47:19 +0000 (00:47 +0100)]
mount: add unc option to CIFS mount (needed for Linux 3.4+)

unc option for CIFS mount is mandatory after CIFS option parsing
was rewritten in Linux 3.4

Signed-off-by: Martin Santesson <martinsn@axis.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agosha3: cache ctx->bytes_queued
Denys Vlasenko [Tue, 15 Jan 2013 21:19:24 +0000 (22:19 +0100)]
sha3: cache ctx->bytes_queued

function                                             old     new   delta
sha3_hash                                            171     155     -16

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agosha3: remove two "small code" codepaths: I can't reproduce code size win on them...
Denys Vlasenko [Tue, 15 Jan 2013 21:07:48 +0000 (22:07 +0100)]
sha3: remove two "small code" codepaths: I can't reproduce code size win on them anymore

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agosha3: tweak choice of a fast code path for 64-bit
Denys Vlasenko [Tue, 15 Jan 2013 20:50:41 +0000 (21:50 +0100)]
sha3: tweak choice of a fast code path for 64-bit

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agosha3: cosmetic tweaks to various names, comments. No logic changes.
Denys Vlasenko [Tue, 15 Jan 2013 18:52:30 +0000 (19:52 +0100)]
sha3: cosmetic tweaks to various names, comments. No logic changes.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agosha3: code shrink
Denys Vlasenko [Tue, 15 Jan 2013 15:27:39 +0000 (16:27 +0100)]
sha3: code shrink

function                                             old     new   delta
KeccakF                                             1053    1078     +25
KeccakF_RoundConstants                               192      48    -144

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agosha3: code shrink
Denys Vlasenko [Tue, 15 Jan 2013 14:22:30 +0000 (15:22 +0100)]
sha3: code shrink

function                                             old     new   delta
KeccakF                                             1064    1053     -11

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agosha3: another speedup for SHA3_SMALL=0 case
Denys Vlasenko [Tue, 15 Jan 2013 13:47:05 +0000 (14:47 +0100)]
sha3: another speedup for SHA3_SMALL=0 case

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agowhitespace fixes. no code changes
Denys Vlasenko [Tue, 15 Jan 2013 12:58:01 +0000 (13:58 +0100)]
whitespace fixes. no code changes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agosha3: make size/speed optimization decision configurable
Denys Vlasenko [Tue, 15 Jan 2013 00:12:26 +0000 (01:12 +0100)]
sha3: make size/speed optimization decision configurable

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agowhitespace cleanup. no code changes
Denys Vlasenko [Mon, 14 Jan 2013 14:57:44 +0000 (15:57 +0100)]
whitespace cleanup. no code changes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agosha3sum: new applet
Lauri Kasanen [Mon, 14 Jan 2013 04:20:50 +0000 (05:20 +0100)]
sha3sum: new applet

function                                             old     new   delta
KeccakF                                                -     496    +496
KeccakF_RoundConstants                                 -     192    +192
sha3_hash                                              -     171    +171
sha3_end                                               -      40     +40
hash_file                                            274     299     +25
KeccakF_RotationConstants                              -      25     +25
KeccakF_PiLane                                         -      25     +25
packed_usage                                       29213   29232     +19
sha3_begin                                             -      18     +18
KeccakF_Mod5                                           -      10     +10
applet_names                                        2445    2453      +8
applet_main                                         1420    1424      +4
applet_nameofs                                       710     712      +2
------------------------------------------------------------------------------
(add/remove: 8/0 grow/shrink: 9/7 up/down: 1049/-54)         Total: ~995 bytes

Signed-off-by: Lauri Kasanen <curaga@operamail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agontpd: fix incorrect m_status field in outgoing packets. Closes 5120
Paul Marks [Mon, 14 Jan 2013 01:39:10 +0000 (02:39 +0100)]
ntpd: fix incorrect m_status field in outgoing packets. Closes 5120

When using busybox ntpd with an NTPv3 client and NTPv4 server (or vice
versa), the version numbers can be incorrectly ORed together, yielding
the bogus value of "NTPv7".  This makes ntpd unusable with clients
such as Chrony and Windows "Internet Time".

This patch avoids the version mangling, by copying only the Leap
Indicator bits from the server's status field.

Signed-off-by: Paul Marks <paul@pmarks.net>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoRemove redundant 'config FEATURE_VOLUMEID_SQUASHFS'
Denys Vlasenko [Mon, 14 Jan 2013 01:24:27 +0000 (02:24 +0100)]
Remove redundant 'config FEATURE_VOLUMEID_SQUASHFS'

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agovolume_id: add squashfs detection
Sven-Göran Bergh [Mon, 14 Jan 2013 01:21:41 +0000 (02:21 +0100)]
volume_id: add squashfs detection

function                                             old     new   delta
volume_id_probe_squashfs                               -      74     +74
fs1                                                   12      16      +4

Signed-off-by: Sven-Göran Bergh <sgb@systemasis.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agowhitespace fixes. no code changes
Denys Vlasenko [Mon, 14 Jan 2013 00:34:48 +0000 (01:34 +0100)]
whitespace fixes. no code changes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agovolume_id: uuid_format small code shrink
Sven-Göran Bergh [Sun, 13 Jan 2013 23:50:49 +0000 (00:50 +0100)]
volume_id: uuid_format small code shrink

function                                             old     new   delta
volume_id_set_uuid                                   318     300     -18

Signed-off-by: Sven-Göran Bergh <sgb@systemasis.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agovolume_id: display hfs[+] 128-bit UUID properly
Sven-Göran Bergh [Sun, 13 Jan 2013 23:37:00 +0000 (00:37 +0100)]
volume_id: display hfs[+] 128-bit UUID properly

Signed-off-by: Sven-Göran Bergh <sgb@systemasis.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoblkid: add type display for hfsplus
Sven-Göran Bergh [Sun, 13 Jan 2013 23:35:31 +0000 (00:35 +0100)]
blkid: add type display for hfsplus

Signed-off-by: Sven-Göran Bergh <sgb@systemasis.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agosyslogd: add option to log to Linux kernel printk buffer
Peter Korsgaard [Sat, 5 Jan 2013 23:07:19 +0000 (00:07 +0100)]
syslogd: add option to log to Linux kernel printk buffer

Why invent our own shared memory circular buffer when the kernel has a
perfectly fine one already?

This can be used as a smaller/simpler alternative to the syslogd IPC support
(as IPC shmem/klogd/logread aren't needed), while also allowing centralised
logging of everything (kernel messages, userspace bootup and syslog)
when used together with ttyprintk.

Notice that kernel 3.5+ is needed to store syslog facility in printk buffer,
otherwise only the priority is stored.

bloat-o-meter compared to IPC+klogd+logread:
function                                             old     new   delta
get_linux_version_code                                 -      84     +84
lbb_prepare                                           25      90     +65
applet_nameofs                                         6       -      -6
static.stdout@@GLIBC_2                                 8       -      -8
applet_names                                          23       9     -14
bb_msg_standard_output                                16       -     -16
init_sem                                              18       -     -18
xatoull_range                                         19       -     -19
overlapping_strcpy                                    21       -     -21
init_data                                             56      32     -24
applet_main                                           24       -     -24
main                                                 124      99     -25
full_write2_str                                       26       -     -26
error_exit                                            26       -     -26
bb_basename                                           30       -     -30
sem_up                                                32       -     -32
interrupted                                           35       -     -35
fflush_stdout_and_exit                                38       -     -38
bb_banner                                             46       -     -46
find_applet_by_name                                   59       -     -59
bb_signals_recursive_norestart                        90       -     -90
run_applet_no_and_exit                               104       -    -104
timestamp_and_log                                    651     523    -128
syslogd_main                                         798     581    -217
xstrtoull_range_sfx                                  267       -    -267
run_applet_and_exit                                  432       -    -432
klogd_main                                           490       -    -490
logread_main                                         508       -    -508
.rodata                                             1870     937    -933
bb_common_bufsiz1                                   8193       -   -8193
------------------------------------------------------------------------------
(add/remove: 2/26 grow/shrink: 1/6 up/down: 149/-11829)    Total: -11680 bytes

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
11 years agoklogd: handle multi-char log levels
Peter Korsgaard [Sat, 5 Jan 2013 23:07:18 +0000 (00:07 +0100)]
klogd: handle multi-char log levels

Since Linux 3.5 (7ff9554bb5: printk: convert byte-buffer to variable-length
record buffer), klog buffer can now contain log lines with multi-char
loglevel indicators (<[0-9]+>) - So use strtoul to parse it.

function                                             old     new   delta
klogd_main                                           490     525     +35
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/0 up/down: 35/0)               Total: 35 bytes

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
11 years agodmesg: handle multi-char log levels
Peter Korsgaard [Sat, 5 Jan 2013 23:07:17 +0000 (00:07 +0100)]
dmesg: handle multi-char log levels

Since Linux 3.5 (7ff9554bb5: printk: convert byte-buffer to variable-length
record buffer), klog buffer can now contain log lines with multi-char
loglevel indicators (<[0-9]+>) - So we can no longer just skip 3 bytes.

Instead skip past the terminating '>' like util-linux does.

function                                             old     new   delta
dmesg_main                                           266     280     +13
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/0 up/down: 13/0)               Total: 13 bytes

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
11 years agopowertop: fix error message
Lauri Hintsala [Fri, 4 Jan 2013 08:51:57 +0000 (10:51 +0200)]
powertop: fix error message

Application tries to use timer_stats module instead of cpufreq_stats.
Error message is printed if opening of the file /proc/timer_stats fails.

Signed-off-by: Lauri Hintsala <lauri.hintsala@bluegiga.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
11 years agoifenslave: fix missing close paren
Mike Frysinger [Wed, 26 Dec 2012 22:12:26 +0000 (17:12 -0500)]
ifenslave: fix missing close paren

Reported-by: David J Cozatt <ygdrasil@comcast.net>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
11 years agoCONFIG_PID_FILE_PATH: new configuration option for pidfile paths
Anthony G. Basile [Mon, 10 Dec 2012 19:49:39 +0000 (14:49 -0500)]
CONFIG_PID_FILE_PATH: new configuration option for pidfile paths

We set a default path for the directory where pidfiles are create
when FEATURE_PIDFILE is selected.  The default has no effect on
applets which must specify a pidfile path on the command line to
run, and it can be overridden by applets which optionally allow
the user to specify the pidfile path.

We also add pidfile write/remove support for klogd, ntpd and watchdog.
For syslogd, we add a missing remove_pidfile() for better cleanup
on daemon exit.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
11 years agodu: document incompatibility with standard tool
Denys Vlasenko [Fri, 14 Dec 2012 16:14:11 +0000 (17:14 +0100)]
du: document incompatibility with standard tool

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agodecompress_uncompress: comment out a bigger chunk of debug code
Denys Vlasenko [Wed, 5 Dec 2012 10:08:30 +0000 (11:08 +0100)]
decompress_uncompress: comment out a bigger chunk of debug code

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agodecompress_uncompress: comment out debug printout on corrupted data
Denys Vlasenko [Wed, 5 Dec 2012 00:06:05 +0000 (01:06 +0100)]
decompress_uncompress: comment out debug printout on corrupted data

99% plus of all people who'll get corrupted archive wouldn't bother
debugging it. The rest can uncomment the code.

function                                             old     new   delta
unpack_Z_stream                                     1304    1234     -70

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agodecompress_uncompress: move 'code' variable into loop - sole user
Denys Vlasenko [Wed, 5 Dec 2012 00:04:54 +0000 (01:04 +0100)]
decompress_uncompress: move 'code' variable into loop - sole user

Apparently, gcc does this optimization itself, since generated code is the same.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoash: fix a memory leak
Jon Tollefson [Tue, 13 Nov 2012 18:26:53 +0000 (19:26 +0100)]
ash: fix a memory leak

The script which triggers the leak:

while true
  do
    while true
      do
        break;
    done</dev/null
done

Signed-off-by: Jon Tollefson <kniht@linux.vnet.ibm.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>