From 198b02f7dd61c6cb9fd4c379dc56edcf537a7ee1 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Tue, 31 Dec 2013 23:22:36 +0100 Subject: fix failures found by randomconfig builds Signed-off-by: Denys Vlasenko --- libbb/Kbuild.src | 2 +- libbb/correct_password.c | 9 --------- libbb/in_ether.c | 1 + libbb/nuke_str.c | 21 +++++++++++++++++++++ scripts/randomtest | 2 ++ testsuite/awk.tests | 6 +++++- testsuite/tar.tests | 6 ++++-- 7 files changed, 34 insertions(+), 13 deletions(-) create mode 100644 libbb/nuke_str.c diff --git a/libbb/Kbuild.src b/libbb/Kbuild.src index c5d86c092..a6468f171 100644 --- a/libbb/Kbuild.src +++ b/libbb/Kbuild.src @@ -144,7 +144,7 @@ lib-$(CONFIG_DELUSER) += update_passwd.o lib-$(CONFIG_PASSWD) += pw_encrypt.o update_passwd.o obscure.o lib-$(CONFIG_CHPASSWD) += pw_encrypt.o update_passwd.o lib-$(CONFIG_CRYPTPW) += pw_encrypt.o -lib-$(CONFIG_SULOGIN) += pw_encrypt.o +lib-$(CONFIG_SULOGIN) += pw_encrypt.o correct_password.o lib-$(CONFIG_VLOCK) += pw_encrypt.o correct_password.o lib-$(CONFIG_SU) += pw_encrypt.o correct_password.o lib-$(CONFIG_LOGIN) += pw_encrypt.o correct_password.o diff --git a/libbb/correct_password.c b/libbb/correct_password.c index 5727c65fb..acadf3914 100644 --- a/libbb/correct_password.c +++ b/libbb/correct_password.c @@ -30,15 +30,6 @@ #include "libbb.h" -void FAST_FUNC nuke_str(char *str) -{ - if (str) { - while (*str) - *str++ = 0; - /* or: memset(str, 0, strlen(str)); - not as small as above */ - } -} - /* Ask the user for a password. * Return 1 without asking if PW has an empty password. * Return -1 on EOF, error while reading input, or timeout. diff --git a/libbb/in_ether.c b/libbb/in_ether.c index dadadbafe..1de383bde 100644 --- a/libbb/in_ether.c +++ b/libbb/in_ether.c @@ -3,6 +3,7 @@ * Utility routines. */ +//kbuild:lib-$(CONFIG_ARP) += in_ether.o //kbuild:lib-$(CONFIG_IFCONFIG) += in_ether.o //kbuild:lib-$(CONFIG_IFENSLAVE) += in_ether.o diff --git a/libbb/nuke_str.c b/libbb/nuke_str.c new file mode 100644 index 000000000..56b808bc7 --- /dev/null +++ b/libbb/nuke_str.c @@ -0,0 +1,21 @@ +/* vi: set sw=4 ts=4: */ +/* + * Utility routines. + * + * Copyright (C) 2008 Denys Vlasenko + * + * Licensed under GPLv2, see file LICENSE in this source tree. + */ + +//kbuild:lib-y += nuke_str.o + +#include "libbb.h" + +void FAST_FUNC nuke_str(char *str) +{ + if (str) { + while (*str) + *str++ = 0; + /* or: memset(str, 0, strlen(str)); - not as small as above */ + } +} diff --git a/scripts/randomtest b/scripts/randomtest index a102593d3..d2b26bc76 100755 --- a/scripts/randomtest +++ b/scripts/randomtest @@ -65,6 +65,7 @@ if test x"$LIBC" = x"uclibc"; then | grep -v CONFIG_BUILD_LIBBUSYBOX \ | grep -v CONFIG_PIE \ \ + | grep -v CONFIG_FEATURE_TOUCH_NODEREF \ | grep -v CONFIG_FEATURE_2_4_MODULES \ >.config.new mv .config.new .config @@ -72,6 +73,7 @@ if test x"$LIBC" = x"uclibc"; then echo '# CONFIG_BUILD_LIBBUSYBOX is not set' >>.config echo '# CONFIG_PIE is not set' >>.config echo '# CONFIG_FEATURE_2_4_MODULES is not set' >>.config + echo '# CONFIG_FEATURE_TOUCH_NODEREF is not set' >>.config fi # If STATIC, remove some things. diff --git a/testsuite/awk.tests b/testsuite/awk.tests index 50b2a8328..132afc6a9 100755 --- a/testsuite/awk.tests +++ b/testsuite/awk.tests @@ -269,10 +269,12 @@ testing "awk FS assignment" "awk '{FS=\":\"; print \$1}'" \ "" \ "a:b c:d\ne:f g:h" +optional FEATURE_AWK_LIBM testing "awk large integer" \ "awk 'BEGIN{n=(2^31)-1; print n, int(n), n%1, ++n, int(n), n%1}'" \ "2147483647 2147483647 0 2147483648 2147483648 0\n" \ "" "" +SKIP= testing "awk length(array)" \ "awk 'BEGIN{ A[1]=2; A[\"qwe\"]=\"asd\"; print length(A)}'" \ @@ -285,11 +287,13 @@ testing "awk -f and ARGC" \ "do re mi\n" \ '{print $2; print ARGC;}' \ +optional FEATURE_AWK_GNU_EXTENSIONS testing "awk -e and ARGC" \ "awk -e '{print \$2; print ARGC;}' input" \ "re\n2\n" \ "do re mi\n" \ - "" \ + "" +SKIP= # testing "description" "command" "result" "infile" "stdin" diff --git a/testsuite/tar.tests b/testsuite/tar.tests index 93ba5f004..9ea89f15f 100755 --- a/testsuite/tar.tests +++ b/testsuite/tar.tests @@ -25,10 +25,12 @@ tar: short read SKIP= optional FEATURE_SEAMLESS_GZ +# In NOMMU case, "invalid magic" message comes from gunzip child process. +# Otherwise, it comes from tar. +# Need to fix output up to avoid false positive. testing "Empty file is not a tarball.tar.gz" '\ -tar xvzf - 2>&1; echo $? +{ tar xvzf - 2>&1; echo $?; } | grep -Fv "invalid magic" ' "\ -tar: invalid magic tar: short read 1 " \ -- cgit v1.2.3