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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Denys Vlasenko [Fri, 18 Dec 2015 18:02:31 +0000 (19:02 +0100)]
swaponoff: fix compile-time warning
CC util-linux/swaponoff.o
cc1: warnings being treated as errors
util-linux/swaponoff.c: In function 'swap_enable_disable':
util-linux/swaponoff.c:100: warning: passing argument 1 of 'resolve_mount_spec' from incompatible pointer type
make[1]: *** [util-linux/swaponoff.o] Error 1
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Pascal Bach [Fri, 18 Dec 2015 18:01:14 +0000 (19:01 +0100)]
chpasswd: support -c argument and respect DEFAULT_PASSWD_ALGO
Signed-off-by: Pascal Bach <pascal.bach@siemens.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Ari Sundholm [Thu, 17 Dec 2015 18:43:12 +0000 (20:43 +0200)]
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>
Chris Renshaw [Thu, 17 Dec 2015 15:42:01 +0000 (16:42 +0100)]
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>
Mike Frysinger [Wed, 16 Dec 2015 19:42:25 +0000 (14:42 -0500)]
blkid: add bcache support
URL: https://bugs.gentoo.org/508596
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Mike Frysinger [Wed, 16 Dec 2015 17:59:08 +0000 (12:59 -0500)]
swapon/swapoff: refine the -e (ifexists) option
The -e option should only apply to swapon, and it should swallow all
errors/warnings when the device does not exist. So delete the flag
from the swapoff patch and unify the check in the swapoff path.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Mike Frysinger [Tue, 1 Dec 2015 16:25:10 +0000 (11:25 -0500)]
trylink: include LDFLAGS when checking linkage
The user might be including options in their LDFLAGS (like -fuse-ld=gold)
that change the behavior of the linker and thus change the results of the
flag tests. Make sure we include the user's LDFLAGS when running these
tests so we filter out flags that will fail when used later on.
URL: https://bugs.gentoo.org/499712
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Denys Vlasenko [Fri, 6 Nov 2015 14:50:28 +0000 (15:50 +0100)]
modutils: fix build error with !DEPMOD
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Timo Teräs [Thu, 5 Nov 2015 17:54:55 +0000 (18:54 +0100)]
modutils: merge module_entry and module_info to common
This merges the in-memory module info structures of modprobe
and depmod. This allows sharing hashing by modulename code
improving depmod runtime with almost factor of 2x.
function old new delta
get_or_add_modentry - 17 +17
do_modprobe 590 601 +11
moddb_get_or_create - 10 +10
load_modules_dep 195 205 +10
moddb_get - 7 +7
add_probe 81 78 -3
modprobe_main 721 714 -7
depmod_main 553 543 -10
config_file_action 434 421 -13
helper_get_module 160 144 -16
parse_module 343 320 -23
order_dep_list 105 82 -23
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 2/7 up/down: 55/-95) Total: -40 bytes
Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Wed, 4 Nov 2015 18:39:54 +0000 (19:39 +0100)]
TODO file: remove mpstat, iostat, powertop - we have them now
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Ron Yorston [Tue, 3 Nov 2015 09:42:23 +0000 (09:42 +0000)]
ash: add support for bash 'function' keyword
Where the POSIX shell allows functions to be defined as:
name () compound-command [ redirections ]
bash adds the alternative syntax:
function name [()] compound-command [ redirections ]
Implement this in ash's bash compatibility mode. Most compound
commands work (for/while/until/if/case/[[]]/{}); one exception is:
function f (echo "no way!")
The other two variants work:
f() (echo "ok")
function f() (echo "also ok")
function old new delta
parse_command 1555 1744 +189
tokname_array 232 240 +8
.rodata 155612 155566 -46
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 197/-46) Total: 151 bytes
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Wed, 4 Nov 2015 13:50:19 +0000 (14:50 +0100)]
hush-misc/func_args1.tests: remove "UNFIXED BUG", it does not fail
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Ron Yorston [Tue, 3 Nov 2015 09:37:40 +0000 (09:37 +0000)]
ash: copy function tests from hush testsuite
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Sun, 1 Nov 2015 19:57:34 +0000 (20:57 +0100)]
i2c_tools: suppress "'blen' may be used uninitialized in this function"
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Bartosz Golaszewski [Tue, 27 Oct 2015 16:15:05 +0000 (17:15 +0100)]
i2cdump: display the numeric value for block read ioctl() errors
This makes busybox i2cdump compatible with the upstream version, which
also displays the numeric error value in case of a block read failure.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Bartosz Golaszewski [Tue, 27 Oct 2015 16:15:04 +0000 (17:15 +0100)]
i2cdump: bail-out if block read fails
We should bail-out if i2c_smbus_read_block_data() or
i2c_smbus_read_i2c_block_data() return 0 or less. Add the missing check
for the former and fix the existing for the latter.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Bartosz Golaszewski [Tue, 27 Oct 2015 16:15:03 +0000 (17:15 +0100)]
i2cdump: use I2C block mode for the 'i' mode parameter
Currently we're calling i2c_smbus_read_block_data() for both 'i' and 's'
mode parameters. If the bus doesn't support SMBus block mode, then the
i2c access ioctl() fails. Make i2cdump behave compatibly with upstream
version by calling i2c_smbus_read_i2c_block_data() for I2C block.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Bartosz Golaszewski [Tue, 27 Oct 2015 16:15:02 +0000 (17:15 +0100)]
i2cdump: don't read block data in non-block modes
We currently read data twice in byte mode. Add a check to avoid calling
i2c_smbus_read_i2c_block_data() if we're not in I2C or SMBus block mode.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Bartosz Golaszewski [Tue, 27 Oct 2015 16:15:01 +0000 (17:15 +0100)]
i2cdetect: coding style: add a space after 'for'
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Bartosz Golaszewski [Tue, 27 Oct 2015 16:15:00 +0000 (17:15 +0100)]
i2cdetect: fix address skipping in auto mode
If the bus doesn't support SMBus Quick Write or Receive Byte commands
and we're running in auto mode all addresses will be skipped resulting
in an empty table being printed.
This is caused by not restoring the auto mode after it's been changed
for certain address ranges - we need an additional variable to hold the
temporary state.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Natanael Copa [Wed, 19 Sep 2012 14:55:08 +0000 (16:55 +0200)]
ifupdown: use -x hostname:NAME with udhcpc
The -H NAME is deprecated in udhcpc. See commit
2017d48c0d70bef8768efb42909e605ea8eb5a21
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Fri, 30 Oct 2015 22:41:53 +0000 (23:41 +0100)]
[g]unzip: fix recent breakage.
Also, do emit error message we so painstakingly pass from gzip internals
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Ron Yorston [Fri, 30 Oct 2015 19:07:37 +0000 (19:07 +0000)]
ash: allow popredir to be called if the stack is empty
If /tmp/test.sh is a script that tries to run a second script which
happens to be non-executable this:
command . /tmp/test.sh
causes a seg fault.
This is because clearredir is called in the error path to clear the
stack of redirections. The normal path then calls popredir, but popredir
fails when the stack is empty.
Reported-by: Bastian Bittorf <bittorf@bluebottle.com>
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Ron Yorston [Fri, 30 Oct 2015 19:06:47 +0000 (19:06 +0000)]
ash: fix EXEXEC status clobbering
evalcommand always clobbers the exit status in case of an EXEXEC
which means that exec always fails with exit status 2 regardless
of what it actually returns.
This patch adds the missing check for EXEXEC so that the correct
exit status is preserved. It causes the test ash-misc/exec.tests
to succeed.
Based on commit
7f68426 in dash git, by Herbert Xu.
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Ron Yorston [Fri, 30 Oct 2015 19:05:55 +0000 (19:05 +0000)]
ash: add tests for failures of the exec and command builtins
The exec builtin should return an exit status of 127 if the command
can't be found. It doesn't: it returns 2.
If the command builtin is used to source a script that runs a second
script that doesn't exist ash should issue an error. Instead it seg
faults.
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Fri, 30 Oct 2015 21:10:44 +0000 (22:10 +0100)]
stat: make -f optional. This allows to build stat for non-linux systems
function old new delta
packed_usage 30761 30706 -55
Based on the patch by Ron Yorston.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Fri, 30 Oct 2015 20:39:19 +0000 (21:39 +0100)]
lineedit: FEATURE_REVERSE_SEARCH should not depend on SAVEHISTORY
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Ron Yorston [Fri, 29 May 2015 10:31:40 +0000 (11:31 +0100)]
lineedit: search applets as well as PATH for tab completion
In standalone shell mode search the applet table as well as PATH
when tab completing a command.
Use a stupid linear search: we're also about to read all the
directories on PATH so efficiency isn't a big concern.
function old new delta
add_match - 53 +53
complete_cmd_dir_file 687 724 +37
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/0 up/down: 90/0) Total: 90 bytes
Signed-off-by: Ron Yorston <rmy@frippery.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Ron Yorston [Sat, 30 May 2015 16:13:52 +0000 (17:13 +0100)]
busybox: alter help message in standalone shell mode
Signed-off-by: Ron Yorston <rmy@frippery.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Thu, 29 Oct 2015 21:37:25 +0000 (22:37 +0100)]
hush: copy for.tests from ash testsuite
This test passes for hush
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Ron Yorston [Thu, 29 Oct 2015 11:30:55 +0000 (11:30 +0000)]
ash: simplify EOF/newline handling in list parser
Processing of here documents in ash has had a couple of breakages
which are now the subject of tests. This commit should fix both.
It is based on the following commit in dash git by Herbert Xu:
<
7c245aa> [PARSER] Simplify EOF/newline handling in list parser
(See git://git.kernel.org/pub/scm/utils/dash/dash.git)
Reported-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Ron Yorston [Thu, 29 Oct 2015 11:30:22 +0000 (11:30 +0000)]
Revert "ash: fix a SEGV case in an invalid heredoc" xxx
This reverts commit
7e66102f762a7d80715f0c7e5925433256b78cee but
leaves the test in place as it's still valid.
Reported-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Ron Yorston [Thu, 29 Oct 2015 16:44:56 +0000 (16:44 +0000)]
ash: fix error during recursive processing of here document
Save the value of the checkkwd flag to prevent it being clobbered
during recursion.
Based on commit
ec2c84d from git://git.kernel.org/pub/scm/utils/dash/dash.git
by Herbert Xu.
function old new delta
readtoken 190 203 +13
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/0 up/down: 13/0) Total: 13 bytes
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Thu, 29 Oct 2015 19:29:05 +0000 (20:29 +0100)]
ash tests: make test print test name before it is run
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Ron Yorston [Thu, 29 Oct 2015 16:19:14 +0000 (16:19 +0000)]
ash: only allow local variables in functions
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Ron Yorston [Mon, 3 Aug 2015 12:47:33 +0000 (13:47 +0100)]
ash: respect -p flag when command builtin is run with -v/-V
The command builtin should only check the default path, not $PATH,
when the -p flag is used along with -v/-V.
Based on commits
65ae84b (by Harald van Dijk) and
29ee27d (by Herbert
Xu) from git://git.kernel.org/pub/scm/utils/dash/dash.git).
function old new delta
commandcmd 72 87 +15
describe_command 437 450 +13
typecmd 84 86 +2
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 30/0) Total: 30 bytes
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Thu, 29 Oct 2015 18:46:40 +0000 (19:46 +0100)]
ash: fix command -- crash
busybox sh -c 'command --' segfaults because parse_command_args
returns a pointer to a null pointer.
Based on commit
18071c7 from git://git.kernel.org/pub/scm/utils/dash/dash.git
by Gerrit Pape.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Ron Yorston [Mon, 3 Aug 2015 12:46:25 +0000 (13:46 +0100)]
ash: save a few bytes in code to parse case statements
Based on commit
49b82fc from git://git.kernel.org/pub/scm/utils/dash/dash.git
by Herbert Xu.
function old new delta
parse_command 1563 1555 -8
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-8) Total: -8 bytes
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Ron Yorston [Mon, 3 Aug 2015 12:46:00 +0000 (13:46 +0100)]
ash: allow newline after variable name in for loop
Newline is a valid delimiter between the variable name and `in`
keyword in for loops.
Based on commit
22e8fb4 from git://git.kernel.org/pub/scm/utils/dash/dash.git
by Herbert Xu.
function old new delta
parse_command 1568 1563 -5
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-5) Total: -5 bytes
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Ron Yorston [Thu, 29 Oct 2015 11:29:59 +0000 (11:29 +0000)]
ash: add test for issue with here document
This used to work but doesn't now:
foo () {
cat <<EOF && { echo "$1" ; }
$1
EOF
}
foo "bar"
Reported-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>