diff options
Diffstat (limited to 'shell')
| -rw-r--r-- | shell/ash.c | 13 | ||||
| -rw-r--r-- | shell/ash_test/ash-misc/nulltick1.right | 3 | ||||
| -rwxr-xr-x | shell/ash_test/ash-misc/nulltick1.tests | 3 | ||||
| -rw-r--r-- | shell/hush.c | 12 |
4 files changed, 22 insertions, 9 deletions
diff --git a/shell/ash.c b/shell/ash.c index 798d15a4c..34f70ecfc 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
| @@ -43,8 +43,6 @@ | |||
| 43 | #endif | 43 | #endif |
| 44 | 44 | ||
| 45 | #include "busybox.h" /* for applet_names */ | 45 | #include "busybox.h" /* for applet_names */ |
| 46 | //TODO: pull in some .h and find out do we have SINGLE_APPLET_MAIN? | ||
| 47 | //#include "applet_tables.h" doesn't work | ||
| 48 | #include <paths.h> | 46 | #include <paths.h> |
| 49 | #include <setjmp.h> | 47 | #include <setjmp.h> |
| 50 | #include <fnmatch.h> | 48 | #include <fnmatch.h> |
| @@ -58,12 +56,15 @@ | |||
| 58 | # define CLEAR_RANDOM_T(rnd) ((void)0) | 56 | # define CLEAR_RANDOM_T(rnd) ((void)0) |
| 59 | #endif | 57 | #endif |
| 60 | 58 | ||
| 61 | #if defined SINGLE_APPLET_MAIN | 59 | #define SKIP_definitions 1 |
| 60 | #include "applet_tables.h" | ||
| 61 | #undef SKIP_definitions | ||
| 62 | #if NUM_APPLETS == 1 | ||
| 62 | /* STANDALONE does not make sense, and won't compile */ | 63 | /* STANDALONE does not make sense, and won't compile */ |
| 63 | # undef CONFIG_FEATURE_SH_STANDALONE | 64 | # undef CONFIG_FEATURE_SH_STANDALONE |
| 64 | # undef ENABLE_FEATURE_SH_STANDALONE | 65 | # undef ENABLE_FEATURE_SH_STANDALONE |
| 65 | # undef IF_FEATURE_SH_STANDALONE | 66 | # undef IF_FEATURE_SH_STANDALONE |
| 66 | # undef IF_NOT_FEATURE_SH_STANDALONE(...) | 67 | # undef IF_NOT_FEATURE_SH_STANDALONE |
| 67 | # define ENABLE_FEATURE_SH_STANDALONE 0 | 68 | # define ENABLE_FEATURE_SH_STANDALONE 0 |
| 68 | # define IF_FEATURE_SH_STANDALONE(...) | 69 | # define IF_FEATURE_SH_STANDALONE(...) |
| 69 | # define IF_NOT_FEATURE_SH_STANDALONE(...) __VA_ARGS__ | 70 | # define IF_NOT_FEATURE_SH_STANDALONE(...) __VA_ARGS__ |
| @@ -4539,7 +4540,7 @@ forkchild(struct job *jp, union node *n, int mode) | |||
| 4539 | if (mode == FORK_NOJOB /* is it `xxx` ? */ | 4540 | if (mode == FORK_NOJOB /* is it `xxx` ? */ |
| 4540 | && n && n->type == NCMD /* is it single cmd? */ | 4541 | && n && n->type == NCMD /* is it single cmd? */ |
| 4541 | /* && n->ncmd.args->type == NARG - always true? */ | 4542 | /* && n->ncmd.args->type == NARG - always true? */ |
| 4542 | && strcmp(n->ncmd.args->narg.text, "trap") == 0 | 4543 | && n->ncmd.args && strcmp(n->ncmd.args->narg.text, "trap") == 0 |
| 4543 | && n->ncmd.args->narg.next == NULL /* "trap" with no arguments */ | 4544 | && n->ncmd.args->narg.next == NULL /* "trap" with no arguments */ |
| 4544 | /* && n->ncmd.args->narg.backquote == NULL - do we need to check this? */ | 4545 | /* && n->ncmd.args->narg.backquote == NULL - do we need to check this? */ |
| 4545 | ) { | 4546 | ) { |
| @@ -4627,7 +4628,7 @@ forkchild(struct job *jp, union node *n, int mode) | |||
| 4627 | } | 4628 | } |
| 4628 | #if JOBS | 4629 | #if JOBS |
| 4629 | if (n && n->type == NCMD | 4630 | if (n && n->type == NCMD |
| 4630 | && strcmp(n->ncmd.args->narg.text, "jobs") == 0 | 4631 | && n->ncmd.args && strcmp(n->ncmd.args->narg.text, "jobs") == 0 |
| 4631 | ) { | 4632 | ) { |
| 4632 | TRACE(("Job hack\n")); | 4633 | TRACE(("Job hack\n")); |
| 4633 | /* "jobs": we do not want to clear job list for it, | 4634 | /* "jobs": we do not want to clear job list for it, |
diff --git a/shell/ash_test/ash-misc/nulltick1.right b/shell/ash_test/ash-misc/nulltick1.right new file mode 100644 index 000000000..f90b8209e --- /dev/null +++ b/shell/ash_test/ash-misc/nulltick1.right | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | Test 1 | ||
| 2 | Test 2 | ||
| 3 | Done | ||
diff --git a/shell/ash_test/ash-misc/nulltick1.tests b/shell/ash_test/ash-misc/nulltick1.tests new file mode 100755 index 000000000..f81923de3 --- /dev/null +++ b/shell/ash_test/ash-misc/nulltick1.tests | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | echo Test ` ` 1 | ||
| 2 | echo Test `</dev/null` 2 | ||
| 3 | echo Done | ||
diff --git a/shell/hush.c b/shell/hush.c index e0c562621..2aeb8e440 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
| @@ -125,14 +125,18 @@ | |||
| 125 | # define USE_FOR_MMU(...) | 125 | # define USE_FOR_MMU(...) |
| 126 | #endif | 126 | #endif |
| 127 | 127 | ||
| 128 | #if defined SINGLE_APPLET_MAIN | 128 | #define SKIP_definitions 1 |
| 129 | #include "applet_tables.h" | ||
| 130 | #undef SKIP_definitions | ||
| 131 | #if NUM_APPLETS == 1 | ||
| 129 | /* STANDALONE does not make sense, and won't compile */ | 132 | /* STANDALONE does not make sense, and won't compile */ |
| 130 | # undef CONFIG_FEATURE_SH_STANDALONE | 133 | # undef CONFIG_FEATURE_SH_STANDALONE |
| 131 | # undef ENABLE_FEATURE_SH_STANDALONE | 134 | # undef ENABLE_FEATURE_SH_STANDALONE |
| 132 | # undef IF_FEATURE_SH_STANDALONE | 135 | # undef IF_FEATURE_SH_STANDALONE |
| 136 | # undef IF_NOT_FEATURE_SH_STANDALONE | ||
| 137 | # define ENABLE_FEATURE_SH_STANDALONE 0 | ||
| 133 | # define IF_FEATURE_SH_STANDALONE(...) | 138 | # define IF_FEATURE_SH_STANDALONE(...) |
| 134 | # define IF_NOT_FEATURE_SH_STANDALONE(...) __VA_ARGS__ | 139 | # define IF_NOT_FEATURE_SH_STANDALONE(...) __VA_ARGS__ |
| 135 | # define ENABLE_FEATURE_SH_STANDALONE 0 | ||
| 136 | #endif | 140 | #endif |
| 137 | 141 | ||
| 138 | #if !ENABLE_HUSH_INTERACTIVE | 142 | #if !ENABLE_HUSH_INTERACTIVE |
| @@ -3568,7 +3572,9 @@ static void execvp_or_die(char **argv) | |||
| 3568 | { | 3572 | { |
| 3569 | debug_printf_exec("execing '%s'\n", argv[0]); | 3573 | debug_printf_exec("execing '%s'\n", argv[0]); |
| 3570 | sigprocmask(SIG_SETMASK, &G.inherited_set, NULL); | 3574 | sigprocmask(SIG_SETMASK, &G.inherited_set, NULL); |
| 3571 | execvp(argv[0], argv); | 3575 | /* if FEATURE_SH_STANDALONE, "exec <applet_name>" should work, |
| 3576 | * therefore we should use BB_EXECVP, not execvp */ | ||
| 3577 | BB_EXECVP(argv[0], argv); | ||
| 3572 | bb_perror_msg("can't execute '%s'", argv[0]); | 3578 | bb_perror_msg("can't execute '%s'", argv[0]); |
| 3573 | _exit(127); /* bash compat */ | 3579 | _exit(127); /* bash compat */ |
| 3574 | } | 3580 | } |
