svn commit: trunk/busybox: archival coreutils miscutils modutils ne etc...

vda at busybox.net vda at busybox.net
Sat Dec 30 17:57:04 UTC 2006


Author: vda
Date: 2006-12-30 09:57:03 -0800 (Sat, 30 Dec 2006)
New Revision: 17105

Log:
done a dozen of randconfig test. guess what? ALL failed...
these are resulting fixes


Modified:
   trunk/busybox/archival/gzip.c
   trunk/busybox/coreutils/chgrp.c
   trunk/busybox/coreutils/diff.c
   trunk/busybox/miscutils/less.c
   trunk/busybox/miscutils/taskset.c
   trunk/busybox/modutils/insmod.c
   trunk/busybox/networking/httpd.c
   trunk/busybox/procps/top.c
   trunk/busybox/runit/Kbuild
   trunk/busybox/util-linux/fdisk.c
   trunk/busybox/util-linux/mkfs_minix.c


Changeset:
Modified: trunk/busybox/archival/gzip.c
===================================================================
--- trunk/busybox/archival/gzip.c	2006-12-30 14:46:51 UTC (rev 17104)
+++ trunk/busybox/archival/gzip.c	2006-12-30 17:57:03 UTC (rev 17105)
@@ -1122,7 +1122,7 @@
  * in the compressed file.
  */
 
-		/* configuration */
+/* configuration */
 
 typedef struct dirent dir_type;
 
@@ -1156,11 +1156,13 @@
 	//if (opt & 0x400) // -9
 	//if (opt & 0x800) // -q
 	//if (opt & 0x1000) // -v
