oweals/busybox.git
11 years agosendmail: don't mangle e-mail headers
Aaro Koskinen [Sun, 24 Feb 2013 22:45:07 +0000 (00:45 +0200)]
sendmail: don't mangle e-mail headers

Leave the original To: and Cc: headers untouched, when we try to extract
addresses from them.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agosendmail: avoid sending mail to wrong addresses
Aaro Koskinen [Sun, 24 Feb 2013 22:45:06 +0000 (00:45 +0200)]
sendmail: avoid sending mail to wrong addresses

If we get an address we cannot parse properly, we currently just strip
the unknown characters and still try to send it. This is considered
harmful as the resulting address may still be valid but different from
what the user originally intended.

Instead, skip sending to an address we cannot fully understand and
print the characters what we have scanned so far. Leading and trailing
whitespace is allowed and silently stripped.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agomkfs_minix: use get_volume_size_in_bytes instead of local version
Denys Vlasenko [Mon, 18 Mar 2013 01:26:58 +0000 (02:26 +0100)]
mkfs_minix: use get_volume_size_in_bytes instead of local version

Hopefully this also closes 4730

function                                             old     new   delta
valid_offset                                          55       -     -55
mkfs_minix_main                                     2925    2674    -251
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 0/1 up/down: 0/-306)           Total: -306 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agomdev: fix build failure
Denys Vlasenko [Sun, 17 Mar 2013 22:01:17 +0000 (23:01 +0100)]
mdev: fix build failure

The error was "error: 'struct globals' has no member named 'parser'"

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agonc: fix build failure ("subscripted value is neither array nor pointer")
Denys Vlasenko [Sun, 17 Mar 2013 21:59:51 +0000 (22:59 +0100)]
nc: fix build failure ("subscripted value is neither array nor pointer")

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoash: add comment about failures in source builtin. No code changes.
Denys Vlasenko [Sun, 17 Mar 2013 13:25:22 +0000 (14:25 +0100)]
ash: add comment about failures in source builtin. No code changes.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agohush: source builtin should override $N only if it has args
Denys Vlasenko [Sun, 17 Mar 2013 13:11:04 +0000 (14:11 +0100)]
hush: source builtin should override $N only if it has args

function                                             old     new   delta
builtin_source                                       174     184     +10

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoash: read $HOME/.profile instead of $(pwd)/.profile
Stefan Hellermann [Fri, 15 Mar 2013 01:45:50 +0000 (02:45 +0100)]
ash: read $HOME/.profile instead of $(pwd)/.profile

ash --login should read ~/.profile instead of .profile in the current
directory. I noticed it while trying to figure out why /root/.profile
is only read sometimes.

function                                             old     new   delta
ash_main                                            1374    1398     +24

Signed-off-by: Stefan Hellermann <stefan@the2masters.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoash: move code to allow setting $HOME in /etc/profile
Stefan Hellermann [Sun, 3 Mar 2013 14:29:32 +0000 (15:29 +0100)]
ash: move code to allow setting $HOME in /etc/profile

move HISTFILE=$HOME/.ash_history below reading /etc/profile,
so that /etc/profile can set $HOME. HOME can be unset when
directly invoking ash --login from init without going through
getty.

Signed-off-by: Stefan Hellermann <stefan@the2masters.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agovi: code shrink
Denys Vlasenko [Fri, 15 Mar 2013 01:17:29 +0000 (02:17 +0100)]
vi: code shrink

function                                             old     new   delta
status_line_bold_errno                                 -      32     +32
colon                                               2891    2873     -18
file_insert                                          354     313     -41
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/2 up/down: 32/-59)            Total: -27 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agovi: fix adjustment of buffer on partial file read
Ron Yorston [Thu, 7 Mar 2013 20:37:23 +0000 (20:37 +0000)]
vi: fix adjustment of buffer on partial file read

The second argument to text_hole_delete was incorrect: it should
be a pointer to the end of the hole.

Signed-off-by: Ron Yorston <rmy@tigress.co.uk>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agosysklogd: trim help text
Denys Vlasenko [Fri, 15 Mar 2013 00:50:35 +0000 (01:50 +0100)]
sysklogd: trim help text

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agotraceroute: free some memory allocated by xzalloc()
Guilherme Maciel Ferreira [Fri, 8 Mar 2013 19:50:51 +0000 (16:50 -0300)]
traceroute: free some memory allocated by xzalloc()

Signed-off-by: Guilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoflash_eraseall: implement -N
Alexander Shiyan [Thu, 14 Mar 2013 23:42:39 +0000 (00:42 +0100)]
flash_eraseall: implement -N

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agonanddump: fix build if nandwrite isn't enabled
Alexander Shiyan [Thu, 14 Mar 2013 23:27:41 +0000 (00:27 +0100)]
nanddump: fix build if nandwrite isn't enabled

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoping[6]: accept and ignore -n. Code shrink
Denys Vlasenko [Thu, 14 Mar 2013 23:11:35 +0000 (00:11 +0100)]
ping[6]: accept and ignore -n. Code shrink

function                                             old     new   delta
print_stats_and_exit                                 270     232     -38

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoudhcpd: also add -I ADDR to help text
Denys Vlasenko [Thu, 14 Mar 2013 01:18:52 +0000 (02:18 +0100)]
udhcpd: also add -I ADDR to help text

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoudhcpd: add -I LOCAL_ADDR option
Denys Vlasenko [Wed, 13 Mar 2013 21:27:37 +0000 (22:27 +0100)]
udhcpd: add -I LOCAL_ADDR option

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoawk: Fix handling of functions with empty body
Bernhard Reutner-Fischer [Wed, 6 Mar 2013 20:01:05 +0000 (21:01 +0100)]
awk: Fix handling of functions with empty body

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
11 years agolosetup: fix util-linux compatibility
Mandeep Singh Baines [Tue, 5 Mar 2013 00:33:12 +0000 (16:33 -0800)]
losetup: fix util-linux compatibility

