oweals/busybox.git
7 years agosetfiles: fix build failure after common_bufsiz change 1_25_stable
Mike Frysinger [Fri, 9 Dec 2016 23:14:12 +0000 (18:14 -0500)]
setfiles: fix build failure after common_bufsiz change

Commit 47cfbf32fd66563f8c4e09ad6cced6abfbe2fad5 ("*: add most of the
required setup_common_bufsiz() calls") switched this tool over to use
the common_bufsiz logic but missed including the header leading to a
build failure when enabled:
selinux/setfiles.c:80:30: error: 'bb_common_bufsiz1' undeclared (first use in this function)

URL: https://bugs.gentoo.org/600106
Reported-by: Jonas Jelten <jj@stusta.net>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
(cherry picked from commit 1cda8790803a6fb072375c8fa53273333d2d4607)

8 years agoApply post-1.25.0 patches, bump version to 1.25.1 1_25_1
Denys Vlasenko [Fri, 7 Oct 2016 15:11:04 +0000 (17:11 +0200)]
Apply post-1.25.0 patches, bump version to 1.25.1

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoBump version to 1.25.0 1_25_0
Denys Vlasenko [Mon, 20 Jun 2016 22:15:49 +0000 (00:15 +0200)]
Bump version to 1.25.0

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agolibarchive: fix xmalloc_open_zipped_read_close()
Denys Vlasenko [Tue, 21 Jun 2016 00:04:16 +0000 (02:04 +0200)]
libarchive: fix xmalloc_open_zipped_read_close()

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agosetsid: fix broken -c
Denys Vlasenko [Mon, 20 Jun 2016 21:50:26 +0000 (23:50 +0200)]
setsid: fix broken -c

This did not work: setsid sh -c 'anything'

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agotypo fix
Denys Vlasenko [Mon, 20 Jun 2016 14:28:53 +0000 (16:28 +0200)]
typo fix

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoscripts/trylink: libbusybox fix
Denys Vlasenko [Mon, 20 Jun 2016 10:23:35 +0000 (12:23 +0200)]
scripts/trylink: libbusybox fix

gcc 6.1.1 can emit empty line with spaces

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agolibarchive: fix open_zipped()
Denys Vlasenko [Mon, 20 Jun 2016 09:42:00 +0000 (11:42 +0200)]
libarchive: fix open_zipped()

Last commit broke it (on both MMU and NOMMU)

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agolibarchive: fix xmalloc_open_zipped_read_close() on NOMMU
Denys Vlasenko [Mon, 20 Jun 2016 09:06:42 +0000 (11:06 +0200)]
libarchive: fix xmalloc_open_zipped_read_close() on NOMMU

The somewhat new "unpack in memory" code was broken
for xmalloc_open_zipped_read_close() on NOMMU: we seek back
over signature, but then expect it to be already consumed.
Stop seeking back in this case.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agorandomconfig fixes 5: false positive for tar; mount emits corrupted message
Denys Vlasenko [Mon, 20 Jun 2016 09:04:04 +0000 (11:04 +0200)]
randomconfig fixes 5: false positive for tar; mount emits corrupted message

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agomodprobe-small: fix bogus handling of unpack errors
Denys Vlasenko [Mon, 20 Jun 2016 08:59:06 +0000 (10:59 +0200)]
modprobe-small: fix bogus handling of unpack errors

"modprobe minix; echo $?"

Was:
modprobe: corrupted data
modprobe: read error from 'kernel/fs/minix/minix.ko.xz': No such file or directory
modprobe: corrupted data
modprobe: read error from 'kernel/fs/minix/minix.ko.xz': No such file or directory
modprobe: corrupted data
modprobe: read error from 'kernel/fs/minix/minix.ko.xz'
modprobe: 'kernel/fs/minix/minix.ko.xz': Success
0

Now:
modprobe: corrupted data
modprobe: read error from 'kernel/fs/minix/minix.ko.xz'
1

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agorandomconfig fixes 4
Denys Vlasenko [Sun, 19 Jun 2016 23:40:19 +0000 (01:40 +0200)]
randomconfig fixes 4

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agorandomconfig fixes 3
Denys Vlasenko [Sun, 19 Jun 2016 22:36:21 +0000 (00:36 +0200)]
randomconfig fixes 3

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agorandomconfig fixes 2
Denys Vlasenko [Sun, 19 Jun 2016 19:54:04 +0000 (21:54 +0200)]
randomconfig fixes 2

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agorandomconfig fixes
Denys Vlasenko [Sun, 19 Jun 2016 16:15:33 +0000 (18:15 +0200)]
randomconfig fixes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agolibbb: move common code into run_applet_and_exit
Ron Yorston [Tue, 7 Jun 2016 11:12:07 +0000 (12:12 +0100)]
libbb: move common code into run_applet_and_exit

Both calls to run_applet_and_exit are followed by the same code
to print an error message and return status 127.  Remove this
duplication and make run_applet_and_exit static.

function                                             old     new   delta
run_applet_and_exit                                  675     667      -8
main                                                 119      92     -27
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-35)             Total: -35 bytes

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoAllow "busybox <applet>" to work when busybox is disabled
Ron Yorston [Tue, 7 Jun 2016 09:26:24 +0000 (10:26 +0100)]
Allow "busybox <applet>" to work when busybox is disabled

