package/busybox: update to busybox-1.7.1, include upstream patches
[openwrt/staging/yousong.git] / package / busybox / patches / 922-shell.patch
1 --- a/shell/ash.c
2 +++ b/shell/ash.c
3 @@ -4515,6 +4515,7 @@ clear_traps(void)
4 INT_ON;
5 }
6 }
7 + may_have_traps = 0;
8 }
9
10 /* Lives far away from here, needed for forkchild */
11 diff -urpN busybox-1.17.1/shell/ash_test/ash-signals/signal7.right busybox-1.17.1-shell/shell/ash_test/ash-signals/signal7.right
12 --- busybox-1.17.1/shell/ash_test/ash-signals/signal7.right 1970-01-01 01:00:00.000000000 +0100
13 +++ busybox-1.17.1-shell/shell/ash_test/ash-signals/signal7.right 2010-07-25 13:09:32.000000000 +0200
14 @@ -0,0 +1 @@
15 +Bug detected: 0
16 diff -urpN busybox-1.17.1/shell/ash_test/ash-signals/signal7.tests busybox-1.17.1-shell/shell/ash_test/ash-signals/signal7.tests
17 --- busybox-1.17.1/shell/ash_test/ash-signals/signal7.tests 1970-01-01 01:00:00.000000000 +0100
18 +++ busybox-1.17.1-shell/shell/ash_test/ash-signals/signal7.tests 2010-07-25 13:09:32.000000000 +0200
19 @@ -0,0 +1,18 @@
20 +bug() {
21 + trap : exit
22 + # Bug was causing sh to be run in subshell,
23 + # as if this line is replaced with (sh -c ...; exit $?) &
24 + # here:
25 + sh -c 'echo REAL_CHILD=$$' &
26 + echo PARENTS_IDEA_OF_CHILD=$!
27 + wait # make sure bkgd shell completes
28 +}
29 +
30 +bug | {
31 +while read varval; do
32 + eval $varval
33 +done
34 +test x"$REAL_CHILD" != x"" \
35 +&& test x"$REAL_CHILD" = x"$PARENTS_IDEA_OF_CHILD"
36 +echo "Bug detected: $?"
37 +}
38 diff -urpN busybox-1.17.1/shell/hush.c busybox-1.17.1-shell/shell/hush.c
39 --- busybox-1.17.1/shell/hush.c 2010-07-25 00:12:43.000000000 +0200
40 +++ busybox-1.17.1-shell/shell/hush.c 2010-07-25 13:09:32.000000000 +0200
41 @@ -3901,8 +3901,6 @@ static void insert_bg_job(struct pipe *p
42
43 if (G_interactive_fd)
44 printf("[%d] %d %s\n", job->jobid, job->cmds[0].pid, job->cmdtext);
45 - /* Last command's pid goes to $! */
46 - G.last_bg_pid = job->cmds[job->num_cmds - 1].pid;
47 G.last_jobid = job->jobid;
48 }
49
50 @@ -4825,6 +4823,8 @@ static int run_list(struct pipe *pi)
51 if (G.run_list_level == 1)
52 insert_bg_job(pi);
53 #endif
54 + /* Last command's pid goes to $! */
55 + G.last_bg_pid = pi->cmds[pi->num_cmds - 1].pid;
56 G.last_exitcode = rcode = EXIT_SUCCESS;
57 debug_printf_exec(": cmd&: exitcode EXIT_SUCCESS\n");
58 } else {
59 diff -urpN busybox-1.17.1/shell/hush_test/hush-trap/signal7.right busybox-1.17.1-shell/shell/hush_test/hush-trap/signal7.right
60 --- busybox-1.17.1/shell/hush_test/hush-trap/signal7.right 1970-01-01 01:00:00.000000000 +0100
61 +++ busybox-1.17.1-shell/shell/hush_test/hush-trap/signal7.right 2010-07-25 13:09:32.000000000 +0200
62 @@ -0,0 +1 @@
63 +Bug detected: 0
64 diff -urpN busybox-1.17.1/shell/hush_test/hush-trap/signal7.tests busybox-1.17.1-shell/shell/hush_test/hush-trap/signal7.tests
65 --- busybox-1.17.1/shell/hush_test/hush-trap/signal7.tests 1970-01-01 01:00:00.000000000 +0100
66 +++ busybox-1.17.1-shell/shell/hush_test/hush-trap/signal7.tests 2010-07-25 13:09:32.000000000 +0200
67 @@ -0,0 +1,18 @@
68 +bug() {
69 + trap : exit
70 + # Bug was causing sh to be run in subshell,
71 + # as if this line is replaced with (sh -c ...; exit $?) &
72 + # here:
73 + sh -c 'echo REAL_CHILD=$$' &
74 + echo PARENTS_IDEA_OF_CHILD=$!
75 + wait # make sure bkgd shell completes
76 +}
77 +
78 +bug | {
79 +while read varval; do
80 + eval $varval
81 +done
82 +test x"$REAL_CHILD" != x"" \
83 +&& test x"$REAL_CHILD" = x"$PARENTS_IDEA_OF_CHILD"
84 +echo "Bug detected: $?"
85 +}
86 diff -urpN busybox-1.17.1/shell/shell_common.c busybox-1.17.1-shell/shell/shell_common.c
87 --- busybox-1.17.1/shell/shell_common.c 2010-07-06 04:25:54.000000000 +0200
88 +++ busybox-1.17.1-shell/shell/shell_common.c 2010-07-27 08:41:43.000000000 +0200
89 @@ -428,9 +428,14 @@ shell_builtin_ulimit(char **argv)
90 val <<= l->factor_shift;
91 }
92 //bb_error_msg("opt %c val_str:'%s' val:%lld", opt_char, val_str, (long long)val);
93 + /* from man bash: "If neither -H nor -S
94 + * is specified, both the soft and hard
95 + * limits are set. */
96 + if (!opts)
97 + opts = OPT_hard + OPT_soft;
98 if (opts & OPT_hard)
99 limit.rlim_max = val;
100 - if ((opts & OPT_soft) || opts == 0)
101 + if (opts & OPT_soft)
102 limit.rlim_cur = val;
103 //bb_error_msg("setrlimit(%d, %lld, %lld)", l->cmd, (long long)limit.rlim_cur, (long long)limit.rlim_max);
104 if (setrlimit(l->cmd, &limit) < 0) {