Added -a support. Also made sure -f works as follows:

losetup [-r] [-o offset] {-f|loopdev} file

Removed support for 'losetup -r' with no arguments.

Signed-off-by: Mandeep Singh Baines <msb@chromium.org>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
11 years agoreadlink: note that our -f is really -e
Mike Frysinger [Tue, 12 Mar 2013 15:38:03 +0000 (11:38 -0400)]
readlink: note that our -f is really -e

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
11 years agoreadlink: uClibc supports automatic allocation too now
Mike Frysinger [Tue, 12 Mar 2013 15:14:24 +0000 (11:14 -0400)]
readlink: uClibc supports automatic allocation too now

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
11 years agoplatform: use KERNEL_VERSION to simplify uClibc version checking
Mike Frysinger [Tue, 12 Mar 2013 15:13:22 +0000 (11:13 -0400)]
platform: use KERNEL_VERSION to simplify uClibc version checking

This makes reading the logic (as well as adding new code) a lot simpler,
and fixes one or two cases that were broken due to incorrect sub-version
tests.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
11 years agoudhcpc: use readlink rather than realpath
Mike Frysinger [Tue, 12 Mar 2013 14:48:09 +0000 (10:48 -0400)]
udhcpc: use readlink rather than realpath

The realpath utility requires all paths exist when canonicalizing
symlinks.  If /etc/resolv.conf points to a tmpfs, then it might
not exist initially.  Use `readlink -f` so that we follow all
symlinks that are available.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
11 years agohostid: do not output sign-extended host id. Closes 6056
Denys Vlasenko [Mon, 4 Mar 2013 02:04:38 +0000 (03:04 +0100)]
hostid: do not output sign-extended host id. Closes 6056

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoarchival: note implicit dependencies between lzop & bbunzip
Mike Frysinger [Sun, 3 Mar 2013 05:48:53 +0000 (00:48 -0500)]
archival: note implicit dependencies between lzop & bbunzip

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
11 years agodecompress_unlzma: move function, no code changes
Denys Vlasenko [Fri, 1 Mar 2013 13:48:10 +0000 (14:48 +0100)]
decompress_unlzma: move function, no code changes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agodecompress_unlzma: 10% speedup in "small" code
Denys Vlasenko [Fri, 1 Mar 2013 13:43:07 +0000 (14:43 +0100)]
decompress_unlzma: 10% speedup in "small" code

   text    data     bss     dec     hex filename
   1796       0       0    1796     704 decompress_unlzma.o
   1801       0       0    1801     709 decompress_unlzma.o

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agodecompress_unlzma: make "fast" version a bit smaller
Denys Vlasenko [Fri, 1 Mar 2013 13:37:58 +0000 (14:37 +0100)]
decompress_unlzma: make "fast" version a bit smaller

It is not slower. In fact it seems a tiny bit faster too.

   text    data     bss     dec     hex filename
   2827       0       0    2827     b0b decompress_unlzma.o
   2797       0       0    2797     aed decompress_unlzma.o

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agolzop: fiq -q and OPTION_DECOMPRESS mismatch
Denys Vlasenko [Fri, 1 Mar 2013 07:25:45 +0000 (08:25 +0100)]
lzop: fiq -q and OPTION_DECOMPRESS mismatch

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agobbunzip: fix order of flags vs bit defines
Mike Frysinger [Fri, 1 Mar 2013 02:28:21 +0000 (21:28 -0500)]
bbunzip: fix order of flags vs bit defines

Too much code shuffling.

Reported-by: Mandeep Singh Baines <msb@chromium.org>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
11 years agobbunzip: ignore the -q flag with the decompressors
Mike Frysinger [Thu, 28 Feb 2013 22:21:50 +0000 (17:21 -0500)]
bbunzip: ignore the -q flag with the decompressors

The -q flag is used in shell scripts for suppressing output.
Have our applets swallow the flag for compatibility.

Reported-by: Mandeep Singh Baines <msb@chromium.org>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
11 years agoifupdown: support "source" stanza in /etc/network/interfaces
Denys Vlasenko [Thu, 28 Feb 2013 18:01:28 +0000 (19:01 +0100)]
ifupdown: support "source" stanza in /etc/network/interfaces

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agozcat: fix "zcat FILE" trying to do detection twice
Denys Vlasenko [Thu, 28 Feb 2013 17:37:04 +0000 (18:37 +0100)]
zcat: fix "zcat FILE" trying to do detection twice

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agozcat: if seamless uncompressors are defined, autodetect file's format
Denys Vlasenko [Thu, 28 Feb 2013 17:06:09 +0000 (18:06 +0100)]
zcat: if seamless uncompressors are defined, autodetect file's format

function                                             old     new   delta
bbunpack                                             526     622     +96
packed_usage                                       29335   29341      +6
gunzip_main                                           64      67      +3

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agofix error message on failure to oen /dev/null; fix zcat's help text
Denys Vlasenko [Thu, 28 Feb 2013 17:04:22 +0000 (18:04 +0100)]
fix error message on failure to oen /dev/null; fix zcat's help text

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agocode shrink in check_errors_in_children()
Denys Vlasenko [Thu, 28 Feb 2013 15:38:25 +0000 (16:38 +0100)]
code shrink in check_errors_in_children()

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agopgrep: fix a "missing closing paren" build error
Denys Vlasenko [Thu, 28 Feb 2013 14:51:55 +0000 (15:51 +0100)]
pgrep: fix a "missing closing paren" build error

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