After commit 8e74adab01
("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>
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>
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>
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>
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>
CC util-linux/swaponoff.o
cc1: warnings being treated as errors
util-linux/swaponoff.c: In function 'swap_enable_disable':
util-linux/swaponoff.c💯 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>
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>
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>
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>
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>
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>
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>
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>
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>
The -H NAME is deprecated in udhcpc. See commit
2017d48c0d
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
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>
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>
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>
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>
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>
This reverts commit 7e66102f76 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>
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>