oweals/busybox.git
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>
8 years agonmeter: reinstate and document -d-1
Denys Vlasenko [Tue, 15 Mar 2016 16:54:17 +0000 (17:54 +0100)]
nmeter: reinstate and document -d-1

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agonmeter: remove undocumented %NNNd specifier
Denys Vlasenko [Tue, 15 Mar 2016 15:13:23 +0000 (16:13 +0100)]
nmeter: remove undocumented %NNNd specifier

function                                             old     new   delta
nmeter_main                                          707     745     +38
init_functions                                        48      44      -4
init_delay                                            63       -     -63
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/1 up/down: 38/-67)            Total: -29 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agonmeter: simple code shrink here and there
Denys Vlasenko [Tue, 15 Mar 2016 15:06:29 +0000 (16:06 +0100)]
nmeter: simple code shrink here and there

function                                             old     new   delta
nmeter_main                                          709     707      -2
init_cr                                               15      12      -3
collect_time                                         141     131     -10
collect_cpu                                          610     593     -17
init_cpu                                              82      63     -19
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/5 up/down: 0/-51)             Total: -51 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agonmeter: convert field list to bit list
Denys Vlasenko [Tue, 15 Mar 2016 14:52:40 +0000 (15:52 +0100)]
nmeter: convert field list to bit list

function                                             old     new   delta
rdval                                                 34     157    +123
collect_int                                          123     122      -1
collect_thread_nr                                     65      62      -3
collect_blk                                          559     552      -7
collect_if                                           207     199      -8
collect_fork                                         119     111      -8
collect_ctx                                          119     111      -8
collect_fd                                            81      71     -10
collect_swp                                          120     107     -13
collect_cpu                                          623     610     -13
collect_mem                                          371     339     -32
rdval_loadavg                                         38       -     -38
vrdval                                               170       -    -170
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 1/10 up/down: 123/-311)        Total: -188 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agonmeter: code shrink
Denys Vlasenko [Tue, 15 Mar 2016 14:28:49 +0000 (15:28 +0100)]
nmeter: code shrink

function                                             old     new   delta
put                                                   52      43      -9

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agonmeter: fix a bug with unterminated varargs
Denys Vlasenko [Tue, 15 Mar 2016 14:22:42 +0000 (15:22 +0100)]
nmeter: fix a bug with unterminated varargs

function                                             old     new   delta
collect_mem                                          361     371     +10
collect_swp                                          116     120      +4
vrdval                                               168     170      +2
collect_thread_nr                                     63      65      +2
collect_int                                          121     123      +2
collect_if                                           205     207      +2
collect_fork                                         117     119      +2
collect_fd                                            79      81      +2
collect_ctx                                          117     119      +2
collect_cpu                                          621     623      +2
collect_blk                                          557     559      +2
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 11/0 up/down: 32/0)              Total: 32 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoNew example config: android_502_defconfig
Denys Vlasenko [Mon, 14 Mar 2016 21:28:53 +0000 (22:28 +0100)]
New example config: android_502_defconfig

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agomore bionic fixes
Denys Vlasenko [Mon, 14 Mar 2016 18:34:15 +0000 (19:34 +0100)]
more bionic fixes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agofixes for problems found by bionic build
Denys Vlasenko [Mon, 14 Mar 2016 17:23:33 +0000 (18:23 +0100)]
fixes for problems found by bionic build

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoudhcpc: fix a warning in debug code
Denys Vlasenko [Thu, 10 Mar 2016 23:26:58 +0000 (00:26 +0100)]
udhcpc: fix a warning in debug code

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoudhcp: fix a SEGV on malformed RFC1035-encoded domain name
Denys Vlasenko [Thu, 10 Mar 2016 10:47:58 +0000 (11:47 +0100)]
udhcp: fix a SEGV on malformed RFC1035-encoded domain name

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agorenice: tweak help text
Denys Vlasenko [Mon, 7 Mar 2016 14:21:54 +0000 (15:21 +0100)]
renice: tweak help text

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agols: fix columnar output. Closes 8731
Denys Vlasenko [Sun, 6 Mar 2016 16:53:11 +0000 (17:53 +0100)]
ls: fix columnar output. Closes 8731

In coreutils/ls.c, 1.19 introduced commit
2f7d9e8903029b1b5e51a15f9cb0dcb6ca17c3ac, removing the variable tabstops and
hard coding the column separation to 2 characters, but was not done correctly.
The column_width assumes a gap of 1 character, so the computed number of
columns exceeds the terminal width when many small files are encountered.

