Age | Commit message (Collapse) | Author |
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
On Sat, Feb 9, 2019 Cristian Ionescu-Idbohrn wrote:
> In my case (at work), I have to watch and prevent people from doing
> unportable things. For me, that's a burden.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
The original commit 3bef5d89b0 introduced an additional check
for an unset `opt_d` before doing word splitting. I'm unsure
why it's there in the first place, but the commit message also
describes a different behaviour than what -d actually does in
bash, while the code mostly does the right thing.
`opt_d` sets the line delimiter for read to stop reading and
should not affect word splitting.
Testcase:
$ echo qwe rty | { read -d Z a b; echo a:$a b:$b; }
a:qwe b:rty
function old new delta
shell_builtin_read 1314 1304 -10
Signed-off-by: Eicke Herbertz <wolletd@posteo.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
text data bss dec hex filename
1021988 559 5052 1027599 fae0f busybox_old
1021236 559 5052 1026847 fab1f busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
With bash's read builtin it is possible to read from a file (e.g.
device-tree) until the first '\0' character:
IFS= read -r -d '' VARIABLE < file
In busybox ash the -d extension is also implemented, but checking the
read character for '\0' has to be performed after comparing with the
delimiter.
Signed-off-by: Christian Eggers <ceggers@arri.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
text data bss dec hex filename
1001949 551 5612 1008112 f61f0 busybox_old
1001906 551 5612 1008069 f61c5 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Back in 2007, commit 0c97c9d43707 ("'simple' error message functions by
Loic Grenie") introduced bb_simple_perror_msg() to allow for a lower
overhead call to bb_perror_msg() when only a string was being printed
with no parameters. This saves space for some CPU architectures because
it avoids the overhead of a call to a variadic function. However there
has never been a simple version of bb_error_msg(), and since 2007 many
new calls to bb_perror_msg() have been added that only take a single
parameter and so could have been using bb_simple_perror_message().
This changeset introduces 'simple' versions of bb_info_msg(),
bb_error_msg(), bb_error_msg_and_die(), bb_herror_msg() and
bb_herror_msg_and_die(), and replaces all calls that only take a
single parameter, or use something like ("%s", arg), with calls to the
corresponding 'simple' version.
Since it is likely that single parameter calls to the variadic functions
may be accidentally reintroduced in the future a new debugging config
option WARN_SIMPLE_MSG has been introduced. This uses some macro magic
which will cause any such calls to generate a warning, but this is
turned off by default to avoid use of the unpleasant macros in normal
circumstances.
This is a large changeset due to the number of calls that have been
replaced. The only files that contain changes other than simple
substitution of function calls are libbb.h, libbb/herror_msg.c,
libbb/verror_msg.c and libbb/xfuncs_printf.c. In miscutils/devfsd.c,
networking/udhcp/common.h and util-linux/mdev.c additonal macros have
been added for logging so that single parameter and multiple parameter
logging variants exist.
The amount of space saved varies considerably by architecture, and was
found to be as follows (for 'defconfig' using GCC 7.4):
Arm: -92 bytes
MIPS: -52 bytes
PPC: -1836 bytes
x86_64: -938 bytes
Note that for the MIPS architecture only an exception had to be made
disabling the 'simple' calls for 'udhcp' (in networking/udhcp/common.h)
because it made these files larger on MIPS.
Signed-off-by: James Byrne <james.byrne@origamienergy.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
helper_export_local 215 253 +38
leave_var_nest_level 107 127 +20
run_pipe 1840 1857 +17
handle_changed_special_names 101 105 +4
shell_builtin_read 1399 1398 -1
done_word 767 766 -1
parse_stream 2249 2245 -4
set_local_var 437 430 -7
is_well_formed_var_name 66 - -66
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 4/4 up/down: 79/-79) Total: 0 bytes
text data bss dec hex filename
952376 485 7296 960157 ea69d busybox_old
952400 485 7296 960181 ea6b5 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
limits_tbl 104 120 +16
ulimit_opt_string 44 50 +6
limit_chars 14 16 +2
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 24/0) Total: 24 bytes
text data bss dec hex filename
981996 485 7296 989777 f1a51 busybox_old
982065 485 7296 989846 f1a96 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
shell_builtin_ulimit 486 651 +165
limit_chars - 14 +14
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/0 up/down: 179/0) Total: 179 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
getoptscmd 587 584 -3
readcmd 240 224 -16
shell_builtin_read 1426 1399 -27
builtin_read 210 182 -28
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/4 up/down: 0/-74) Total: -74 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
$ echo "X:Y:" | (IFS=": " read x y; echo "|$x|$y|")
|X|Y|
$ echo "X:Y : " | (IFS=": " read x y; echo "|$x|$y|")
|X|Y|
function old new delta
shell_builtin_read 1320 1426 +106
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
NOEXEC'ed applets which use getopt() need this.
function old new delta
builtin_getopts 403 413 +10
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
shell_builtin_read 1334 1320 -14
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
The POSIX standard only requires the read builtin to handle -r:
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/read.html
However, Bash introduced the option -d <DELIM> to override IFS for
just one invocation, and it is quite useful.
It is also super easy to implement in BusyBox' ash, so let's do that.
The motivation: This option is used by Git's test suite.
function old new delta
.rodata 163505 163587 +82
shell_builtin_read 1244 1289 +45
readcmd 233 259 +26
builtin_read 258 263 +5
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/0 up/down: 158/0) Total: 158 bytes
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
shell_builtin_read 1097 1277 +180
dump_procs 353 359 +6
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
readcmd 169 217 +48
shell_builtin_read 1087 1097 +10
localcmd 366 364 -2
builtin_read 197 193 -4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/2 up/down: 58/-6) Total: 52 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
set_termios_to_raw - 116 +116
count_lines 72 74 +2
powertop_main 1458 1430 -28
top_main 943 914 -29
more_main 759 714 -45
fsck_minix_main 2969 2921 -48
conspy_main 1197 1135 -62
rawmode 99 36 -63
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/6 up/down: 118/-275) Total: -157 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Upstream commit 1:
Date: Fri, 23 Aug 2013 21:27:42 +1000
[VAR] Initialise OPTIND after importing environment
On Sat, Mar 23, 2013 at 01:46:20AM +0000, Chris F.A. Johnson wrote:
> According to both the dash man page and the POSIX spec, "When the
> shell is invoked, OPTIND is initialized to 1."
>
> However, it actually takes the value of the environment variable
> if it exists:
>
> $ OPTIND=4 dash -c 'echo "$OPTIND"'
> 4
> $ OPTIND=4 bash -c 'echo "$OPTIND"'
> 1
> $ OPTIND=4 ksh -c 'echo "$OPTIND"'
> 1
> $ OPTIND=4 ksh93 -c 'echo "$OPTIND"'
> 1
This patch fixes this by initialising OPTIND after importing the
environment.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Upstream commit 2:
Date: Tue, 7 Oct 2014 22:24:42 +0800
[VAR] Use setvareq to set OPTIND initially
There is no need to setvarint to set the initial value of OPTIND
of one. This patch switchs to setvareq which also lets us avoid
an unnecessary memory allocation.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
The result of looking at "grep -F -B2 '*fill*' busybox_unstripped.map"
text data bss dec hex filename
829901 4086 1904 835891 cc133 busybox_before
829665 4086 1904 835655 cc047 busybox
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Benefits are: drops reference to out-of-line putchar(), fixes a few cases
of failed string merge.
function old new delta
i2cdump_main 1488 1502 +14
sha256_process_block64 423 433 +10
sendmail_main 1183 1185 +2
list_table 1114 1116 +2
i2cdetect_main 1235 1237 +2
fdisk_main 2852 2854 +2
builtin_type 119 121 +2
unicode_conv_to_printable2 325 324 -1
scan_recursive 380 378 -2
mkfs_minix_main 2687 2684 -3
buffer_fill_and_print 178 169 -9
putchar 152 - -152
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 7/4 up/down: 34/-167) Total: -133 bytes
text data bss dec hex filename
937788 932 17676 956396 e97ec busybox_old
937564 932 17676 956172 e970c busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
This patch removes stray empty line from busybox code
reported by script find_stray_empty_lines
Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
Signed-off-by: Akhilesh Kumar <akhilesh.k@samsung.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
We use functions from sys/resource.h in misc applets, but don't include
the header. This breaks building with newer glibc versions, so add the
include where needed.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
|
|
First change fixes "read -n NUM". Apparently poll() won't report
data availability if cc[VMIN] > 1 until there are at least cc[VMIN] bytes.
function old new delta
read_line_input 3885 3877 -8
shell_builtin_read 1097 1087 -10
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-18) Total: -18 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
builtin_read 185 471 +286
check_and_run_traps 200 262 +62
nonblock_immune_read 73 119 +46
sigismember - 44 +44
record_signal - 21 +21
sigisemptyset - 16 +16
...
------------------------------------------------------------------------------
(add/remove: 5/0 grow/shrink: 7/5 up/down: 483/-46) Total: 437 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
xmalloc_reads
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Elsewhere: use common error message. -30 bytes net size change
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
This change retains "or later" state! No licensing _changes_ here,
only form is adjusted (article, space between "GPL" and "v2" and so on).
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
shell_builtin_ulimit 494 498 +4
Signed-off-by: Alexander Shishkin <virtuoso@slind.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
shell_builtin_read 1000 1055 +55
parse_command 1460 1463 +3
builtin_umask 121 123 +2
is_well_formed_var_name 73 66 -7
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|