From 8fdc4292897a207e39d84fc3eb33508a6dfccf7a Mon Sep 17 00:00:00 2001 From: John Bowler Date: Wed, 25 May 2005 20:26:01 +0000 Subject: Fix ash job control so that it can be configured again. Fix openslug (only) defconfig so that installing a new busybox doesn't render openslug disfunctional. BKrev: 4294df59ORRELYdtW0Y4o7wN-cqR4w --- .../busybox/busybox-1.00/celf-ash-builtins.patch | 431 +++++++++++++++++++++ packages/busybox/busybox-1.00/openslug/defconfig | 30 +- packages/busybox/busybox_1.00.bb | 2 +- 3 files changed, 440 insertions(+), 23 deletions(-) (limited to 'packages') diff --git a/packages/busybox/busybox-1.00/celf-ash-builtins.patch b/packages/busybox/busybox-1.00/celf-ash-builtins.patch index e69de29bb2..ec1925e6ad 100644 --- a/packages/busybox/busybox-1.00/celf-ash-builtins.patch +++ b/packages/busybox/busybox-1.00/celf-ash-builtins.patch @@ -0,0 +1,431 @@ +diff -Naur busybox-1.00-pre3.orig/coreutils/echo.c busybox-1.00-pre3/coreutils/echo.c +--- busybox-1.00-pre3.orig/coreutils/echo.c 2003-03-19 12:11:33.000000000 +0300 ++++ busybox-1.00-pre3/coreutils/echo.c 2003-11-07 17:47:35.000000000 +0300 +@@ -122,7 +122,11 @@ + #endif + + DONE: +- bb_fflush_stdout_and_exit(EXIT_SUCCESS); ++#ifdef CONFIG_FEATURE_BUILTIN_ECHO ++ return EXIT_SUCCESS; ++#else ++ bb_fflush_stdout_and_exit(EXIT_SUCCESS); ++#endif + } + + /*- +diff -Naur busybox-1.00-pre3.orig/coreutils/test.c busybox-1.00-pre3/coreutils/test.c +--- busybox-1.00-pre3.orig/coreutils/test.c 2003-07-15 01:20:45.000000000 +0400 ++++ busybox-1.00-pre3/coreutils/test.c 2003-11-07 17:47:35.000000000 +0300 +@@ -188,19 +188,19 @@ + /* Implement special cases from POSIX.2, section 4.62.4 */ + switch (argc) { + case 1: +- exit(1); ++ return (1); + case 2: +- exit(*argv[1] == '\0'); ++ return (*argv[1] == '\0'); + case 3: + if (argv[1][0] == '!' && argv[1][1] == '\0') { +- exit(!(*argv[2] == '\0')); ++ return (!(*argv[2] == '\0')); + } + break; + case 4: + if (argv[1][0] != '!' || argv[1][1] != '\0') { + if (t_lex(argv[2]), t_wp_op && t_wp_op->op_type == BINOP) { + t_wp = &argv[1]; +- exit(binop() == 0); ++ return (binop() == 0); + } + } + break; +@@ -208,7 +208,7 @@ + if (argv[1][0] == '!' && argv[1][1] == '\0') { + if (t_lex(argv[3]), t_wp_op && t_wp_op->op_type == BINOP) { + t_wp = &argv[2]; +- exit(!(binop() == 0)); ++ return (!(binop() == 0)); + } + } + break; +diff -Naur busybox-1.00-pre3.orig/include/usage.h busybox-1.00-pre3/include/usage.h +--- busybox-1.00-pre3.orig/include/usage.h 2003-08-29 18:18:26.000000000 +0400 ++++ busybox-1.00-pre3/include/usage.h 2003-11-07 17:47:59.000000000 +0300 +@@ -1760,6 +1760,13 @@ + "quit\n" \ + "221 foobar closing connection\n" + ++#define nice_trivial_usage \ ++ "[OPTION] [COMMAND [ARG]...]" ++#define nice_full_usage \ ++ "Run COMMAND with an adjusted scheduling priority." ++#define nice_example_usage \ ++ "$ nice -n 0 /tmp/foo \n" ++ + #define netstat_trivial_usage \ + "[-laenrtuwx]" + #define netstat_full_usage \ +diff -Naur busybox-1.00-pre3.orig/shell/Config.in busybox-1.00-pre3/shell/Config.in +--- busybox-1.00-pre3.orig/shell/Config.in 2003-09-12 08:51:25.000000000 +0400 ++++ busybox-1.00-pre3/shell/Config.in 2003-11-07 17:47:59.000000000 +0300 +@@ -53,6 +53,34 @@ + help + Enable job control in the ash shell. + ++config CONFIG_ASH_PIPE_OPTIMIZATION ++ bool " Enable ash pipe optimization " ++ default y ++ depends on CONFIG_ASH ++ help ++ Eliminate cat at the beginning of the pipe. ++ ++config CONFIG_FEATURE_BUILTIN_TEST ++ bool " Builtin test command" ++ default y ++ depends on CONFIG_ASH ++ help ++ Builtin test command" ++ ++config CONFIG_FEATURE_BUILTIN_ECHO ++ bool " Builtin echo command" ++ default y ++ depends on CONFIG_ASH ++ help ++ Builtin echo command" ++ ++config CONFIG_FEATURE_BUILTIN_PIDOF ++ bool " Builtin pidof command" ++ default y ++ depends on CONFIG_ASH && CONFIG_PIDOF ++ help ++ Builtin pidof command" ++ + config CONFIG_ASH_ALIAS + bool " Enable alias support" + default y +diff -Naur busybox-1.00-pre3.orig/shell/ash.c busybox-1.00-pre3/shell/ash.c +--- busybox-1.00-pre3.orig/shell/ash.c 2003-09-02 06:36:17.000000000 +0400 ++++ busybox-1.00-pre3/shell/ash.c 2003-11-07 17:47:59.000000000 +0300 +@@ -1259,6 +1259,16 @@ + #ifdef JOBS + static int killcmd(int, char **); + #endif ++#ifdef CONFIG_FEATURE_BUILTIN_TEST ++static int testcmd(int, char **); ++#endif ++#ifdef CONFIG_FEATURE_BUILTIN_ECHO ++static int echocmd(int, char**); ++#endif ++#ifdef CONFIG_FEATURE_BUILTIN_PIDOF ++static int pidofcmd(int, char **); ++#endif ++ + + /* $NetBSD: mail.h,v 1.9 2002/11/24 22:35:40 christos Exp $ */ + +@@ -1281,39 +1291,6 @@ + /* unsigned flags; */ + }; + +-#ifdef CONFIG_ASH_CMDCMD +-# ifdef JOBS +-# ifdef CONFIG_ASH_ALIAS +-# define COMMANDCMD (builtincmd + 7) +-# define EXECCMD (builtincmd + 10) +-# else +-# define COMMANDCMD (builtincmd + 6) +-# define EXECCMD (builtincmd + 9) +-# endif +-# else /* ! JOBS */ +-# ifdef CONFIG_ASH_ALIAS +-# define COMMANDCMD (builtincmd + 6) +-# define EXECCMD (builtincmd + 9) +-# else +-# define COMMANDCMD (builtincmd + 5) +-# define EXECCMD (builtincmd + 8) +-# endif +-# endif /* JOBS */ +-#else /* ! CONFIG_ASH_CMDCMD */ +-# ifdef JOBS +-# ifdef CONFIG_ASH_ALIAS +-# define EXECCMD (builtincmd + 9) +-# else +-# define EXECCMD (builtincmd + 8) +-# endif +-# else /* ! JOBS */ +-# ifdef CONFIG_ASH_ALIAS +-# define EXECCMD (builtincmd + 8) +-# else +-# define EXECCMD (builtincmd + 7) +-# endif +-# endif /* JOBS */ +-#endif /* CONFIG_ASH_CMDCMD */ + + #define BUILTIN_NOSPEC "0" + #define BUILTIN_SPECIAL "1" +@@ -1328,65 +1305,21 @@ + #define IS_BUILTIN_REGULAR(builtincmd) ((builtincmd)->name[0] & 2) + + static const struct builtincmd builtincmd[] = { +- { BUILTIN_SPEC_REG ".", dotcmd }, +- { BUILTIN_SPEC_REG ":", truecmd }, +-#ifdef CONFIG_ASH_ALIAS +- { BUILTIN_REG_ASSG "alias", aliascmd }, +-#endif +-#ifdef JOBS +- { BUILTIN_REGULAR "bg", bgcmd }, +-#endif +- { BUILTIN_SPEC_REG "break", breakcmd }, +- { BUILTIN_REGULAR "cd", cdcmd }, +- { BUILTIN_NOSPEC "chdir", cdcmd }, +-#ifdef CONFIG_ASH_CMDCMD +- { BUILTIN_REGULAR "command", commandcmd }, +-#endif +- { BUILTIN_SPEC_REG "continue", breakcmd }, +- { BUILTIN_SPEC_REG "eval", evalcmd }, +- { BUILTIN_SPEC_REG "exec", execcmd }, +- { BUILTIN_SPEC_REG "exit", exitcmd }, +- { BUILTIN_SPEC_REG_ASSG "export", exportcmd }, +- { BUILTIN_REGULAR "false", falsecmd }, +-#ifdef JOBS +- { BUILTIN_REGULAR "fg", fgcmd }, +-#endif +-#ifdef CONFIG_ASH_GETOPTS +- { BUILTIN_REGULAR "getopts", getoptscmd }, +-#endif +- { BUILTIN_NOSPEC "hash", hashcmd }, +-#ifndef CONFIG_FEATURE_SH_EXTRA_QUIET +- { BUILTIN_NOSPEC "help", helpcmd }, +-#endif +-#ifdef JOBS +- { BUILTIN_REGULAR "jobs", jobscmd }, +- { BUILTIN_REGULAR "kill", killcmd }, +-#endif +-#ifdef CONFIG_ASH_MATH_SUPPORT +- { BUILTIN_NOSPEC "let", letcmd }, +-#endif +- { BUILTIN_ASSIGN "local", localcmd }, +- { BUILTIN_NOSPEC "pwd", pwdcmd }, +- { BUILTIN_REGULAR "read", readcmd }, +- { BUILTIN_SPEC_REG_ASSG "readonly", exportcmd }, +- { BUILTIN_SPEC_REG "return", returncmd }, +- { BUILTIN_SPEC_REG "set", setcmd }, +- { BUILTIN_SPEC_REG "shift", shiftcmd }, +- { BUILTIN_SPEC_REG "times", timescmd }, +- { BUILTIN_SPEC_REG "trap", trapcmd }, +- { BUILTIN_REGULAR "true", truecmd }, +- { BUILTIN_NOSPEC "type", typecmd }, +- { BUILTIN_NOSPEC "ulimit", ulimitcmd }, +- { BUILTIN_REGULAR "umask", umaskcmd }, +-#ifdef CONFIG_ASH_ALIAS +- { BUILTIN_REGULAR "unalias", unaliascmd }, +-#endif +- { BUILTIN_SPEC_REG "unset", unsetcmd }, +- { BUILTIN_REGULAR "wait", waitcmd }, ++#define BUILTIN_COMMAND_SPEC(code, str, func) {str, func}, ++#include "ash.d" ++{} + }; + +-#define NUMBUILTINS (sizeof (builtincmd) / sizeof (struct builtincmd) ) ++enum { ++#define BUILTIN_COMMAND_SPEC(code, str, func) code, ++#include "ash.d" ++NUMBUILTINS ++}; + ++#ifdef CONFIG_ASH_CMDCMD ++#define COMMANDCMD (builtincmd + COMMAND_CMD) ++#endif ++#define EXECCMD (builtincmd + EXEC_CMD) + + + struct cmdentry { +@@ -1678,7 +1611,8 @@ + + /* from input.c: */ + { +- basepf.nextc = basepf.buf = basebuf; ++ struct parsefile* pf = &basepf; ++ pf->nextc = pf->buf = basebuf; + } + + /* from trap.c: */ +@@ -2678,6 +2612,14 @@ + * Called to reset things after an exception. + */ + ++#ifdef CONFIG_FEATURE_BUILTIN_ECHO ++static int ++echocmd(int argc, char **argv) ++{ ++ return echo_main(argc, argv); ++} ++#endif ++ + /* + * The eval commmand. + */ +@@ -3028,6 +2970,23 @@ + } + + ++static int ++cat_file(union node *n) ++{ ++#ifdef CONFIG_ASH_PIPE_OPTIMIZATION ++ if (n->type == NCMD ++ && n->ncmd.args != NULL ++ && strcmp(n->ncmd.args->narg.text, "cat") == 0 ++ && n->ncmd.args->narg.next != NULL ++ && *n->ncmd.args->narg.next->narg.text != '-' ++ && n->ncmd.args->narg.next->narg.next == NULL) ++ { ++ return open(n->ncmd.args->narg.next->narg.text, O_RDONLY); ++ } ++#endif ++ return -1; ++} ++ + + /* + * Evaluate a pipeline. All the processes in the pipeline are children +@@ -3057,7 +3016,11 @@ + prehash(lp->n); + pip[1] = -1; + if (lp->next) { +- if (pipe(pip) < 0) { ++ if (prevfd < 0 && (prevfd = cat_file(lp->n)) >= 0) { ++ // it is cat at the beginning of the pipe ++ continue; ++ } ++ if (pipe(pip) < 0) { + close(prevfd); + error("Pipe call failed"); + } +@@ -3104,11 +3067,11 @@ + { + int saveherefd; + +- result->fd = -1; ++ result->fd = cat_file(n); + result->buf = NULL; + result->nleft = 0; + result->jp = NULL; +- if (n == NULL) { ++ if (n == NULL || result->fd >= 0) { + goto out; + } + +@@ -3562,6 +3525,24 @@ + } + } + ++#ifdef CONFIG_FEATURE_BUILTIN_TEST ++static int ++testcmd(int argc, char** argv) ++{ ++ bb_applet_name = argv[0]; ++ return test_main(argc, argv); ++} ++#endif ++ ++#ifdef CONFIG_FEATURE_BUILTIN_PIDOF ++static int ++pidofcmd(int argc, char** argv) ++{ ++ bb_applet_name = argv[0]; ++ return pidof_main(argc, argv); ++} ++#endif ++ + + static int + falsecmd(int argc, char **argv) +@@ -4943,7 +4924,9 @@ + ckfree(in.buf); + if (in.fd >= 0) { + close(in.fd); +- back_exitstatus = waitforjob(in.jp); ++ if (in.jp != NULL) { ++ back_exitstatus = waitforjob(in.jp); ++ } + } + INTON; + +diff -Naur busybox-1.00-pre3.orig/shell/ash.d busybox-1.00-pre3/shell/ash.d +--- busybox-1.00-pre3.orig/shell/ash.d 1970-01-01 03:00:00.000000000 +0300 ++++ busybox-1.00-pre3/shell/ash.d 2003-11-07 17:47:59.000000000 +0300 +@@ -0,0 +1,70 @@ ++BUILTIN_COMMAND_SPEC(DOT_CMD, BUILTIN_SPEC_REG ".", dotcmd) ++BUILTIN_COMMAND_SPEC(COMMA_CMD, BUILTIN_SPEC_REG ":", truecmd) ++#ifdef CONFIG_FEATURE_BUILTIN_TEST ++BUILTIN_COMMAND_SPEC(RPAR_CMD, BUILTIN_REGULAR "[", testcmd) ++#endif ++#ifdef CONFIG_ASH_ALIAS ++BUILTIN_COMMAND_SPEC(ALIAS_CMD, BUILTIN_REG_ASSG "alias", aliascmd) ++#endif ++#ifdef JOBS ++BUILTIN_COMMAND_SPEC(BG_CMD, BUILTIN_REGULAR "bg", bgcmd) ++#endif ++BUILTIN_COMMAND_SPEC(BREAK_CMD, BUILTIN_SPEC_REG "break", breakcmd) ++BUILTIN_COMMAND_SPEC(CD_CMD, BUILTIN_REGULAR "cd", cdcmd) ++BUILTIN_COMMAND_SPEC(CHDIR_CMD, BUILTIN_NOSPEC "chdir", cdcmd) ++#ifdef CONFIG_ASH__CMD_CMD ++BUILTIN_COMMAND_SPEC(COMMAND_CMD, BUILTIN_REGULAR "command", commandcmd) ++#endif ++BUILTIN_COMMAND_SPEC(CONTINUE_CMD,BUILTIN_SPEC_REG "continue", breakcmd) ++#ifdef CONFIG_FEATURE_BUILTIN_ECHO ++BUILTIN_COMMAND_SPEC(ECHO_CMD, BUILTIN_REGULAR "echo", echocmd) ++#endif ++BUILTIN_COMMAND_SPEC(EVAL_CMD, BUILTIN_SPEC_REG "eval", evalcmd) ++BUILTIN_COMMAND_SPEC(EXEC_CMD, BUILTIN_SPEC_REG "exec", execcmd) ++BUILTIN_COMMAND_SPEC(EXIT_CMD, BUILTIN_SPEC_REG "exit", exitcmd) ++BUILTIN_COMMAND_SPEC(EXPORT_CMD, BUILTIN_SPEC_REG_ASSG "export", exportcmd) ++BUILTIN_COMMAND_SPEC(FALSE_CMD, BUILTIN_REGULAR "false", falsecmd) ++#ifdef JOBS ++BUILTIN_COMMAND_SPEC(FG_CMD, BUILTIN_REGULAR "fg", fgcmd) ++#endif ++#ifdef CONFIG_ASH_GETOPTS ++BUILTIN_COMMAND_SPEC(GETOPTS_CMD, BUILTIN_REGULAR "getopts", getoptscmd) ++#endif ++BUILTIN_COMMAND_SPEC(HASH_CMD, BUILTIN_NOSPEC "hash", hashcmd) ++#ifndef CONFIG_FEATURE_SH_EXTRA_QUIET ++BUILTIN_COMMAND_SPEC(HELP_CMD, BUILTIN_NOSPEC "help", helpcmd) ++#endif ++#ifdef JOBS ++BUILTIN_COMMAND_SPEC(JOBS_CMD, BUILTIN_REGULAR "jobs", jobscmd) ++BUILTIN_COMMAND_SPEC(KILL_CMD, BUILTIN_REGULAR "kill", killcmd) ++#endif ++#ifdef CONFIG_ASH_MATH_SUPPORT ++BUILTIN_COMMAND_SPEC(LET_CMD, BUILTIN_NOSPEC "let", letcmd) ++#endif ++BUILTIN_COMMAND_SPEC(LOCAL_CMD, BUILTIN_ASSIGN "local", localcmd) ++#ifdef CONFIG_FEATURE_BUILTIN_PIDOF ++BUILTIN_COMMAND_SPEC(PIDOF_CMD, BUILTIN_REGULAR "pidof", pidofcmd) ++#endif ++BUILTIN_COMMAND_SPEC(PWD_CMD, BUILTIN_NOSPEC "pwd", pwdcmd) ++BUILTIN_COMMAND_SPEC(READ_CMD, BUILTIN_REGULAR "read", readcmd) ++BUILTIN_COMMAND_SPEC(READONLY_CMD,BUILTIN_SPEC_REG_ASSG "readonly", exportcmd) ++BUILTIN_COMMAND_SPEC(RETURN_CMD, BUILTIN_SPEC_REG "return", returncmd) ++BUILTIN_COMMAND_SPEC(SET_CMD, BUILTIN_SPEC_REG "set", setcmd) ++BUILTIN_COMMAND_SPEC(SHIFT_CMD, BUILTIN_SPEC_REG "shift", shiftcmd) ++#ifdef CONFIG_FEATURE_BUILTIN_TEST ++BUILTIN_COMMAND_SPEC(TEST_CMD, BUILTIN_REGULAR "test", testcmd) ++#endif ++BUILTIN_COMMAND_SPEC(TIMES_CMD, BUILTIN_SPEC_REG "times", timescmd) ++BUILTIN_COMMAND_SPEC(TRAP_CMD, BUILTIN_SPEC_REG "trap", trapcmd) ++BUILTIN_COMMAND_SPEC(TRUE_CMD, BUILTIN_REGULAR "true", truecmd) ++BUILTIN_COMMAND_SPEC(TYPE_CMD, BUILTIN_NOSPEC "type", typecmd) ++BUILTIN_COMMAND_SPEC(ULIMIT_CMD, BUILTIN_NOSPEC "ulimit", ulimitcmd) ++BUILTIN_COMMAND_SPEC(UMASK_CMD, BUILTIN_REGULAR "umask", umaskcmd) ++#ifdef CONFIG_ASH_ALIAS ++BUILTIN_COMMAND_SPEC(UNALIAS_CMD, BUILTIN_REGULAR "unalias", unaliascmd) ++#endif ++BUILTIN_COMMAND_SPEC(UNSET_CMD, BUILTIN_SPEC_REG "unset", unsetcmd) ++BUILTIN_COMMAND_SPEC(WAIT_CMD, BUILTIN_REGULAR "wait", waitcmd) ++ ++ ++#undef BUILTIN_COMMAND_SPEC diff --git a/packages/busybox/busybox-1.00/openslug/defconfig b/packages/busybox/busybox-1.00/openslug/defconfig index 9985eb53cc..7debaeced2 100644 --- a/packages/busybox/busybox-1.00/openslug/defconfig +++ b/packages/busybox/busybox-1.00/openslug/defconfig @@ -221,21 +221,11 @@ CONFIG_FEATURE_VI_OPTIMIZE_CURSOR=y # Finding Utilities # # CONFIG_FIND is not set -# CONFIG_FEATURE_FIND_MTIME is not set -# CONFIG_FEATURE_FIND_PERM is not set -# CONFIG_FEATURE_FIND_TYPE is not set -# CONFIG_FEATURE_FIND_XDEV is not set -# CONFIG_FEATURE_FIND_NEWER is not set -# CONFIG_FEATURE_FIND_INUM is not set CONFIG_GREP=y CONFIG_FEATURE_GREP_EGREP_ALIAS=y CONFIG_FEATURE_GREP_FGREP_ALIAS=y CONFIG_FEATURE_GREP_CONTEXT=y # CONFIG_XARGS is not set -# CONFIG_FEATURE_XARGS_SUPPORT_CONFIRMATION is not set -# CONFIG_FEATURE_XARGS_SUPPORT_QUOTES is not set -# CONFIG_FEATURE_XARGS_SUPPORT_TERMOPT is not set -# CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM is not set # # Init Utilities @@ -282,18 +272,10 @@ CONFIG_TIME=y # # Linux Module Utilities # -CONFIG_INSMOD=y -CONFIG_FEATURE_2_4_MODULES=y -CONFIG_FEATURE_2_6_MODULES=y -# CONFIG_FEATURE_INSMOD_VERSION_CHECKING is not set -CONFIG_FEATURE_INSMOD_KSYMOOPS_SYMBOLS=y -# CONFIG_FEATURE_INSMOD_LOADINKMEM is not set -CONFIG_FEATURE_INSMOD_LOAD_MAP=y -CONFIG_FEATURE_INSMOD_LOAD_MAP_FULL=y -CONFIG_LSMOD=y -CONFIG_MODPROBE=y -CONFIG_RMMOD=y -CONFIG_FEATURE_CHECK_TAINTED_MODULE=y +# CONFIG_INSMOD is not set +# CONFIG_LSMOD is not set +# CONFIG_MODPROBE is not set +# CONFIG_RMMOD is not set # # Networking Utilities @@ -390,6 +372,10 @@ CONFIG_ASH=y # Ash Shell Options # CONFIG_ASH_JOB_CONTROL=y +CONFIG_ASH_PIPE_OPTIMIZATION=y +CONFIG_FEATURE_BUILTIN_TEST=y +CONFIG_FEATURE_BUILTIN_ECHO=y +CONFIG_FEATURE_BUILTIN_PIDOF=y CONFIG_ASH_ALIAS=y CONFIG_ASH_MATH_SUPPORT=y # CONFIG_ASH_MATH_SUPPORT_64 is not set diff --git a/packages/busybox/busybox_1.00.bb b/packages/busybox/busybox_1.00.bb index 6d26dfa014..97ad82ae56 100644 --- a/packages/busybox/busybox_1.00.bb +++ b/packages/busybox/busybox_1.00.bb @@ -10,7 +10,7 @@ HOMEPAGE = "http://www.busybox.net" LICENSE = "GPL" SECTION = "base" PRIORITY = "required" -PR = "r23" +PR = "r24" SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.gz \ file://add-getkey-applet.patch;patch=1 \ -- cgit v1.2.3