A minor problem but surprisingly annoying.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoinotifyd: swap meaning of 'y' and 'm' events in help text. Closes 8726
Denys Vlasenko [Sun, 6 Mar 2016 16:35:16 +0000 (17:35 +0100)]
inotifyd: swap meaning of 'y' and 'm' events in help text. Closes 8726

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoudhcpc: do not use -t NUM for counting "select" packets, use 3
Denys Vlasenko [Fri, 4 Mar 2016 16:00:56 +0000 (17:00 +0100)]
udhcpc: do not use -t NUM for counting "select" packets, use 3

Otherwise, "-t 0" usage may end up sending them forever
if server does not respond.

function                                             old     new   delta
udhcpc_main                                         2846    2836     -10

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agontpd: add experimental patch
Denys Vlasenko [Fri, 4 Mar 2016 06:36:04 +0000 (07:36 +0100)]
ntpd: add experimental patch

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agontpd: if peer does not reply anymore, try re-resolving its hostname
Denys Vlasenko [Fri, 4 Mar 2016 06:26:08 +0000 (07:26 +0100)]
ntpd: if peer does not reply anymore, try re-resolving its hostname

function                                             old     new   delta
ntpd_main                                           1053    1130     +77
add_peers                                            166     195     +29

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agontpd: do not use a peer more than once (say, if two peers resolve to the same IP)
Denys Vlasenko [Fri, 4 Mar 2016 06:06:53 +0000 (07:06 +0100)]
ntpd: do not use a peer more than once (say, if two peers resolve to the same IP)

function                                             old     new   delta
add_peers                                             98     166     +68

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agontpd: more informative poll lowering message
Denys Vlasenko [Thu, 3 Mar 2016 21:01:23 +0000 (22:01 +0100)]
ntpd: more informative poll lowering message

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoifupdowm: fix "warning: unused variable 'iface_list'"
Denys Vlasenko [Thu, 3 Mar 2016 01:19:16 +0000 (02:19 +0100)]
ifupdowm: fix "warning: unused variable 'iface_list'"

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agodhcpc: Use client IP address as source address for DHCP renew/rebind messages
Hans Dedecker [Thu, 18 Feb 2016 11:27:07 +0000 (12:27 +0100)]
dhcpc: Use client IP address as source address for DHCP renew/rebind messages

RFC2131 paragraph 4.1 states DHCP messages broadcast by a client prior to
that client obtaining its IP address must have the source IP address
field in the header set to 0.
Request messages transmitted in renewing and rebinding state need to use
the obtained IP address as source IP address in the header; this behavior
lines up with other implementations like ISC dhcp client.

Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoudhcpd: keep expired leases at startup
Christian Lindeberg [Tue, 1 Mar 2016 18:23:22 +0000 (19:23 +0100)]
udhcpd: keep expired leases at startup

Let udhcpd retain the information about expired leases when restarting
so that the leases are reserved until they possibly become the oldest
expired lease.

This reduces the frequency of IP address changes for example when the
DHCP server and a group of clients, who do not store and request their
previously offered IP address across restarts, are collectively restarted
and the startup order of the clients are not guaranteed.

Signed-off-by: Christian Lindeberg <christian.lindeberg@axis.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoifupdown: allow duplicate interface definitions
Nicolas Cavallari [Tue, 1 Mar 2016 17:59:08 +0000 (18:59 +0100)]
ifupdown: allow duplicate interface definitions

This patch allow to have multiple interface definitions, much like
Debian's ifupdown.  More specifically, it removes the check for a
duplicate definition, so the impact on binary size should be fairly
minimal.

This configuration:

iface eth0 inet static
        address 192.168.0.15
        netmask 255.255.0.0
        gateway 192.168.0.1

iface eth0 inet static
        address 10.0.0.1
        netmask 255.255.255.0

Will add two addresses to eth0 if ip is used.  If ifconfig is used,
the standards methods will likely not stack, but the administrator may
still use the manual method.  The DHCP method may work depending on the
DHCP client in use.

This is a fairly advanced feature for power users who knows what they
are doing.  There are not many other network configuration systems that
allows multiple addresses on an interface.

Signed-off-by: Nicolas Cavallari <nicolas.cavallari@green-communications.fr>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoudhcpc: fix OPTION_6RD parsing (could overflow its malloced buffer)
Denys Vlasenko [Fri, 26 Feb 2016 14:54:56 +0000 (15:54 +0100)]
udhcpc: fix OPTION_6RD parsing (could overflow its malloced buffer)

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoudhcp: trivial shrink
Denys Vlasenko [Fri, 26 Feb 2016 13:56:18 +0000 (14:56 +0100)]
udhcp: trivial shrink