A recent commit made it possible to disable BusyBox's --install
and --list options.  However it also stopped "busybox <applet>
<params>" from working.

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agontpd: retry initial DNS resolution (forever, no timeout for now).
Denys Vlasenko [Mon, 6 Jun 2016 00:26:49 +0000 (02:26 +0200)]
ntpd: retry initial DNS resolution (forever, no timeout for now).

Some users start ntpd on boot, and don't babysit it. If it dies because
DNS is not yet up and therefore NTP servers can't be found, users are
not happy.

Example behavior with a peer name which can't be resolved:

ntpd: bad address 'qwe.rty.ghj.kl'
...5 sec...
ntpd: bad address 'qwe.rty.ghj.kl'
ntpd: bad address 'qwe.rty.ghj.kl'
ntpd: bad address 'qwe.rty.ghj.kl'
ntpd: bad address 'qwe.rty.ghj.kl'
ntpd: bad address 'qwe.rty.ghj.kl'
ntpd: bad address 'qwe.rty.ghj.kl'
ntpd: bad address 'qwe.rty.ghj.kl'
ntpd: bad address 'qwe.rty.ghj.kl'
ntpd: bad address 'qwe.rty.ghj.kl'
...

Based on the patch by Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>

function                                             old     new   delta
resolve_peer_hostname                                  -      81     +81
ntpd_main                                           1130    1061     -69
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/1 up/down: 81/-69)             Total: 12 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agolibbb: fix time parsing of [[CC]YY]MMDDhhmm[.SS]. Closes 8951
Natanael Copa [Thu, 19 May 2016 15:31:59 +0000 (17:31 +0200)]
libbb: fix time parsing of [[CC]YY]MMDDhhmm[.SS]. Closes 8951

If SS is not given a value, it is assumed to be zero.
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/touch.html

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoMake busybox an optional applet
Denys Vlasenko [Tue, 31 May 2016 00:42:49 +0000 (02:42 +0200)]
Make busybox an optional applet

If it's disabled, code shrinks by about 900 bytes:

function                                             old     new   delta
usr_bin                                               10       -     -10
usr_sbin                                              11       -     -11
install_dir                                           20       -     -20
applet_install_loc                                   184       -    -184
run_applet_and_exit                                  686      21    -665
------------------------------------------------------------------------------
(add/remove: 0/4 grow/shrink: 0/1 up/down: 0/-890)           Total: -890 bytes
   text    data     bss     dec     hex filename
 911327     493    7336  919156   e0674 busybox_old
 909848     493    7336  917677   e00ad busybox_unstripped

but busybox executable by itself does not say anything useful:

$ busybox
busybox: applet not found

Based on the patch by Ron Yorston <rmy@pobox.com>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agocp: add -u/--update and --remove-destination
Denys Vlasenko [Thu, 26 May 2016 22:46:38 +0000 (00:46 +0200)]
cp: add -u/--update and --remove-destination

Based on the patch by wdlkmpx@gmail.com

function                                             old     new   delta
copy_file                                           1546    1644     +98
add_partition                                       1270    1362     +92
ask_and_unlink                                        95     133     +38
do_iproute                                           132     157     +25
decode_one_format                                    710     715      +5
cp_main                                              369     374      +5
ubirename_main                                       198     202      +4
read_package_field                                   232     230      -2
bb_make_directory                                    421     412      -9
packed_usage                                       30505   30476     -29
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 7/3 up/down: 267/-40)           Total: 227 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoarping: avoid use of ether_ntoa(). Closes 8926
Denys Vlasenko [Thu, 26 May 2016 19:35:46 +0000 (21:35 +0200)]
arping: avoid use of ether_ntoa(). Closes 8926

This is the only non-debug use of ether_ntoa(). By not using it,
we reduce bss:

function                                             old     new   delta
arping_main                                         1568    1665     +97
static.asc                                            18       -     -18
ether_ntoa                                            57       -     -57
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 1/0 up/down: 97/-75)             Total: 22 bytes
   text    data     bss     dec     hex filename
 911020     493    7352  918865   e0551 busybox_old
 911069     493    7336  918898   e0572 busybox_unstripped

Also, "standard" arping zero-pads MAC. ether_ntoa() does not.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agosed: fix append command to match GNU sed 4.2.1
Denys Vlasenko [Fri, 6 May 2016 16:25:56 +0000 (18:25 +0200)]
sed: fix append command to match GNU sed 4.2.1

This closes one testcase failure

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoflock: merge spawn_and_wait() code patchs for -c and sans-c uses
Denys Vlasenko [Sun, 24 Apr 2016 16:21:32 +0000 (18:21 +0200)]
flock: merge spawn_and_wait() code patchs for -c and sans-c uses

function                                             old     new   delta
flock_main                                           334     319     -15

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoflock: fix -c; improve error handling of fork+exec
Denys Vlasenko [Sun, 24 Apr 2016 16:19:49 +0000 (18:19 +0200)]
flock: fix -c; improve error handling of fork+exec

function                                             old     new   delta
flock_main                                           254     334     +80

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoip: fix problem on mips64 n64 big endian musl systems
Szabolcs Nagy [Sun, 24 Apr 2016 15:39:02 +0000 (17:39 +0200)]
ip: fix problem on mips64 n64 big endian musl systems