-	if (ENABLE_GUNZIP && (opt & 0x2000)) { // -d
+#if ENABLE_GUNZIP /* gunzip_main may not be visible... */
+	if (opt & 0x2000) { // -d
 		/* FIXME: getopt32 should not depend on optind */
 		optind = 1;
 		return gunzip_main(argc, argv);
 	}
+#endif
 
 	foreground = signal(SIGINT, SIG_IGN) != SIG_IGN;
 	if (foreground) {

Modified: trunk/busybox/coreutils/chgrp.c
===================================================================
--- trunk/busybox/coreutils/chgrp.c	2006-12-30 14:46:51 UTC (rev 17104)
+++ trunk/busybox/coreutils/chgrp.c	2006-12-30 17:57:03 UTC (rev 17105)
@@ -13,6 +13,9 @@
 
 #include "busybox.h"
 
+/* FIXME - move to .h */
+extern int chown_main(int argc, char **argv);
+
 int chgrp_main(int argc, char **argv)
 {
 	/* "chgrp [opts] abc file(s)" == "chown [opts] :abc file(s)" */

Modified: trunk/busybox/coreutils/diff.c
===================================================================
--- trunk/busybox/coreutils/diff.c	2006-12-30 14:46:51 UTC (rev 17104)
+++ trunk/busybox/coreutils/diff.c	2006-12-30 17:57:03 UTC (rev 17105)
@@ -71,7 +71,7 @@
 char *start, *label[2];
 struct stat stb1, stb2;
 char **dl;
-static int dl_count;
+USE_FEATURE_DIFF_DIR(static int dl_count;)
 
 struct cand {
 	int x;

Modified: trunk/busybox/miscutils/less.c
===================================================================
--- trunk/busybox/miscutils/less.c	2006-12-30 14:46:51 UTC (rev 17104)
+++ trunk/busybox/miscutils/less.c	2006-12-30 17:57:03 UTC (rev 17105)
@@ -109,6 +109,8 @@
 static unsigned num_matches;
 static regex_t pattern;
 static unsigned pattern_valid;
+#else
+enum { pattern_valid = 0 };
 #endif
 
 static struct termios term_orig, term_vi;
@@ -168,7 +170,7 @@
 {
 #define readbuf bb_common_bufsiz1
 	char *current_line, *p;
-	unsigned old_max_fline = max_fline;
+	USE_FEATURE_LESS_REGEXP(unsigned old_max_fline = max_fline;)
 	int w = width;
 	char last_terminated = terminated;
 
@@ -337,6 +339,7 @@
 	"\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x40\x4b\x4c\x4d\x4e\x4f"
 	"\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f";
 
+#if ENABLE_FEATURE_LESS_REGEXP
 static void print_found(const char *line)
 {
 	int match_status;
@@ -397,6 +400,9 @@
 	printf(CLEAR_2_EOL"%s%s\n", growline, str);
 	free(growline);
 }
+#else
+void print_found(const char *line);
+#endif
 
 static void print_ascii(const char *str)
 {
@@ -718,6 +724,7 @@
 	}
 }
 
+#if ENABLE_FEATURE_LESS_REGEXP
 static int normalize_match_pos(int match)
 {
 	match_pos = match;
@@ -728,7 +735,6 @@
 	return match_pos;
 }
 
-#if ENABLE_FEATURE_LESS_REGEXP
 static void goto_match(int match)
 {
 	if (num_matches)

Modified: trunk/busybox/miscutils/taskset.c
===================================================================
--- trunk/busybox/miscutils/taskset.c	2006-12-30 14:46:51 UTC (rev 17104)
+++ trunk/busybox/miscutils/taskset.c	2006-12-30 17:57:03 UTC (rev 17105)
@@ -8,14 +8,14 @@
 
 #include "busybox.h"
 #include <sched.h>
-#include <unistd.h>
 #include <getopt.h> /* optind */
 
 #if ENABLE_FEATURE_TASKSET_FANCY
 #define TASKSET_PRINTF_MASK "%s"
 #define from_cpuset(x) __from_cpuset(&x)
 /* craft a string from the mask */
-static char *__from_cpuset(cpu_set_t *mask) {
+static char *__from_cpuset(cpu_set_t *mask)
+{
 	int i;
 	char *ret = 0, *str = xzalloc(9);
 
@@ -34,22 +34,24 @@
 }
 #else
 #define TASKSET_PRINTF_MASK "%x"
-#define from_cpuset(mask) mask
+/* (void*) cast is for battling gcc: */
+/* "dereferencing type-punned pointer will break strict-aliasing rules" */
+#define from_cpuset(mask) (*(unsigned*)(void*)&(mask))
 #endif
 
-#define TASKSET_OPT_p (1)
+#define OPT_p 1
 
 int taskset_main(int argc, char** argv)
 {
 	cpu_set_t mask, new_mask;
 	pid_t pid = 0;
-	unsigned long ul;
+	unsigned opt;
 	const char *state = "current\0new";
 	char *p_opt = NULL, *aff = NULL;
 
-	ul = getopt32(argc, argv, "+p:", &p_opt);
+	opt = getopt32(argc, argv, "+p:", &p_opt);
 
-	if (ul & TASKSET_OPT_p) {
+	if (opt & OPT_p) {
 		if (argc == optind+1) { /* -p <aff> <pid> */
 			aff = p_opt;
 			p_opt = argv[optind];
@@ -70,19 +72,19 @@
 		}
 	}
 
-	if (ul & TASKSET_OPT_p) {
-print_aff:
-		if (sched_getaffinity(pid, sizeof (mask), &mask) < 0)
-			bb_perror_msg_and_die("Failed to %cet pid %d's affinity", 'g', pid);
+	if (opt & OPT_p) {
+ print_aff:
+		if (sched_getaffinity(pid, sizeof(mask), &mask) < 0)
+			bb_perror_msg_and_die("failed to %cet pid %d's affinity", 'g', pid);
 		printf("pid %d's %s affinity mask: "TASKSET_PRINTF_MASK"\n",
 				pid, state, from_cpuset(mask));
 		if (!*argv) /* no new affinity given or we did print already, done. */
 			return EXIT_SUCCESS;
 	}
 
-	if (sched_setaffinity(pid, sizeof (new_mask), &new_mask))
-		bb_perror_msg_and_die("Failed to %cet pid %d's affinity", 's', pid);
-	if (ul & TASKSET_OPT_p) {
+	if (sched_setaffinity(pid, sizeof(new_mask), &new_mask))
+		bb_perror_msg_and_die("failed to %cet pid %d's affinity", 's', pid);
+	if (opt & OPT_p) {
 		state += 8;
 		++argv;
 		goto print_aff;
@@ -91,6 +93,6 @@
 	execvp(*argv, argv);
 	bb_perror_msg_and_die("%s", *argv);
 }
-#undef TASKSET_OPT_p
+#undef OPT_p
 #undef TASKSET_PRINTF_MASK
 #undef from_cpuset

Modified: trunk/busybox/modutils/insmod.c
===================================================================
--- trunk/busybox/modutils/insmod.c	2006-12-30 14:46:51 UTC (rev 17104)
+++ trunk/busybox/modutils/insmod.c	2006-12-30 17:57:03 UTC (rev 17105)
@@ -63,6 +63,7 @@
 #include <sys/utsname.h>
 
 #if !ENABLE_FEATURE_2_4_MODULES && !ENABLE_FEATURE_2_6_MODULES
+#undef ENABLE_FEATURE_2_4_MODULES
 #define ENABLE_FEATURE_2_4_MODULES 1
 #endif
 

Modified: trunk/busybox/networking/httpd.c
===================================================================
--- trunk/busybox/networking/httpd.c	2006-12-30 14:46:51 UTC (rev 17104)
+++ trunk/busybox/networking/httpd.c	2006-12-30 17:57:03 UTC (rev 17105)
@@ -338,7 +338,9 @@
 	return 0;
 }
 
-#if ENABLE_FEATURE_HTTPD_BASIC_AUTH || ENABLE_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES
+#if ENABLE_FEATURE_HTTPD_BASIC_AUTH \
+ || ENABLE_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES \
+ || ENABLE_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR
 static void free_config_lines(Htaccess **pprev)
 {
 	Htaccess *prev = *pprev;
@@ -387,8 +389,11 @@
 {
 	FILE *f;
 #if ENABLE_FEATURE_HTTPD_BASIC_AUTH
-	Htaccess *prev, *cur;
-#elif ENABLE_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES
+	Htaccess *prev;
+#endif
+#if ENABLE_FEATURE_HTTPD_BASIC_AUTH \
+ || ENABLE_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES \
+ || ENABLE_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR
 	Htaccess *cur;
 #endif
 
@@ -410,7 +415,9 @@
 
 	config->flg_deny_all = 0;
 
-#if ENABLE_FEATURE_HTTPD_BASIC_AUTH || ENABLE_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES || ENABLE_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR
+#if ENABLE_FEATURE_HTTPD_BASIC_AUTH \
+ || ENABLE_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES \
+ || ENABLE_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR
 	/* retain previous auth and mime config only for subdir parse */
 	if (flag != SUBDIR_PARSE) {
 #if ENABLE_FEATURE_HTTPD_BASIC_AUTH
@@ -559,7 +566,9 @@
 		}
 #endif
 
-#if ENABLE_FEATURE_HTTPD_BASIC_AUTH || ENABLE_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES || ENABLE_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR
+#if ENABLE_FEATURE_HTTPD_BASIC_AUTH \
+ || ENABLE_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES \
+ || ENABLE_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR
 		/* storing current config line */
 		cur = calloc(1, sizeof(Htaccess) + strlen(p0));
 		if (cur) {
@@ -1305,9 +1314,10 @@
 
 	/* This could stand some work */
 	for (cur = config->ip_a_d; cur; cur = cur->next) {
+#if DEBUG
+		fprintf(stderr, "checkPermIP: '%s' ? ", config->rmt_ip_str);
+#endif
 		if (DEBUG)
-			fprintf(stderr, "checkPermIP: '%s' ? ", config->rmt_ip_str);
-		if (DEBUG)
 			fprintf(stderr, "'%u.%u.%u.%u/%u.%u.%u.%u'\n",
 				(unsigned char)(cur->ip >> 24),
 				(unsigned char)(cur->ip >> 16),
@@ -1589,7 +1599,8 @@
 					/* extra read only for POST */
 					if (prequest != request_GET) {
 						test = buf + sizeof("Content-length:")-1;
-						if (!test[0]) goto bail_out;
+						if (!test[0])
+							goto bail_out;
 						errno = 0;
 						/* not using strtoul: it ignores leading munis! */
 						length = strtol(test, &test, 10);
@@ -1690,7 +1701,9 @@
 		config->ContentLength = -1;
 	} while (0);
 
+#if ENABLE_FEATURE_HTTPD_CGI
  bail_out:
+#endif
 
 	if (DEBUG)
 		fprintf(stderr, "closing socket\n\n");
@@ -1910,20 +1923,9 @@
 
 #if ENABLE_FEATURE_HTTPD_SETUID
 	if (opt & OPT_SETUID) {
-		char *e;
-		// FIXME: what the default group should be?
-		ugid.gid = -1;
-		ugid.uid = bb_strtoul(s_ugid, &e, 0);
-		if (*e == ':') {
-			e++;
-			ugid.gid = bb_strtoul(e, NULL, 0);
-		}
-		if (errno) {
-			/* not integer */
-			if (!uidgid_get(&ugid, s_ugid))
-				bb_error_msg_and_die("unrecognized user[:group] "
+		if (!get_uidgid(&ugid, s_ugid, 1))
+			bb_error_msg_and_die("unrecognized user[:group] "
 						"name '%s'", s_ugid);
-		}
 	}
 #endif
 

Modified: trunk/busybox/procps/top.c
===================================================================
--- trunk/busybox/procps/top.c	2006-12-30 14:46:51 UTC (rev 17104)
+++ trunk/busybox/procps/top.c	2006-12-30 17:57:03 UTC (rev 17105)
@@ -50,13 +50,14 @@
 	unsigned long ticks;
 	unsigned pid;
 };
+#if ENABLE_FEATURE_TOP_CPU_USAGE_PERCENTAGE
 static struct save_hist *prev_hist;
 static int prev_hist_count;
 /* static int hist_iterations; */
 static unsigned total_pcpu;
 /* static unsigned long total_rss; */
+#endif
 
-
 #define OPT_BATCH_MODE (option_mask32 & 0x4)
 
 #if ENABLE_FEATURE_USE_TERMIOS
@@ -485,7 +486,9 @@
 			top[n].pid = p->pid;
 			top[n].ppid = p->ppid;
 			top[n].rss = p->rss;
+#if ENABLE_FEATURE_TOP_CPU_USAGE_PERCENTAGE
 			top[n].ticks = p->stime + p->utime;
+#endif
 			top[n].uid = p->uid;
 			strcpy(top[n].state, p->state);
 			strcpy(top[n].comm, p->comm);

Modified: trunk/busybox/runit/Kbuild
===================================================================
--- trunk/busybox/runit/Kbuild	2006-12-30 14:46:51 UTC (rev 17104)
+++ trunk/busybox/runit/Kbuild	2006-12-30 17:57:03 UTC (rev 17105)
@@ -10,3 +10,8 @@
 lib-$(CONFIG_SV) += sv.o runit_lib.o
 lib-$(CONFIG_SVLOGD) += svlogd.o runit_lib.o
 lib-$(CONFIG_CHPST) += chpst.o
+
+lib-$(CONFIG_ENVDIR) += chpst.o
+lib-$(CONFIG_ENVUIDGID) += chpst.o
+lib-$(CONFIG_SETUIDGID) += chpst.o
+lib-$(CONFIG_SOFTLIMIT) += chpst.o

Modified: trunk/busybox/util-linux/fdisk.c
===================================================================
--- trunk/busybox/util-linux/fdisk.c	2006-12-30 14:46:51 UTC (rev 17104)
+++ trunk/busybox/util-linux/fdisk.c	2006-12-30 17:57:03 UTC (rev 17105)
@@ -2797,7 +2797,6 @@
 {
 	char *str_b, *str_C, *str_H, *str_S;
 	unsigned opt;
-	int c;
 	/*
 	 *  fdisk -v
 	 *  fdisk -l [-b sectorsize] [-u] device ...
@@ -2921,6 +2920,7 @@
 	}
 
 	while (1) {
+		int c;
 		putchar('\n');
 		c = tolower(read_nonempty(_("Command (m for help): ")));
 		switch (c) {

Modified: trunk/busybox/util-linux/mkfs_minix.c
===================================================================
--- trunk/busybox/util-linux/mkfs_minix.c	2006-12-30 14:46:51 UTC (rev 17104)
+++ trunk/busybox/util-linux/mkfs_minix.c	2006-12-30 17:57:03 UTC (rev 17105)
@@ -453,6 +453,8 @@
 	if (dind)
 		write_block(dind, (char *) dind_block);
 }
+#else
+void make_bad_inode2(void);
 #endif
 
 static void make_root_inode(void)
@@ -499,6 +501,8 @@
 		inode->i_gid = GETGID;
 	write_block(inode->i_zone[0], root_block);
 }
+#else
+void make_root_inode2(void);
 #endif
 
 static void setup_tables(void)




More information about the busybox-cvs mailing list