function                                             old     new   delta
dname_dec                                            337     332      -5

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agotaskset: fix non-fancy cpuset printing on big-endian
Arnout Vandecappelle (Essensium/Mind) [Sun, 14 Feb 2016 18:04:09 +0000 (19:04 +0100)]
taskset: fix non-fancy cpuset printing on big-endian

The non-fancy version of the from_cpuset uses CPU_SETSIZE as if it
represents the number of bytes in the cpuset, while it is actually
the number of bits. This leads to out-of-bounds accesses on the
cpu_set_t in the big-endian case. Basically all uses of CPU_SETSIZE
have to be divided by 8. This is done correctly in the fancy version
of from_cpuset.

In addition, the big-endian case is completely wrong to begin with.
All standard C libraries that I know of implement cpu_set_t as an
unsigned long array, so both for big and little endian, the least
significant bits are in the beginning of the array. Therefore, the
approach taken for the little endian case is equally valid. We only
need special handling for big endian when CPU_SETSIZE is large and
we use an unsigned long long to get more bits out.

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agontpd: print packet delay in clock update message
Denys Vlasenko [Wed, 24 Feb 2016 00:22:45 +0000 (01:22 +0100)]
ntpd: print packet delay in clock update message

function                                             old     new   delta
update_local_clock                                   820     826      +6

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agomodprobe: only parse files that end in .conf
Mike Frysinger [Sat, 13 Feb 2016 04:26:51 +0000 (23:26 -0500)]
modprobe: only parse files that end in .conf

This matches behavior with kmod which has been the standard for a long
time at this point.

URL: https://bugs.busybox.net/8021
Reported-by: Jö <jorrit@jorrit.de>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
8 years agobuild: add a sanitizer debug option
Mike Frysinger [Sat, 13 Feb 2016 03:12:47 +0000 (22:12 -0500)]
build: add a sanitizer debug option

Building & running with ASAN is super helpful, so add a dedicated config
knob for it.  This way people don't have to guess at the right compiler
settings in order to get a good build.  We can just tell people to enable
this one option.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
8 years agonetworking: allow dot at the end of the domain name in dhcp response
Denys Vlasenko [Thu, 11 Feb 2016 16:44:44 +0000 (17:44 +0100)]
networking: allow dot at the end of the domain name in dhcp response

Patch based on Balaji Punnuru <balaji.punnuru@gmail.com> work.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoinit: make the command-line rewrite optional
Nicolas Carrier [Thu, 4 Feb 2016 11:18:01 +0000 (12:18 +0100)]
init: make the command-line rewrite optional

When launched as PID 1 and after parsing its arguments, init wipes all
all of them except argv[0] and rewrites argv[0] to contain only "init",
so that its command-line appears solely as "init" in tools such as ps.

This patch adds the FEATURE_INIT_MODIFY_CMDLINE which, if set to n, will
make init preserve all its arguments including argv[0], be they parsed or
ignored.
The original command-line used to launch init can then be retrieved in
/proc/1/cmdline on Linux, for example.

Signed-off-by: Nicolas Carrier <nicolas.carrier@parrot.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agontpd: shorter message
Denys Vlasenko [Wed, 10 Feb 2016 06:06:31 +0000 (07:06 +0100)]
ntpd: shorter message

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agontpd: step when |offset| > 1 sec, not 0.125 sec
Denys Vlasenko [Wed, 10 Feb 2016 05:55:07 +0000 (06:55 +0100)]
ntpd: step when |offset| > 1 sec, not 0.125 sec

update_local_clock                                   769     820     +51
recv_and_process_peer_pkt                            838     862     +24
reset_peer_stats                                     137     133      -4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 75/-4)              Total: 71 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agobusybox: fix uninitialized memory when displaying IPv6 addresses
Felix Fietkau [Mon, 18 Jan 2016 11:07:35 +0000 (12:07 +0100)]
busybox: fix uninitialized memory when displaying IPv6 addresses

After commit 8e74adab0107658e3dc04ed342206272a284f43e
("libbb: make INET[6]_rresolve use sockaddr2{host,dotted}_noport")
INET_sprint6 uses more than just sin6_addr, it also tries to display the
scope id, which is uninitialized when called from ife_print6.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agodd: support iflag=skip_bytes
Rafał Miłecki [Mon, 1 Feb 2016 01:17:28 +0000 (02:17 +0100)]
dd: support iflag=skip_bytes

It allows specifying amount of bytes directly (not only amount of
blocks) is also supported by GNU's Coreutils.