Use designated initializers for struct msghdr.
The struct layout is non-portable and musl libc does not match what busybox expects.

Signed-off-by: Szabolcs Nagy <nsz@port70.net>
Tested-by: Waldemar Brodkorb <wbx@openadk.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agosed: understand \n,\r and \t in i and a commands. Closes 8871
Denys Vlasenko [Sun, 24 Apr 2016 14:18:03 +0000 (16:18 +0200)]
sed: understand \n,\r and \t in i and a commands. Closes 8871

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agogenerate_BUFSIZ.sh: yet another tweak
Denys Vlasenko [Sun, 24 Apr 2016 12:13:35 +0000 (14:13 +0200)]
generate_BUFSIZ.sh: yet another tweak

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years ago*: slap on a few ALIGN1/2s where appropriate
Denys Vlasenko [Fri, 22 Apr 2016 16:09:21 +0000 (18:09 +0200)]
*: slap on a few ALIGN1/2s where appropriate

The result of looking at "grep -F -B2 '*fill*' busybox_unstripped.map"

   text    data     bss     dec     hex filename
 829901    4086    1904  835891   cc133 busybox_before
 829665    4086    1904  835655   cc047 busybox

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoscripts/trylink: document DATA_SEGMENT_ALIGN() hack
Denys Vlasenko [Fri, 22 Apr 2016 00:00:04 +0000 (02:00 +0200)]
scripts/trylink: document DATA_SEGMENT_ALIGN() hack

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agogenerate_BUFSIZ.sh: catch BUFSIZE < 1024 also on "big" builds
Denys Vlasenko [Thu, 21 Apr 2016 22:24:53 +0000 (00:24 +0200)]
generate_BUFSIZ.sh: catch BUFSIZE < 1024 also on "big" builds

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agobuild system: fix generate_BUFSIZ.sh to not alternate 1k and malloc builds
Denys Vlasenko [Thu, 21 Apr 2016 21:52:35 +0000 (23:52 +0200)]
build system: fix generate_BUFSIZ.sh to not alternate 1k and malloc builds

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agolibbb: constify *bb_common_bufsiz1 (if it is compiled to be a pointer)
Denys Vlasenko [Thu, 21 Apr 2016 19:47:45 +0000 (21:47 +0200)]
libbb: constify *bb_common_bufsiz1 (if it is compiled to be a pointer)

This lets gcc optimize much better:

   text    data     bss     dec     hex filename
 922846     910   13056  936812   e4b6c busybox_unstripped.nonconst
 920255     910   13056  934221   e414d busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agolibbb: make "COMMON_BUFSIZE = 1024 bytes, the buffer will be malloced" work
Denys Vlasenko [Thu, 21 Apr 2016 19:03:51 +0000 (21:03 +0200)]
libbb: make "COMMON_BUFSIZE = 1024 bytes, the buffer will be malloced" work

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoudhcp: add setup_common_bufsiz() as needed
Denys Vlasenko [Thu, 21 Apr 2016 16:54:36 +0000 (18:54 +0200)]
udhcp: add setup_common_bufsiz() as needed

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years ago*: hopefully all setup_common_bufsiz() are in place
Denys Vlasenko [Thu, 21 Apr 2016 16:38:51 +0000 (18:38 +0200)]
*: hopefully all setup_common_bufsiz() are in place

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years ago*: add most of the required setup_common_bufsiz() calls
Denys Vlasenko [Thu, 21 Apr 2016 16:18:48 +0000 (18:18 +0200)]
*: add most of the required setup_common_bufsiz() calls

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agolibbb: make bb_common_bufsiz1 1 kbyte, add capability to use bss tail for it
Denys Vlasenko [Thu, 21 Apr 2016 14:26:30 +0000 (16:26 +0200)]
libbb: make bb_common_bufsiz1 1 kbyte, add capability to use bss tail for it

The config item is FEATURE_USE_BSS_TAIL. When it is off (default):

function                                             old     new   delta
read_config                                          210     228     +18
doCommands                                          2279    2294     +15
ipneigh_list_or_flush                                763     772      +9
ipaddr_list_or_flush                                1256    1261      +5
display_process_list                                1301    1306      +5
conspy_main                                         1378    1383      +5
do_lzo_compress                                      352     355      +3
do_lzo_decompress                                    565     567      +2
push                                                  46      44      -2
inetd_main                                          2136    2134      -2
uevent_main                                          421     418      -3
addLines                                              97      92      -5
bb_common_bufsiz1                                   8193    1024   -7169
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 8/5 up/down: 62/-7181)        Total: -7119 bytes
   text    data     bss     dec     hex filename
 829850    4086    9080  843016   cdd08 busybox_old
 829901    4086    1904  835891   cc133 busybox_unstripped

FEATURE_USE_BSS_TAIL=y:

read_config                                          210     228     +18
doCommands                                          2279    2294     +15
ipneigh_list_or_flush                                763     772      +9
ipaddr_list_or_flush                                1256    1261      +5
display_process_list                                1301    1306      +5
conspy_main                                         1378    1383      +5
do_lzo_compress                                      352     355      +3
do_lzo_decompress                                    565     567      +2
inetd_main                                          2136    2134      -2
bb_common_bufsiz1                                   8193       -   -8193
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 8/1 up/down: 62/-8195)        Total: -8133 bytes
   text    data     bss     dec     hex filename
 829850    4086    9080  843016   cdd08 busybox_old
 829911    4086     880  834877   cbd3d busybox_unstripped

