fixes for bugs discovered by randomconfig builds and tests
authorDenys Vlasenko <vda.linux@googlemail.com>
Mon, 22 Nov 2010 22:49:10 +0000 (23:49 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Mon, 22 Nov 2010 22:49:10 +0000 (23:49 +0100)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
libbb/Kbuild.src
scripts/randomtest.loop
shell/ash.c
shell/hush.c
testsuite/du/du-h-works
testsuite/md5sum.tests
util-linux/acpid.c

index 806cace..0fa1451 100644 (file)
@@ -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
index 311536d..2c8a9bd 100755 (executable)
@@ -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
index 5ef7efb..5671a52 100644 (file)
@@ -43,7 +43,9 @@
 #include <sys/times.h>
 
 #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)
 {
index da32c24..26a5074 100644 (file)
@@ -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,
index c18433c..1c77b65 100644 (file)
@@ -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"
index 35ec67c..1068b08 100755 (executable)
@@ -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`
 
index 0b227a8..ce4c98e 100644 (file)
@@ -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)
        );