function                                             old     new   delta
parse_comma_flags                                      -      93     +93
static.iflag_words                                     -      12     +12
dd_main                                             1569    1580     +11
packed_usage                                       30591   30600      +9
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 2/0 up/down: 125/0)             Total: 125 bytes

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoFix compiling with musl's utmp stubs
Kylie McClain [Mon, 1 Feb 2016 00:36:05 +0000 (01:36 +0100)]
Fix compiling with musl's utmp stubs

This patch fixes compiling busybox with FEATURE_UTMP and _WTMP enabled.
musl, while not really support utmp/wtmp, provides stub functions, as well
as variables such as _PATH_UTMP, so that programs using utmp or wtmp can
still compile fine.

My reasoning for this patch is that on Exherbo, I'm currently trying to get
us to be able to use the same busybox config file for both glibc and musl
systems, using utmp/wtmp on systems that support it, and using the stubs
on musl without needing two different configs.

As of latest musl git, it provides all utmp functions needed; 1.1.12 doesn't,
but I sent a patch to Rich to add the utmp{,x}name functions expected to
exist, which was merged into musl upstream.

Signed-off-by: Kylie McClain <somasissounds@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoprintf: short-circuit output when argument to %b includes \c
Ron Yorston [Sun, 31 Jan 2016 21:22:25 +0000 (22:22 +0100)]
printf: short-circuit output when argument to %b includes \c

printf wasn't correctly handling \c in an argument to the %b format
specifier.

   printf %bXX OK\\c

returned 'OK\cXX' rather than the expected 'OK'.

function                                             old     new   delta
printf_main                                          886     899     +13

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agosed: make 's///w FILE' actually write to FILE. Closes 8251
Denys Vlasenko [Sun, 24 Jan 2016 14:52:16 +0000 (15:52 +0100)]
sed: make 's///w FILE' actually write to FILE. Closes 8251

function                                             old     new   delta
add_cmd                                             1167    1210     +43

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agopatch: correctly handle "patch FILE_TO_PATCH" form. Closes 7736
Denys Vlasenko [Sat, 23 Jan 2016 04:13:15 +0000 (05:13 +0100)]
patch: correctly handle "patch FILE_TO_PATCH" form. Closes 7736

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agodos2unix: try to preserve ownership. closes 8311
Denys Vlasenko [Sun, 17 Jan 2016 02:50:36 +0000 (03:50 +0100)]
dos2unix: try to preserve ownership. closes 8311

function                                             old     new   delta
dos2unix_main                                        426     441     +15

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agosetsid: implement -c
Denys Vlasenko [Sun, 17 Jan 2016 00:09:36 +0000 (01:09 +0100)]
setsid: implement -c

function                                             old     new   delta
setsid_main                                           53      96     +43
packed_usage                                       30846   30833     -13

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agotruncate: use O_WRONLY|O_NONBLOCK
Mike Frysinger [Wed, 13 Jan 2016 18:30:20 +0000 (13:30 -0500)]
truncate: use O_WRONLY|O_NONBLOCK

This matches coreutils behavior.  We don't read the fd, and truncation
does not need blocking.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
8 years agotruncate: always set mode when opening file to avoid fortify errors
Ari Sundholm [Mon, 4 Jan 2016 13:40:37 +0000 (15:40 +0200)]
truncate: always set mode when opening file to avoid fortify errors