FIXME: setup_common_bufsiz() calls are missing.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agounzip: shorter code for date/time generation
Denys Vlasenko [Mon, 18 Apr 2016 00:34:29 +0000 (02:34 +0200)]
unzip: shorter code for date/time generation

function                                             old     new   delta
unzip_main                                          2426    2414     -12

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agounzip: better match for "standard" unzip's output; string shrinkage
Denys Vlasenko [Sun, 17 Apr 2016 23:43:24 +0000 (01:43 +0200)]
unzip: better match for "standard" unzip's output; string shrinkage

function                                             old     new   delta
unzip_main                                          2490    2426     -64
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-64)             Total: -64 bytes
   text    data     bss     dec     hex filename
 924008     906   17160  942074   e5ffa busybox_old
 923846     906   17160  941912   e5f58 busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agounzip: fix percent overflow; show "stored" files properly
Denys Vlasenko [Sun, 17 Apr 2016 23:14:05 +0000 (01:14 +0200)]
unzip: fix percent overflow; show "stored" files properly

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agounzip: fix a case where we find wrong CDE. Closes 8821
Denys Vlasenko [Sun, 17 Apr 2016 19:05:34 +0000 (21:05 +0200)]
unzip: fix a case where we find wrong CDE. Closes 8821

function                                             old     new   delta
unzip_main                                          2472    2490     +18

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoash: bash-compatible $'...' shouldn't expand in double quotes
Ron Yorston [Sun, 3 Apr 2016 21:43:14 +0000 (22:43 +0100)]
ash: bash-compatible $'...' shouldn't expand in double quotes

Bash doesn't expand its $'...' construct in double quotes:

   $ echo "$'a\tb'"
   $'a\tb'

Change BusyBox ash to do the same.  This also fixes a problem with
here documents where BusyBox ash gave an incorrect result for:

   $ cat <<EOF
   > '$'
   > EOF
   '$'

Reported-by: Timo Teras <timo.teras@iki.fi>
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoRewrite iteration through applet names to save a few bytes
Ron Yorston [Fri, 8 Apr 2016 10:57:20 +0000 (11:57 +0100)]
Rewrite iteration through applet names to save a few bytes

function                                             old     new   delta
run_applet_and_exit                                  758     755      -3
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-3)               Total: -3 bytes

In standalone shell mode the saving increases to 17 bytes.

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agosed: support "-f -" idiom
Denys Vlasenko [Thu, 7 Apr 2016 22:20:36 +0000 (00:20 +0200)]
sed: support "-f -" idiom

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agounrpm: clean up
Mike Frysinger [Mon, 4 Apr 2016 05:39:17 +0000 (01:39 -0400)]
unrpm: clean up

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
8 years agoundeb: clean up
Mike Frysinger [Mon, 4 Apr 2016 05:35:34 +0000 (01:35 -0400)]
undeb: clean up

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
8 years agosyslogd: minor tweaks to text
Mike Frysinger [Mon, 4 Apr 2016 05:28:32 +0000 (01:28 -0400)]
syslogd: minor tweaks to text

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
8 years agokconfig/lxdialog: get ncurses CFLAGS with pkg-config
Bjørn Forsman [Sun, 14 Sep 2014 10:57:50 +0000 (12:57 +0200)]
kconfig/lxdialog: get ncurses CFLAGS with pkg-config

This makes "make menuconfig" also work on systems where ncurses is not
installed in a standard location (such as on NixOS).

This patch changes ccflags() so that it tries pkg-config first, and only
if pkg-config fails does it go back to the fallback/manual checks. This
is the same algorithm that ldflags() already uses.

Signed-off-by: Bjørn Forsman <bjorn.forsman@gmail.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
8 years agokbuild: Make scripts executable
Michal Marek [Wed, 20 Aug 2014 14:02:59 +0000 (16:02 +0200)]
kbuild: Make scripts executable

The Makefiles call the respective interpreter explicitly, but this makes
it easier to use the scripts manually.

Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
8 years agokconfig/lxdialog: rationalise the include paths where to find {.n}curses{,w}.h
Yann E. MORIN [Fri, 22 Mar 2013 22:12:16 +0000 (23:12 +0100)]
kconfig/lxdialog: rationalise the include paths where to find {.n}curses{,w}.h

The current code does this:

    if [ -f /usr/include/ncursesw/curses.h ]; then
        echo '-I/usr/include/ncursesw -DCURSES_LOC="<ncursesw/curses.h>"'
    elif [ -f /usr/include/ncurses/ncurses.h ]; then
        echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"'
    elif [ -f /usr/include/ncurses/curses.h ]; then
        echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"'
    [...]

This is merely inconsistent:
  - adding the full path to the directory in the -I directive,
  - especially since that path is already a sub-path of the system
    include path,
  - and then repeating the sub-path in the #include directive.

Rationalise each include directive:
  - only use the filename in the #include directive,
  - keep the -I directives: they are always searched for before the
    system include path; this ensures the correct header is used.

Using the -I directives and the filename-only in #include is more in
line with how pkg-config behaves, eg.:
    $ pkg-config --cflags ncursesw
    -I/usr/include/ncursesw

