From 26777aa1c659b229f07205291241e45e64712a72 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 22 Nov 2010 23:49:10 +0100 Subject: [PATCH] fixes for bugs discovered by randomconfig builds and tests Signed-off-by: Denys Vlasenko --- libbb/Kbuild.src | 1 + scripts/randomtest.loop | 2 +- shell/ash.c | 9 ++++++++- shell/hush.c | 6 ++++-- testsuite/du/du-h-works | 2 +- testsuite/md5sum.tests | 5 +++++ util-linux/acpid.c | 11 ++++++----- 7 files changed, 26 insertions(+), 10 deletions(-) diff --git a/libbb/Kbuild.src b/libbb/Kbuild.src index 806cace..0fa1451 100644 --- a/libbb/Kbuild.src +++ b/libbb/Kbuild.src @@ -158,6 +158,7 @@ lib-$(CONFIG_RTCWAKE) += rtc.o lib-$(CONFIG_IOSTAT) += get_cpu_count.o lib-$(CONFIG_MPSTAT) += get_cpu_count.o +lib-$(CONFIG_POWERTOP) += get_cpu_count.o # We shouldn't build xregcomp.c if we don't need it - this ensures we don't # require regex.h to be in the include dir even if we don't need it thereby diff --git a/scripts/randomtest.loop b/scripts/randomtest.loop index 311536d..2c8a9bd 100755 --- a/scripts/randomtest.loop +++ b/scripts/randomtest.loop @@ -4,7 +4,7 @@ test -d "$1" || { echo "'$1' is not a directory"; exit 1; } test -x "$1/scripts/randomtest" || { echo "No scripts/randomtest in '$1'"; exit 1; } export LIBC="uclibc" -export CROSS_COMPILER_PREFIX="i486-linux-uclibc-" +export CROSS_COMPILER_PREFIX="i686-" export MAKEOPTS="-j9" cnt=0 diff --git a/shell/ash.c b/shell/ash.c index 5ef7efb..5671a52 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -43,7 +43,9 @@ #include #include "shell_common.h" -#include "math.h" +#if ENABLE_SH_MATH_SUPPORT +# include "math.h" +#endif #if ENABLE_ASH_RANDOM_SUPPORT # include "random.h" #else @@ -5510,6 +5512,11 @@ static struct arglist exparg; /* * Our own itoa(). */ +#if !ENABLE_SH_MATH_SUPPORT +/* cvtnum() is used even if math support is off (to prepare $? values and such) */ +typedef long arith_t; +# define ARITH_FMT "%ld" +#endif static int cvtnum(arith_t num) { diff --git a/shell/hush.c b/shell/hush.c index da32c24..26a5074 100644 --- a/shell/hush.c +++ b/shell/hush.c @@ -712,11 +712,11 @@ struct globals { int last_jobid; pid_t saved_tty_pgrp; struct pipe *job_list; - char o_opt[NUM_OPT_O]; # define G_saved_tty_pgrp (G.saved_tty_pgrp) #else # define G_saved_tty_pgrp 0 #endif + char o_opt[NUM_OPT_O]; smallint flag_SIGINT; #if ENABLE_HUSH_LOOPS smallint flag_break_continue; @@ -4500,7 +4500,9 @@ static struct pipe *parse_stream(char **pstring, expand_string_to_string(str) #endif static char *expand_string_to_string(const char *str, int do_unbackslash); +#if ENABLE_HUSH_TICK static int process_command_subs(o_string *dest, const char *s); +#endif /* expand_strvec_to_strvec() takes a list of strings, expands * all variable references within and returns a pointer to @@ -6579,7 +6581,7 @@ static int checkjobs_and_fg_shell(struct pipe *fg_pipe) * subshell: ( list ) [&] */ #if !ENABLE_HUSH_MODE_X -#define redirect_and_varexp_helper(new_env_p, old_vars_p, command, squirrel, char argv_expanded) \ +#define redirect_and_varexp_helper(new_env_p, old_vars_p, command, squirrel, argv_expanded) \ redirect_and_varexp_helper(new_env_p, old_vars_p, command, squirrel) #endif static int redirect_and_varexp_helper(char ***new_env_p, diff --git a/testsuite/du/du-h-works b/testsuite/du/du-h-works index c18433c..1c77b65 100644 --- a/testsuite/du/du-h-works +++ b/testsuite/du/du-h-works @@ -1,4 +1,4 @@ # FEATURE: CONFIG_FEATURE_HUMAN_READABLE dd if=/dev/zero of=file bs=1M count=1 2>/dev/null -test x"`busybox du -h .`" = x"1.0M ." +test x"`busybox du -h file`" = x"1.0M file" diff --git a/testsuite/md5sum.tests b/testsuite/md5sum.tests index 35ec67c..1068b08 100755 --- a/testsuite/md5sum.tests +++ b/testsuite/md5sum.tests @@ -18,6 +18,11 @@ fi sum="$1" expected="$2" +test -f "$bindir/.config" && . "$bindir/.config" + +test x"$CONFIG_FEATURE_FANCY_HEAD" != x"y" \ +&& { echo "SKIPPED: $sum"; exit 0; } + text="The quick brown fox jumps over the lazy dog" text=`yes "$text" | head -c 9999` diff --git a/util-linux/acpid.c b/util-linux/acpid.c index 0b227a8..ce4c98e 100644 --- a/util-linux/acpid.c +++ b/util-linux/acpid.c @@ -16,9 +16,9 @@ enum { OPT_e = (1 << 2), OPT_f = (1 << 3), OPT_l = (1 << 4), - OPT_p = (1 << 5) * ENABLE_FEATURE_PIDFILE, - OPT_a = (1 << 6), - OPT_M = (1 << 7), + OPT_a = (1 << 5), + OPT_M = (1 << 6), + OPT_p = (1 << 7) * ENABLE_FEATURE_PIDFILE, }; struct acpi_event { @@ -199,8 +199,9 @@ int acpid_main(int argc UNUSED_PARAM, char **argv) INIT_G(); opt_complementary = "df:e--e"; - opts = getopt32(argv, "c:de:fl:p:a:M:" IF_FEATURE_ACPID_COMPAT("g:m:s:S:v"), - &opt_dir, &opt_input, &opt_logfile, &opt_pidfile, &opt_action, &opt_map + opts = getopt32(argv, "c:de:fl:a:M:" IF_FEATURE_PIDFILE("p:") IF_FEATURE_ACPID_COMPAT("g:m:s:S:v"), + &opt_dir, &opt_input, &opt_logfile, &opt_action, &opt_map + IF_FEATURE_PIDFILE(, &opt_pidfile) IF_FEATURE_ACPID_COMPAT(, NULL, NULL, NULL, NULL) ); -- 2.7.4