Busybox crashes due to no mode being given when opening:
$ ./busybox truncate -s 1M foo
*** invalid open64 call: O_CREAT without mode ***: ./busybox terminated
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x7338f)[0x7f66d921338f]
/lib/x86_64-linux-gnu/libc.so.6(__fortify_fail+0x5c)[0x7f66d92aac9c]
/lib/x86_64-linux-gnu/libc.so.6(+0xeb6aa)[0x7f66d928b6aa]
./busybox[0x4899f9]
======= Memory map: ========
00400000-004d0000 r-xp 00000000 00:1a 137559                             /home/ari/busybox/busybox
006cf000-006d0000 r--p 000cf000 00:1a 137559                             /home/ari/busybox/busybox
006d0000-006d1000 rw-p 000d0000 00:1a 137559                             /home/ari/busybox/busybox
006d1000-006d4000 rw-p 00000000 00:00 0
014e7000-01508000 rw-p 00000000 00:00 0                                  [heap]
7f66d8f8a000-7f66d8fa0000 r-xp 00000000 08:07 1579008                    /lib/x86_64-linux-gnu/libgcc_s.so.1
7f66d8fa0000-7f66d919f000 ---p 00016000 08:07 1579008                    /lib/x86_64-linux-gnu/libgcc_s.so.1
7f66d919f000-7f66d91a0000 rw-p 00015000 08:07 1579008                    /lib/x86_64-linux-gnu/libgcc_s.so.1
7f66d91a0000-7f66d935b000 r-xp 00000000 08:07 1578994                    /lib/x86_64-linux-gnu/libc-2.19.so
7f66d935b000-7f66d955a000 ---p 001bb000 08:07 1578994                    /lib/x86_64-linux-gnu/libc-2.19.so
7f66d955a000-7f66d955e000 r--p 001ba000 08:07 1578994                    /lib/x86_64-linux-gnu/libc-2.19.so
7f66d955e000-7f66d9560000 rw-p 001be000 08:07 1578994                    /lib/x86_64-linux-gnu/libc-2.19.so
7f66d9560000-7f66d9565000 rw-p 00000000 00:00 0
7f66d9565000-7f66d966a000 r-xp 00000000 08:07 1579020                    /lib/x86_64-linux-gnu/libm-2.19.so
7f66d966a000-7f66d9869000 ---p 00105000 08:07 1579020                    /lib/x86_64-linux-gnu/libm-2.19.so
7f66d9869000-7f66d986a000 r--p 00104000 08:07 1579020                    /lib/x86_64-linux-gnu/libm-2.19.so
7f66d986a000-7f66d986b000 rw-p 00105000 08:07 1579020                    /lib/x86_64-linux-gnu/libm-2.19.so
7f66d986b000-7f66d988e000 r-xp 00000000 08:07 1578981                    /lib/x86_64-linux-gnu/ld-2.19.so
7f66d9a64000-7f66d9a67000 rw-p 00000000 00:00 0
7f66d9a8a000-7f66d9a8d000 rw-p 00000000 00:00 0
7f66d9a8d000-7f66d9a8e000 r--p 00022000 08:07 1578981                    /lib/x86_64-linux-gnu/ld-2.19.so
7f66d9a8e000-7f66d9a8f000 rw-p 00023000 08:07 1578981                    /lib/x86_64-linux-gnu/ld-2.19.so
7f66d9a8f000-7f66d9a90000 rw-p 00000000 00:00 0
7ffc47761000-7ffc47782000 rw-p 00000000 00:00 0                          [stack]
7ffc477ab000-7ffc477ad000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
Aborted (core dumped)
$

Fix this by simply always setting the mode, as it doesn't hurt even
when O_CREAT is not specified.

This bug is a regression introduced in fc3e40e, as xopen(), which
was originally used, would automatically set the mode.

Signed-off-by: Ari Sundholm <ari@tuxera.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
8 years agologin: add commented-out PAM double password avoidance from BZ 4003
Denys Vlasenko [Sun, 3 Jan 2016 21:43:40 +0000 (22:43 +0100)]
login: add commented-out PAM double password avoidance from BZ 4003

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agonandwrite: implement -n (read/write without ecc)
Aaro Koskinen [Sat, 19 Dec 2015 20:34:44 +0000 (22:34 +0200)]
nandwrite: implement -n (read/write without ecc)

Implement -n (read/write without ecc).

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoblkdiscard: new applet
Ari Sundholm [Sat, 2 Jan 2016 00:18:32 +0000 (01:18 +0100)]
blkdiscard: new applet

function                                             old     new   delta
blkdiscard_main                                        -     264    +264

Signed-off-by: Ari Sundholm <ari@tuxera.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoash: suppress a compilation warning
Cristian Ionescu-Idbohrn [Fri, 1 Jan 2016 23:52:29 +0000 (00:52 +0100)]
ash: suppress a compilation warning

Reported by gcc (Debian 5.3.1-4) 5.3.1 20151219

shell/ash.c: In function 'evaltree':
shell/ash.c:8432:19: warning: logical not is only applied to the left hand side of comparison

Signed-off-by: Cristian Ionescu-Idbohrn <cristian.ionescu-idbohrn@axis.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agomount: support "nofail" option. Closes 8551
Denys Vlasenko [Wed, 30 Dec 2015 19:11:34 +0000 (20:11 +0100)]
mount: support "nofail" option. Closes 8551

function                                             old     new   delta
singlemount                                         1045    1060     +15
mount_option_str                                     338     345      +7
mount_it_now                                         355     361      +6
mount_options                                        172     176      +4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/0 up/down: 32/0)               Total: 32 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoiproute: support "scope". Closes 8561
Denys Vlasenko [Wed, 30 Dec 2015 16:32:51 +0000 (17:32 +0100)]
iproute: support "scope". Closes 8561

function                                             old     new   delta
iproute_modify                                      1051    1120     +69

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