This paves the way for using pkg-config for CFLAGS, too, now we use it
to find the libraries.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
8 years agomenuconfig: optionally use pkg-config to detect ncurses libs
Justin Lecher [Wed, 6 Mar 2013 13:02:01 +0000 (14:02 +0100)]
menuconfig: optionally use pkg-config to detect ncurses libs

When building ncurses with --with-termlib several symbols get moved from
libncurses.so to libtinfo.so. Thus when linking with libncurses.so, one
additionally needs to link with libtinfo.so.

The ncurses pkg-config module will be used to detect the necessary libs for
linking. If not available the old heuristic for detection of the ncurses libs
will be used.

Signed-off-by: Justin Lecher <jlec@gentoo.org>
Tested-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
8 years agomenuconfig: fix extended colors ncurses support
Krzysztof Mazur [Mon, 8 Oct 2012 16:18:22 +0000 (18:18 +0200)]
menuconfig: fix extended colors ncurses support

The ncurses library allows for extended colors. The support for extended
colors support depends on wide-character support. ncurses headers
enable extended colors (NCURSES_EXT_COLORS) only when wide-character
support is enabled (NCURSES_WIDECHAR).

The "make menuconfig" uses wide-character ncursesw library, which can be
compiled with wide-character support, but does not define NCURSES_WIDECHAR
and it's using headers without wide-character (and extended colors) support.

This fixes problems with colors on systems with enabled extended colors
(like PLD Linux). Without this patch "make menuconfig" is hard to use.

Signed-off-by: Krzysztof Mazur <krzysiek@podlesie.net>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
8 years agokbuild: Fix gcc -x syntax
Jean Delvare [Tue, 2 Oct 2012 14:42:36 +0000 (16:42 +0200)]
kbuild: Fix gcc -x syntax

The correct syntax for gcc -x is "gcc -x assembler", not
"gcc -xassembler". Even though the latter happens to work, the former
is what is documented in the manual page and thus what gcc wrappers
such as icecream do expect.

This isn't a cosmetic change. The missing space prevents icecream from
recognizing compilation tasks it can't handle, leading to silent kernel
miscompilations.

Besides me, credits go to Michael Matz and Dirk Mueller for
investigating the miscompilation issue and tracking it down to this
incorrect -x parameter syntax.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Acked-by: Ingo Molnar <mingo@kernel.org>
Cc: stable@vger.kernel.org
Cc: Bernhard Walle <bernhard@bwalle.de>
Cc: Michal Marek <mmarek@suse.cz>
Cc: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
8 years agokconfig: fix check-lxdialog for DLL platforms
Yaakov Selkowitz [Wed, 13 Jun 2012 00:05:15 +0000 (19:05 -0500)]
kconfig: fix check-lxdialog for DLL platforms

Import libraries on Cygwin and MinGW/MSYS use the .dll.a suffix, so
checking this suffix is necessary to make sure ncurses will still be
found when built without static libraries.

Signed-off-by: Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
8 years agokconfig: check ncursesw headers first in check-lxdialog
Yaakov Selkowitz [Wed, 13 Jun 2012 00:05:02 +0000 (19:05 -0500)]
kconfig: check ncursesw headers first in check-lxdialog

Commit 8c41e5e363db55d91aa3b1cdce4ab02ad9821de7 added a check for
ncursesw/curses.h for the case where ncurses and ncursesw are build
separately but only one is installed.  But if both are installed,
the headers ncurses/curses.h and ncursesw/curses.h differ, and since
libncursesw will be found first, so should ncursesw/curses.h.

Signed-off-by: Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
8 years agokconfig: fix menuconfig on debian lenny
Junio C Hamano [Sun, 19 Sep 2010 02:25:32 +0000 (19:25 -0700)]
kconfig: fix menuconfig on debian lenny

In 60f33b8 (kconfig: get rid of stray a.o, support ncursesw, 2006-01-15),
support to link menuconfig with ncursesw library was added.  To compute
the linker command option -l, we check "libncursesw.{so,a,dylib}" to allow
ncursesw to be used as a replacement ncurses.  However, when checking what
header file to include, we do not check /usr/include/ncursesw directory.

Add /usr/include/ncursesw to the list of directories that are checked.
With this patch, on my Debian Lenny box with libncursesw5-dev package but
not libncurses5-dev package, I can say "make menuconfig".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
8 years agoRevert "lxdialog: fix ncursesw include detection"
Mike Frysinger [Mon, 4 Apr 2016 03:58:50 +0000 (23:58 -0400)]
Revert "lxdialog: fix ncursesw include detection"

This reverts commit e91bc53d0c2e8de7dc4fbdb888ab0a4923c2b475.

Let's get back to a state that matches upstream so we can pull in all of
their fixes from the last few years.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
8 years agofind_applet_by_name: loop index should be signed
Ron Yorston [Sun, 3 Apr 2016 20:29:35 +0000 (22:29 +0200)]
find_applet_by_name: loop index should be signed

