Commit Graph

2091 Commits

Author SHA1 Message Date
Denys Vlasenko
d28cd9900a modprobe-small: make applets individually selectable
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-01 13:01:04 +01:00
Denys Vlasenko
e1065da652 Tweak some config defaults; fix MODPROBE_SMALL ordering in "make config"
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-01 13:01:04 +01:00
Denys Vlasenko
e184a88356 df: implement -B n<suff> and -B <suff> formats of -B option
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-12-12 19:56:31 +01:00
Denys Vlasenko
4f13a70507 suppress glibc "use sysmacros.h for major" warning
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-12-12 16:29:32 +01:00
Mike Frysinger
c6f35241b3 selinux: drop deprecated headers
The selinux guys want you to get class values at runtime by converting
textual names into constants.  Drop the deprecated headers and switch
to the new format.

This API has been around for years, so there shouldn't be an issue
with backwards compatibility.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2016-12-09 18:30:30 -05:00
Denys Vlasenko
548620c18b randomconfig fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-12-08 12:24:48 +01:00
Rostislav Skudnov
2e4ef38743 lineedit: fix handling of repeating Alt-b, Alt-f, Alt-d, Alt-Backspace
These key combinations should repeat correctly when the keys are
pressed and held.

Before this change, they do this erratically - many repeats are "eaten"
because they are treated as unrecognized ESC seqs:
ESC 0x7f is treated by Alt+baskspace, but ESC 0x7f ESC 0x7f ESC 0x7f
is unrecognized.

Escape sequences corresponding to these key combinations are moved from
read_line_input to lineedit_read_key.

Also, these key sequences are now enabled regardless of whether
FEATURE_EDITING_VI is set, since Vim does not actually support these key
combinations, but they are present in readline library.

function                                             old     new   delta
static.esccmds                                        93     103     +10
read_line_input                                     3737    3687     -50

