From: Eric Andersen Date: Thu, 1 Feb 2001 22:43:49 +0000 (-0000) Subject: Apply a patch from Larry Doolittle to add "-all" and "-none" switches X-Git-Tag: 0_50~260 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=af4ac77d9d13f879922ccad8a8535c24aeea0380;p=oweals%2Fbusybox.git Apply a patch from Larry Doolittle to add "-all" and "-none" switches to multibuild.pl. I did a little formatting adjustments to make it _very_ obvious when things stop working. I also removed the USE_PROCFS config option -- just do the right thing when USE_DEVPS_PATCH is enabled. -Erik --- diff --git a/Config.h b/Config.h index 3a5aa6182..800631166 100644 --- a/Config.h +++ b/Config.h @@ -7,118 +7,7 @@ // // // BusyBox Applications -//#define BB_AR -#define BB_BASENAME -#define BB_CAT -#define BB_CHMOD_CHOWN_CHGRP -#define BB_CHROOT -#define BB_CHVT -#define BB_CLEAR -//#define BB_CMP -#define BB_CP_MV -#define BB_CUT -#define BB_DATE -//#define BB_DC -#define BB_DD -//#define BB_DEALLOCVT -#define BB_DF -#define BB_DIRNAME -#define BB_DMESG -//#define BB_DOS2UNIX -//#define BB_DPKG_DEB -//#define BB_DUTMP -#define BB_DU -//#define BB_DUMPKMAP -#define BB_ECHO -//#define BB_EXPR -//#define BB_FBSET -//#define BB_FDFLUSH -#define BB_FIND -#define BB_FREE -//#define BB_FREERAMDISK -//#define BB_FSCK_MINIX -//#define BB_GETOPT -#define BB_GREP -#define BB_GUNZIP -#define BB_GZIP -#define BB_HALT -#define BB_HEAD -//#define BB_HOSTID -//#define BB_HOSTNAME -#define BB_ID -#define BB_INIT -//#define BB_INSMOD -#define BB_KILL -#define BB_KILLALL -//#define BB_LENGTH -#define BB_LN -//#define BB_LOADACM -//#define BB_LOADFONT -//#define BB_LOADKMAP -#define BB_LOGGER -//#define BB_LOGNAME -#define BB_LS -#define BB_LSMOD -//#define BB_MAKEDEVS -//#define BB_MD5SUM -#define BB_MKDIR -//#define BB_MKFIFO -//#define BB_MKFS_MINIX -#define BB_MKNOD -#define BB_MKSWAP -//#define BB_MKTEMP -//#define BB_NC -#define BB_MORE -#define BB_MOUNT -//#define BB_MT -//#define BB_NSLOOKUP -//#define BB_PING -#define BB_POWEROFF -//#define BB_PRINTF -#define BB_PS -#define BB_PWD -//#define BB_RDATE -//#define BB_READLINK -#define BB_REBOOT -//#define BB_RENICE -#define BB_RESET -#define BB_RM -#define BB_RMDIR -//#define BB_RMMOD -//#define BB_RPMUNPACK -#define BB_SED -//#define BB_SETKEYCODES #define BB_SH -#define BB_SLEEP -#define BB_SORT -#define BB_SWAPONOFF -#define BB_SYNC -#define BB_SYSLOGD -#define BB_TAIL -#define BB_TAR -//#define BB_TEE -//#define BB_TEST -//#define BB_TELNET -#define BB_TOUCH -//#define BB_TR -#define BB_TRUE_FALSE -#define BB_TTY -//#define BB_UUENCODE -//#define BB_UUDECODE -#define BB_UMOUNT -#define BB_UNIQ -#define BB_UNAME -//#define BB_UNIX2DOS -//#define BB_UPDATE -#define BB_UPTIME -//#define BB_USLEEP -//#define BB_WATCHDOG -#define BB_WC -//#define BB_WGET -#define BB_WHICH -#define BB_WHOAMI -#define BB_XARGS -#define BB_YES // End of Applications List // // @@ -255,22 +144,26 @@ //busybox. Some systems want this, others do not. Choose wisely. :-) This //only has meaning when BB_FEATURE_SH_STANDALONE_SHELL is enabled. // Only relevant if BB_SH is enabled. -//BB_FEATURE_SH_APPLETS_ALWAYS_WIN +#define BB_FEATURE_SH_APPLETS_ALWAYS_WIN // // Enable tab completion in the shell (not yet // working very well -- so don't turn this on) // Only relevant if BB_SH is enabled. #define BB_FEATURE_SH_TAB_COMPLETION // -// Enable a simpler shell prompt of the form "path #" instead of the default -// "[username@hostname path]#". Some deeply embedded systems don't have -// usernames or even hostnames and the default prompt can look rather hideous -// on them. Uncomment this option for a simpler, path-only prompt (which was -// the default until around BusyBox-0.48): +// Enable a simpler shell prompt of the form "path #" +// instead of the default "[username@hostname path]#" +// +// Some deeply embedded systems don't have usernames or even hostnames, +// and the default prompt can look rather hideous on them. Uncomment +// this option for a simpler, path-only prompt (which was the default until +// around BusyBox-0.48): +// #define BB_FEATURE_SH_SIMPLE_PROMPT // // Attempts to match usernames in a ~-prefixed path -//#define BB_FEATURE_USERNAME_COMPLETION +// XXX: Doesn't work without NSS, off by default +#define BB_FEATURE_USERNAME_COMPLETION /* require NSS */ // //Turn on extra fbset options //#define BB_FEATURE_FBSET_FANCY diff --git a/Makefile b/Makefile index b0beb1dd2..33dd1e113 100644 --- a/Makefile +++ b/Makefile @@ -248,7 +248,6 @@ busybox.links: Config.h applets.h nfsmount.o cmdedit.o: %.o: %.h $(OBJECTS): %.o: %.c Config.h busybox.h applets.h Makefile - $(CC) $(CFLAGS) -c $*.c -o $*.o utility.o: loop.h @@ -265,7 +264,7 @@ clean: docs/busybox.lineo.com/BusyBox.html - rm -f docs/busybox.txt docs/busybox.dvi docs/busybox.ps \ docs/busybox.pdf docs/busybox.lineo.com/busybox.html - - rm -f Config.h.ORG bb.def.h busybox.REGRESS.sh.results bb.OptionsAndFeatures + - rm -f multibuild.log Config.h.orig - rm -rf docs/busybox _install - rm -f busybox.links loop.h *~ *.o core diff --git a/cmdedit.c b/cmdedit.c index ed441d394..2e57b9a34 100644 --- a/cmdedit.c +++ b/cmdedit.c @@ -54,6 +54,9 @@ #include #endif +#include "pwd_grp/pwd.h" + + static const int MAX_HISTORY = 15; /* Maximum length of the linked list for the command line history */ enum { diff --git a/init.c b/init.c index 49951b0fd..a1c6aec3a 100644 --- a/init.c +++ b/init.c @@ -666,10 +666,6 @@ static void reboot_signal(int sig) #warning pivot root instead. Do not even bother till this work is done... #warning You have been warned. -#if ! defined BB_FEATURE_USE_PROCFS -#error Sorry, I depend on the /proc filesystem right now. -#endif - static void check_chroot(int sig) { char *argv_init[2] = { "init", NULL, }; diff --git a/init/init.c b/init/init.c index 49951b0fd..a1c6aec3a 100644 --- a/init/init.c +++ b/init/init.c @@ -666,10 +666,6 @@ static void reboot_signal(int sig) #warning pivot root instead. Do not even bother till this work is done... #warning You have been warned. -#if ! defined BB_FEATURE_USE_PROCFS -#error Sorry, I depend on the /proc filesystem right now. -#endif - static void check_chroot(int sig) { char *argv_init[2] = { "init", NULL, }; diff --git a/lash.c b/lash.c index 87c37caa9..b1a7b93cf 100644 --- a/lash.c +++ b/lash.c @@ -1371,7 +1371,7 @@ static int pseudo_exec(struct child_prog *child) struct built_in_command *x; #ifdef BB_FEATURE_SH_STANDALONE_SHELL struct BB_applet *applet; - const char *name; + char *name; #endif /* Check if the command matches any of the non-forking builtins. diff --git a/lsmod.c b/lsmod.c index ab8445596..f39cbc08f 100644 --- a/lsmod.c +++ b/lsmod.c @@ -130,10 +130,6 @@ extern int lsmod_main(int argc, char **argv) #else /*BB_FEATURE_OLD_MODULE_INTERFACE*/ -#if ! defined BB_FEATURE_USE_PROCFS -#error Sorry, I depend on the /proc filesystem right now. -#endif - extern int lsmod_main(int argc, char **argv) { int fd, i; diff --git a/modutils/lsmod.c b/modutils/lsmod.c index ab8445596..f39cbc08f 100644 --- a/modutils/lsmod.c +++ b/modutils/lsmod.c @@ -130,10 +130,6 @@ extern int lsmod_main(int argc, char **argv) #else /*BB_FEATURE_OLD_MODULE_INTERFACE*/ -#if ! defined BB_FEATURE_USE_PROCFS -#error Sorry, I depend on the /proc filesystem right now. -#endif - extern int lsmod_main(int argc, char **argv) { int fd, i; diff --git a/more.c b/more.c index c4c74fe4a..15c3b6f87 100644 --- a/more.c +++ b/more.c @@ -1,3 +1,4 @@ +#error Foo /* vi: set sw=4 ts=4: */ /* * Mini more implementation for busybox diff --git a/mount.c b/mount.c index b571e5035..79813ba18 100644 --- a/mount.c +++ b/mount.c @@ -232,13 +232,9 @@ mount_one(char *blockDevice, char *directory, char *filesystemType, { int status = 0; -#if defined BB_FEATURE_USE_PROCFS char buf[255]; if (strcmp(filesystemType, "auto") == 0) { - FILE *f = fopen("/proc/filesystems", "r"); - - if (f == NULL) - return (FALSE); + FILE *f = xfopen("/proc/filesystems", "r"); while (fgets(buf, sizeof(buf), f) != NULL) { filesystemType = buf; @@ -261,7 +257,6 @@ mount_one(char *blockDevice, char *directory, char *filesystemType, } fclose(f); } else -#endif #if defined BB_FEATURE_USE_DEVPS_PATCH if (strcmp(filesystemType, "auto") == 0) { int fd, i, numfilesystems; diff --git a/mtab.c b/mtab.c index ab805e9c1..33b11c83e 100644 --- a/mtab.c +++ b/mtab.c @@ -21,12 +21,8 @@ void erase_mtab(const char *name) /* Check if reading the mtab file failed */ if (mountTable == 0 -#if ! defined BB_FEATURE_USE_PROCFS - ) { -#else - /* Bummer. fall back on trying the /proc filesystem */ - && (mountTable = setmntent("/proc/mounts", "r")) == 0) { -#endif + /* Bummer. fall back on trying the /proc filesystem */ + && (mountTable = setmntent("/proc/mounts", "r")) == 0) { perror_msg("%s", mtab_file); return; } @@ -74,14 +70,12 @@ void write_mtab(char *blockDevice, char *directory, if (length > 1 && directory[length - 1] == '/') directory[length - 1] = '\0'; -#ifdef BB_FEATURE_USE_PROCFS if (filesystemType == 0) { struct mntent *p = find_mount_point(blockDevice, "/proc/mounts"); if (p && p->mnt_type) filesystemType = p->mnt_type; } -#endif m.mnt_fsname = blockDevice; m.mnt_dir = directory; m.mnt_type = filesystemType ? filesystemType : "default"; diff --git a/procps/ps.c b/procps/ps.c index 4ff7a8a58..eabdef407 100644 --- a/procps/ps.c +++ b/procps/ps.c @@ -52,10 +52,6 @@ static const int TERMINAL_WIDTH = 79; /* not 80 in case terminal has linefo * the one using the /proc virtual filesystem. */ -#if ! defined BB_FEATURE_USE_PROCFS -#error Sorry, I depend on the /proc filesystem right now. -#endif - typedef struct proc_s { char cmd[16]; /* basename of executable file in call to exec(2) */ diff --git a/ps.c b/ps.c index 4ff7a8a58..eabdef407 100644 --- a/ps.c +++ b/ps.c @@ -52,10 +52,6 @@ static const int TERMINAL_WIDTH = 79; /* not 80 in case terminal has linefo * the one using the /proc virtual filesystem. */ -#if ! defined BB_FEATURE_USE_PROCFS -#error Sorry, I depend on the /proc filesystem right now. -#endif - typedef struct proc_s { char cmd[16]; /* basename of executable file in call to exec(2) */ diff --git a/sh.c b/sh.c index 87c37caa9..b1a7b93cf 100644 --- a/sh.c +++ b/sh.c @@ -1371,7 +1371,7 @@ static int pseudo_exec(struct child_prog *child) struct built_in_command *x; #ifdef BB_FEATURE_SH_STANDALONE_SHELL struct BB_applet *applet; - const char *name; + char *name; #endif /* Check if the command matches any of the non-forking builtins. diff --git a/shell/cmdedit.c b/shell/cmdedit.c index ed441d394..2e57b9a34 100644 --- a/shell/cmdedit.c +++ b/shell/cmdedit.c @@ -54,6 +54,9 @@ #include #endif +#include "pwd_grp/pwd.h" + + static const int MAX_HISTORY = 15; /* Maximum length of the linked list for the command line history */ enum { diff --git a/shell/lash.c b/shell/lash.c index 87c37caa9..b1a7b93cf 100644 --- a/shell/lash.c +++ b/shell/lash.c @@ -1371,7 +1371,7 @@ static int pseudo_exec(struct child_prog *child) struct built_in_command *x; #ifdef BB_FEATURE_SH_STANDALONE_SHELL struct BB_applet *applet; - const char *name; + char *name; #endif /* Check if the command matches any of the non-forking builtins. diff --git a/tests/busybox.REGRESS.sh b/tests/busybox.REGRESS.sh deleted file mode 100755 index c3106419b..000000000 Binary files a/tests/busybox.REGRESS.sh and /dev/null differ diff --git a/tests/multibuild.pl b/tests/multibuild.pl index fb9cdd494..858da360f 100755 --- a/tests/multibuild.pl +++ b/tests/multibuild.pl @@ -5,9 +5,18 @@ # properly on its own. The most likely problems this will # flush out are those involving preprocessor instructions in # utility.c. +# +# TODO: some time it might be nice to list absolute and +# differential object sizes for each option... +# $logfile = "multibuild.log"; +# How to handle all the BB_FEATURE_FOO lines +if ($ARGV[0] eq "-all" ) { shift(@ARGV); $choice="all"; } +if ($ARGV[0] eq "-none") { shift(@ARGV); $choice="none"; } +# neither means, leave that part of Config.h alone + # Support building from pristine source $make_opt = "-f $ARGV[0]/Makefile BB_SRC_DIR=$ARGV[0]" if ($ARGV[0] ne ""); @@ -21,6 +30,11 @@ unlink($logfile); open(C,") { if ($in_trailer) { + if (!$in_olympus) { + s/^\/\/#/#/ if ($choice eq "all" && !/USE_DEVPS_PATCH/); + s/^#/\/\/#/ if ($choice eq "none"); + } + $in_olympus=1 if /End of Features List/; $trailer .= $_; } else { $in_trailer=1 if /End of Applications List/; @@ -32,6 +46,7 @@ while () { close C; # Do the real work ... +$failed_tests=0; for $a (@apps) { # print "Testing build of applet $a ...\n"; open (O, ">Config.h") || die; @@ -40,12 +55,17 @@ for $a (@apps) { system("echo -e '\n***\n$a\n***' >>$logfile"); # todo: figure out why the "rm -f *.o" is needed $result{$a} = system("rm -f *.o; make $make_opt busybox >>$logfile 2>&1"); - $flag = $result{$a} ? "FAIL" : "OK"; - print "Applet $a: $flag\n"; + $flag = $result{$a} ? "FAILED!!!" : "ok"; + printf("Applet %-20s: %s\n", $a, $flag); + $total_tests++; + $failed_tests++ if $flag eq "FAILED!!!"; + # pause long enough to let user stop us with a ^C + select(undef, undef, undef, 0.05); } # Clean up our mess system("mv -f Config.h.orig Config.h"); +print "$total_tests applets tested, $failed_tests failures\n"; print "See $logfile for details.\n"; diff --git a/util-linux/more.c b/util-linux/more.c index c4c74fe4a..15c3b6f87 100644 --- a/util-linux/more.c +++ b/util-linux/more.c @@ -1,3 +1,4 @@ +#error Foo /* vi: set sw=4 ts=4: */ /* * Mini more implementation for busybox diff --git a/util-linux/mount.c b/util-linux/mount.c index b571e5035..79813ba18 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c @@ -232,13 +232,9 @@ mount_one(char *blockDevice, char *directory, char *filesystemType, { int status = 0; -#if defined BB_FEATURE_USE_PROCFS char buf[255]; if (strcmp(filesystemType, "auto") == 0) { - FILE *f = fopen("/proc/filesystems", "r"); - - if (f == NULL) - return (FALSE); + FILE *f = xfopen("/proc/filesystems", "r"); while (fgets(buf, sizeof(buf), f) != NULL) { filesystemType = buf; @@ -261,7 +257,6 @@ mount_one(char *blockDevice, char *directory, char *filesystemType, } fclose(f); } else -#endif #if defined BB_FEATURE_USE_DEVPS_PATCH if (strcmp(filesystemType, "auto") == 0) { int fd, i, numfilesystems; diff --git a/utility.c b/utility.c index 69403c8c2..f99c613a1 100644 --- a/utility.c +++ b/utility.c @@ -63,26 +63,16 @@ /* Busybox mount uses either /proc/filesystems or /dev/mtab to get the * list of available filesystems used for the -t auto option */ -#if defined BB_FEATURE_USE_PROCFS && defined BB_FEATURE_USE_DEVPS_PATCH -//#error Sorry, but busybox can't use both /proc and /dev/ps at the same time -- Pick one and try again. -#error "Sorry, but busybox can't use both /proc and /dev/ps at the same time -- Pick one and try again." -#endif - - #if defined BB_MOUNT || defined BB_UMOUNT || defined BB_DF # if defined BB_MTAB const char mtab_file[] = "/etc/mtab"; # else -# if defined BB_FEATURE_USE_PROCFS -const char mtab_file[] = "/proc/mounts"; -# else # if defined BB_FEATURE_USE_DEVPS_PATCH const char mtab_file[] = "/dev/mtab"; # else -# error With (BB_MOUNT||BB_UMOUNT||BB_DF) defined, you must define either BB_MTAB or ( BB_FEATURE_USE_PROCFS | BB_FEATURE_USE_DEVPS_PATCH) +const char mtab_file[] = "/proc/mounts"; # endif # endif -# endif #endif extern void usage(const char *usage) @@ -1271,9 +1261,6 @@ extern pid_t* find_pid_by_name( char* pidName) return pidList; } #else /* BB_FEATURE_USE_DEVPS_PATCH */ -#if ! defined BB_FEATURE_USE_PROCFS -#error Sorry, I depend on the /proc filesystem right now. -#endif /* find_pid_by_name() * @@ -1634,7 +1621,7 @@ char process_escape_sequence(char **ptr) #endif #if defined BB_BASENAME || defined BB_LN || defined BB_SH || defined BB_INIT || \ - defined BB_FEATURE_USE_PROCFS || defined BB_WGET + ! defined BB_FEATURE_USE_DEVPS_PATCH || defined BB_WGET char *get_last_path_component(char *path) { char *s=path+strlen(path)-1; @@ -1681,7 +1668,8 @@ FILE *wfopen(const char *path, const char *mode) #if defined BB_HOSTNAME || defined BB_LOADACM || defined BB_MORE \ || defined BB_SED || defined BB_SH || defined BB_TAR || defined BB_UNIQ \ - || defined BB_WC || defined BB_CMP || defined BB_SORT || defined BB_WGET + || defined BB_WC || defined BB_CMP || defined BB_SORT || defined BB_WGET \ + || defined BB_MOUNT FILE *xfopen(const char *path, const char *mode) { FILE *fp;