The loop

   for (j = ARRAY_SIZE(applet_nameofs)-1; j >= 0; j--) {

was intended to terminate when j goes negative, so j needs to be signed.

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agowhitespace and namespace cleanups
Denys Vlasenko [Sun, 3 Apr 2016 20:24:51 +0000 (22:24 +0200)]
whitespace and namespace cleanups

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoubirmvol: Implement -N switch for ubirmvol
Sven Eisenberg [Sun, 3 Apr 2016 19:53:12 +0000 (21:53 +0200)]
ubirmvol: Implement -N switch for ubirmvol

function                                             old     new   delta
get_volid_by_name                                      -     125    +125
ubi_devnum_from_devname                                -      43     +43
ubi_tools_main                                      1215    1220      +5
packed_usage                                       30674   30655     -19
ubirename_main                                       394     221    -173
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 1/2 up/down: 173/-192)          Total: -19 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoubirename: new applet
Sven Eisenberg [Sun, 3 Apr 2016 18:12:03 +0000 (20:12 +0200)]
ubirename: new applet

function                                             old     new   delta
ubirename_main                                         -     394    +394
packed_usage                                       30611   30674     +63
applet_names                                        2530    2540     +10

Signed-off-by: Sven Eisenberg <sven.eisenberg@novero.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agolibbb: speed up error_msg functions
Denys Vlasenko [Sun, 3 Apr 2016 14:55:03 +0000 (16:55 +0200)]
libbb: speed up error_msg functions

function                                             old     new   delta
bb_verror_msg                                        386     466     +80

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agomain(): add a TODO about finding a use for _end[] area
Denys Vlasenko [Sun, 3 Apr 2016 14:06:42 +0000 (16:06 +0200)]
main(): add a TODO about finding a use for _end[] area

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agotrylink: on failure, print a hint about CONFIG_EXTRA_LDLIBS
Denys Vlasenko [Sun, 3 Apr 2016 13:38:53 +0000 (15:38 +0200)]
trylink: on failure, print a hint about CONFIG_EXTRA_LDLIBS

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agotypo fix
Denys Vlasenko [Sat, 2 Apr 2016 20:57:17 +0000 (22:57 +0200)]
typo fix

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agofind_applet_by_name: add an example of faster linear search code
Denys Vlasenko [Sat, 2 Apr 2016 20:54:23 +0000 (22:54 +0200)]
find_applet_by_name: add an example of faster linear search code

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agonsenter,unshare: work around older header
Denys Vlasenko [Sat, 2 Apr 2016 17:00:44 +0000 (19:00 +0200)]
nsenter,unshare: work around older header

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agosort: "-o FILE", not "-o", is the syntax
Denys Vlasenko [Sat, 2 Apr 2016 16:20:26 +0000 (18:20 +0200)]
sort: "-o FILE", not "-o", is the syntax

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agonsenter,unshare: share common code; fix a bug of not closing all fds
Denys Vlasenko [Sat, 2 Apr 2016 16:06:24 +0000 (18:06 +0200)]
nsenter,unshare: share common code; fix a bug of not closing all fds

function                                             old     new   delta
xvfork_parent_waits_and_exits                          -      64     +64
exec_prog_or_SHELL                                     -      39     +39
unshare_main                                         873     810     -63
nsenter_main                                         663     596     -67
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 0/2 up/down: 106/-130)          Total: -27 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agosort: help text does not need to say that -mST are supported but ignored
Denys Vlasenko [Sat, 2 Apr 2016 15:39:50 +0000 (17:39 +0200)]
sort: help text does not need to say that -mST are supported but ignored

Such information is useless for users of "sort --help"

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agobuild system: finer-grained selection of search speedup table.
Denys Vlasenko [Sat, 2 Apr 2016 13:18:26 +0000 (15:18 +0200)]
build system: finer-grained selection of search speedup table.

KNOWN_APPNAME_OFFSETS=8 versus KNOWN_APPNAME_OFFSETS=0:

function                                             old     new   delta
find_applet_by_name                                   55     136     +81
applet_nameofs                                         -      14     +14
run_applet_and_exit                                  757     758      +1

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agounshare: remove stale comment
Denys Vlasenko [Sat, 2 Apr 2016 02:44:39 +0000 (04:44 +0200)]
unshare: remove stale comment

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agonsenter: new applet
Bartosz Golaszewski [Fri, 1 Apr 2016 20:17:25 +0000 (22:17 +0200)]
nsenter: new applet

function                                             old     new   delta
nsenter_main                                           -     663    +663
.rodata                                           155147  155612    +465
packed_usage                                       30536   30708    +172
nsenter_longopts                                       -     116    +116
open_by_path_or_target                                 -      58     +58
applet_names                                        2518    2526      +8
applet_main                                         2920    2928      +8
------------------------------------------------------------------------------
(add/remove: 4/0 grow/shrink: 4/0 up/down: 1490/0)           Total: 1490 bytes
   text    data     bss     dec     hex filename
 827956    4078    9080  841114   cd59a busybox_old
 829214    4086    9080  842380   cda8c busybox_unstripped

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agolibbb: two new functions: wait_for_exitstatus(pid), xfchdir(fd)
Denys Vlasenko [Fri, 1 Apr 2016 20:12:44 +0000 (22:12 +0200)]
libbb: two new functions: wait_for_exitstatus(pid), xfchdir(fd)

Bartosz Golaszewski proposed xfchdir()

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agounshare: new applet
Bartosz Golaszewski [Fri, 1 Apr 2016 17:41:13 +0000 (19:41 +0200)]
unshare: new applet