Signed-off-by: Rostislav Skudnov <rostislav@tuxera.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-24 15:04:00 +01:00
Denys Vlasenko
5bbee27c0f Remove outdated comments
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-23 21:51:11 +01:00
Denys Vlasenko
f7683cdf83 Convert all udhcp applets to "new style" applet definitions
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-23 18:54:59 +01:00
Denys Vlasenko
a8e52da774 Convert all selinux/* applets to "new style" applet definitions
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-23 18:46:40 +01:00
Denys Vlasenko
15fb91cefb test: make [ and [[ forms individually selectable
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-23 18:31:48 +01:00
Denys Vlasenko
73f743a381 Remove remnants of disabled "length" applet
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-23 14:54:38 +01:00
Denys Vlasenko
af3f420116 Convert all coreutils/* applets to "new style" applet definitions
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-23 14:46:56 +01:00
Denys Vlasenko
dd898c9f33 Convert all util-linux/* applets to "new style" applet definitions
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-23 11:46:32 +01:00
Denys Vlasenko
6d9329935c Convert all console-tools/* applets to "new style" applet definitions
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-23 10:39:27 +01:00
Denys Vlasenko
c19f7584e1 Convert all mailutils/* applets to "new style" applet definitions
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-23 09:58:03 +01:00
Denys Vlasenko
29e2c45a5b tc: consolidate its disabled bits
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-23 09:51:33 +01:00
Denys Vlasenko
47367e1d50 Convert all networking/* applets to "new style" applet definitions
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-23 09:05:14 +01:00
Denys Vlasenko
f8f81ed7aa Convert all procps/* applets to "new style" applet definitions
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-23 06:23:44 +01:00
Denys Vlasenko
f88e3bfa8d Convert all miscutils/* applets to "new style" applet definitions
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-22 23:54:17 +01:00
Denys Vlasenko
f4d0f4e7a9 applets.h.sh: a script to check applet names against config options
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-17 15:34:16 +01:00
Denys Vlasenko
10880cc20f Make mkfs.vfat and mkdosfs individually selectable
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-16 16:18:50 +01:00
Denys Vlasenko
0581a2f304 Make mke2fs and mkfs.ext2 individually selectable
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-16 16:12:11 +01:00
Denys Vlasenko
a8c696bf09 Make ifup and ifdown individually selectable.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-14 18:31:07 +01:00
Denys Vlasenko
f417ffd88f Make swapon and swapoff individually selectable.
For example, without swapoff, code shrinks by 277 bytes.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-14 17:30:50 +01:00
Denys Vlasenko
67fd2f2858 dnsdomainname: split it from "hostname", make it independently selectable
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-13 22:35:10 +01:00
Denys Vlasenko
79e2598c48 su: expand help; simplify passing of -c CMD to run_shell()
Also, added a comment about bug 9401 (TIOCSTI input injection).

function                                             old     new   delta
packed_usage                                       30909   30932     +23
su_main                                              470     487     +17
sulogin_main                                         260     258      -2
run_applet_and_exit                                  681     678      -3
run_shell                                            166     126     -40

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-03 22:13:08 +01:00
Denys Vlasenko
0ae0509679 libbb: do not use fflush_unlocked, musl does not like fflush_unlocked(NULL)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-09-18 21:49:30 +02:00
Denys Vlasenko
71a090f187 sha3: fix to conform to final SHA3 padding standard, add -a BITS option
function                                             old     new   delta
hash_file                                            331     396     +65
md5_sha1_sum_main                                    485     538     +53
packed_usage                                       30423   30464     +41
sha3_begin                                            17      31     +14
sha3_hash                                            101     110      +9
sha3_end                                              41      49      +8

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-08-29 14:05:25 +02:00
Denys Vlasenko
aa3576a29b hush: fix "redirects can close script fd" bug
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-08-22 19:54:12 +02:00
Denys Vlasenko
0fb0045aa9 config: disentangle PREFER_APPLETS from SH_STANDALONE and SH_NOFORK
On user request.
I thought enabling/disabling them all together is more consistent.
Evidently, some people do want them to be separately selectable.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-07-22 18:48:38 +02:00
Denys Vlasenko
984b0a613a 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>
2016-06-20 11:06:42 +02:00
Ron Yorston
ce824aecf2 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>
2016-06-19 15:16:27 +02:00
Denys Vlasenko
877dedb825 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>
2016-05-27 00:46:38 +02:00
Denys Vlasenko
4c8fa34417 generate_BUFSIZ.sh: yet another tweak
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-04-24 14:13:35 +02:00
Denys Vlasenko
e6a2f4cc5a 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>
2016-04-21 17:39:11 +02:00
Denys Vlasenko
6aab9928de whitespace and namespace cleanups
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-04-03 22:24:51 +02:00
Sven Eisenberg
b068cf2a7e 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>
2016-04-03 22:01:43 +02:00
Denys Vlasenko
8220399173 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>
2016-04-02 18:06:24 +02:00
Denys Vlasenko
c4199f22d0 libbb: two new functions: wait_for_exitstatus(pid), xfchdir(fd)
Bartosz Golaszewski proposed xfchdir()

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-04-01 22:12:44 +02:00
Denys Vlasenko
8f2e99c813 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>
2016-03-30 18:41:23 +02:00
Ron Yorston
610c4c385b 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>
2016-03-30 00:44:11 +02:00
Denys Vlasenko
dbb58a3879 fixes for problems found by bionic build
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-14 18:23:33 +01:00
Kylie McClain
40eea690c7 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>
2016-02-01 01:36:05 +01:00
Ari Sundholm
b505251242 include/platform.h: Remove extra #endif introduced in 6df9612.
It causes the compilation to fail.

Signed-off-by: Ari Sundholm <ari@tuxera.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2015-12-17 15:54:04 -05:00
Chris Renshaw
6df961257d Resolve linker issues with Android API 21 (dprintf, tcdrain)
Signed-off-by: Chris Renshaw <osm0sis@outlook.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-12-17 16:42:41 +01:00
Denys Vlasenko
641caaec3d libbb: factor out code which queries screen width
function                                             old     new   delta
get_terminal_width                                     -      17     +17
stty_main                                           1196    1197      +1
pstree_main                                          321     319      -2
ls_main                                              735     731      -4
watch_main                                           232     225      -7
bb_progress_update                                   714     706      -8
ps_main                                              555     543     -12
run_applet_and_exit                                  708     695     -13
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/6 up/down: 18/-46)            Total: -28 byte

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-23 01:44:22 +02:00
Denys Vlasenko
accd9eeb71 remove systemd support
systemd people are not willing to play nice with the rest of the world.
Therefore there is no reason for the rest of the world to cooperate with them.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-22 16:01:57 +02:00
Denys Vlasenko
6c563e370d tar: add support for --strip-components=N
function                                             old     new   delta
data_extract_all                                     882     995    +113
tar_longopts                                         290     309     +19
tar_main                                             938     942      +4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 136/0)             Total: 136 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-22 01:07:13 +02:00
Denys Vlasenko
f2ccefb946 setarch: add support for '-R' (disable randomization)
This commit adds support for the -R flag of setarch, which disables
randomization of the virtual address space.

function                                             old     new   delta
setarch_main                                         115     150     +35
packed_usage                                       30664   30651     -13

Signed-off-by: Jan Heylen <heyleke@gmail.com>
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-19 23:26:50 +02:00