function                                             old     new   delta
unshare_main                                           -     873    +873
.rodata                                           154444  155131    +687
packed_usage                                       30329   30520    +191
unshare_longopts                                       -     106    +106
mount_namespaces                                       -      99     +99
mount_or_die                                           -      51     +51
ns_list                                                -      48     +48
wait_for_exitstatus                                    -      41     +41
opt_str                                                -      17     +17
applet_names                                        2510    2518      +8
applet_main                                         2912    2920      +8
applet_suid                                           91      92      +1
applet_install_loc                                   182     183      +1
------------------------------------------------------------------------------
(add/remove: 8/0 grow/shrink: 6/0 up/down: 2131/0)           Total: 2131 bytes
   text    data     bss     dec     hex filename
 826110    4070    9080  839260   cce5c busybox_old
 827961    4078    9080  841119   cd59f busybox_unstripped

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoRename FEATURE_INITRD to LINUXRC and make it separate, not an alias to init
Denys Vlasenko [Wed, 30 Mar 2016 22:42:57 +0000 (00:42 +0200)]
Rename FEATURE_INITRD to LINUXRC and make it separate, not an alias to init

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agomake MKPASSWD a separate config option, not an automatic alias to cryptpw
Denys Vlasenko [Wed, 30 Mar 2016 22:32:39 +0000 (00:32 +0200)]
make MKPASSWD a separate config option, not an automatic alias to cryptpw

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoudhcp: fix capitalization of two messages
Denys Vlasenko [Wed, 30 Mar 2016 16:49:45 +0000 (18:49 +0200)]
udhcp: fix capitalization of two messages

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agodhcpd: string reuse
Denys Vlasenko [Wed, 30 Mar 2016 16:44:52 +0000 (18:44 +0200)]
dhcpd: string reuse

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoudhcp: get rid of bb_info_msg()
Denys Vlasenko [Wed, 30 Mar 2016 16:41:23 +0000 (18:41 +0200)]
udhcp: get rid of bb_info_msg()

function                                             old     new   delta
udhcpd_main                                         1501    1531     +30
d6_recv_raw_packet                                   251     264     +13
perform_d6_release                                   188     198     +10
udhcpc6_main                                        2443    2449      +6
udhcp_recv_raw_packet                                582     588      +6
udhcp_recv_kernel_packet                             132     138      +6
send_d6_renew                                        140     146      +6
d6_recv_kernel_packet                                118     124      +6
send_renew                                            77      82      +5
send_discover                                         85      90      +5
send_decline                                          84      89      +5
send_d6_select                                        97     102      +5
send_d6_discover                                     174     179      +5
perform_release                                      167     172      +5
count_lines                                           72      74      +2
udhcpc_main                                         2836    2837      +1
bb_info_msg                                          125       -    -125
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 17/4 up/down: 117/-180)         Total: -63 bytes
   text    data     bss     dec     hex filename
 924935     906   17160  943001   e6399 busybox_old
 924736     906   17160  942802   e62d2 busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agosetfiles: switch bb_info_msg to printf
Denys Vlasenko [Wed, 30 Mar 2016 16:17:35 +0000 (18:17 +0200)]
setfiles: switch bb_info_msg to printf

Presumably, bb_info_msg was used here for syslog logging (-l),
but there is no actual code to activate syslog logging.
Added a TODO note on that, so that selinux users would notice
and fix if needed.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agosulogin: use bb_error_msg instead of bb_info_msg; better message
Denys Vlasenko [Wed, 30 Mar 2016 15:36:20 +0000 (17:36 +0200)]
sulogin: use bb_error_msg instead of bb_info_msg; better message

Historic "System Maintenance Mode" message is a tiny bit cryptic.
Let's say explicitly what we are doing: we are giving user a shell
(presumably to do some maintenance in single-user mode).

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agosulogin: remove suid paranoia code, explain why it's not necessary
Denys Vlasenko [Wed, 30 Mar 2016 15:27:32 +0000 (17:27 +0200)]
sulogin: remove suid paranoia code, explain why it's not necessary

function                                             old     new   delta
sulogin_main                                         325     270     -55

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agosulogin: Dorp incorrect comment about suid-ness
Denys Vlasenko [Wed, 30 Mar 2016 14:49:13 +0000 (16:49 +0200)]
sulogin: Dorp incorrect comment about suid-ness

Sulogin is not a suid app, should fail if run by non-root.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agofsck: use printf for message, not bb_info_msg
Denys Vlasenko [Wed, 30 Mar 2016 14:30:24 +0000 (16:30 +0200)]
fsck: use printf for message, not bb_info_msg

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agomkfs_vfat: use bb_error_msg for logging, not bb_info_msg
Denys Vlasenko [Wed, 30 Mar 2016 14:23:10 +0000 (16:23 +0200)]
mkfs_vfat: use bb_error_msg for logging, not bb_info_msg

This affects only a commented-out code section which searches for bad blocks

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agozcip: use bb_error_msg for logging, not bb_info_msg
Denys Vlasenko [Wed, 30 Mar 2016 14:22:13 +0000 (16:22 +0200)]
zcip: use bb_error_msg for logging, not bb_info_msg

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoReplace a few more bb_info_msg's by bb_error_msg or printf
Denys Vlasenko [Wed, 30 Mar 2016 14:20:28 +0000 (16:20 +0200)]
Replace a few more bb_info_msg's by bb_error_msg or printf

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoUse bb_error_msg instead of bb_info_msg in all commented-out debug printouts
Denys Vlasenko [Wed, 30 Mar 2016 14:04:37 +0000 (16:04 +0200)]
Use bb_error_msg instead of bb_info_msg in all commented-out debug printouts

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoapplet_tables: save space by removing applet name offsets
Ron Yorston [Tue, 29 Mar 2016 22:42:05 +0000 (00:42 +0200)]
applet_tables: save space by removing applet name offsets

The array applet_nameofs consumes two bytes per applet.  It encodes

   nofork/noexec flags
   suid flags
   the offset of the applet name in the applet_name string

Change the applet_table build tool to store the flags in two separate
arrays (applet_flags and applet_suid).  Replace applet_nameofs[] with a
smaller version that only stores a limited number of offsets.

This requires changes to the macros APPLET_IS_NOFORK, APPLET_IS_NOEXEC
and APPLET_SUID.

   According to Valgrind the original find_applet_by_name required
   353 cycles per call, averaged over all names.  Adjusting the number
   of known offsets allows space to be traded off against execution time:

      KNOWN_OFFSETS     cycles     bytes (wrt KNOWN_OFFSETS = 0)

           0             9057        -
           2             4604       32
           4             2407       75
           8             1342       98
          16              908      130
          32              884      194

   This patch uses KNOWN_OFFSETS = 8.

v2:
   Remove some dead code from the applet_table tool;
   Treat the applet in the middle of the table as a special case.

v3:
   Use the middle applet to adjust the start of the linear search as
   well as the last applet found.

v4:
   Use an augmented linear search in find_applet_by_name.
   Drop the special treatment of the middle name from get_applet_name:
   most of the advantage now derives from the last stored value.

v5:
   Don't store index in applet_nameofs, it can be calculated.

v6:
   Tweaks by Denys

function                                             old     new   delta
find_applet_by_name                                   25     125    +100
applet_suid                                            -      92     +92
run_applet_no_and_exit                               452     460      +8
run_applet_and_exit                                  695     697      +2
applet_name_compare                                   31       -     -31
applet_nameofs                                       734      14    -720
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 3/1 up/down: 202/-751)         Total: -549 bytes
   text       data        bss        dec        hex    filename
 925464        906      17160     943530      e65aa    busybox_old
 924915        906      17160     942981      e6385    busybox_unstripped

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoRevert "networking: properly initialize ipv6 scope id for printing it"
Denys Vlasenko [Tue, 29 Mar 2016 17:27:00 +0000 (19:27 +0200)]
Revert "networking: properly initialize ipv6 scope id for printing it"

This reverts commit 2fb63292f7083fb259a3f8d8ee70ef8acdaed626.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agomodprobe: skip non-.conf files only in subdirectories
Denys Vlasenko [Tue, 29 Mar 2016 17:23:55 +0000 (19:23 +0200)]
modprobe: skip non-.conf files only in subdirectories

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoumount: build fix for older glibc
Denys Vlasenko [Mon, 28 Mar 2016 20:23:33 +0000 (22:23 +0200)]
umount: build fix for older glibc

Based on a patch by Veli-Pekka Peltola <veli-pekka.peltola@ray.fi>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agonetworking: properly initialize ipv6 scope id for printing it
Timo Teräs [Mon, 28 Mar 2016 20:16:48 +0000 (22:16 +0200)]
networking: properly initialize ipv6 scope id for printing it

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agogrep: make errors other than "not found" result in exit code 2. Closes 8796
Denys Vlasenko [Mon, 28 Mar 2016 20:12:09 +0000 (22:12 +0200)]
grep: make errors other than "not found" result in exit code 2. Closes 8796

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoash_test: ignore generated files
Mike Frysinger [Tue, 22 Mar 2016 22:15:24 +0000 (18:15 -0400)]
ash_test: ignore generated files

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
8 years agoash_test: printenv: fix missing includes
Mike Frysinger [Tue, 22 Mar 2016 22:15:14 +0000 (18:15 -0400)]
ash_test: printenv: fix missing includes

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
8 years agoash: fix corruption of ${#var} if $var contains UTF-8 characters
Ron Yorston [Fri, 18 Mar 2016 11:29:19 +0000 (11:29 +0000)]
ash: fix corruption of ${#var} if $var contains UTF-8 characters

As reported in bug 8506:

   $ X=abcdÉfghÍjklmnÓpqrstÚvwcyz
   $ echo ${#X}
   abcd26

The result should be 26.

This regression was introduced by:

   <d68d1fb> 2015-05-18 [Ron Yorston]  ash: code shrink around varvalue

The length in characters was being used to discard the contents of
the variable instead of the length in bytes.

URL: https://bugs.busybox.net/8506
Reported-by: Martijn Dekker <martijn@inlv.org>
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
8 years agowget: make -T timeout work on header reads too. Closes 8636
Denys Vlasenko [Thu, 17 Mar 2016 14:58:16 +0000 (15:58 +0100)]
wget: make -T timeout work on header reads too. Closes 8636

function                                             old     new   delta
set_alarm                                              -      27     +27
fgets_and_trim                                        76      92     +16
wget_main                                           2610    2616      +6
open_socket                                           64      54     -10

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