blob: d492671fb286c10c224d4196ed4b4cdf214f7b4f [file] [log] [blame]
Denis Vlasenkoe4712752007-04-14 15:08:41 +00001Various bits of what is known about busybox shells, in no particular order.
2
Denis Vlasenko21f0d4c2007-05-06 14:15:42 +000032006-05-06
4hush: more bugs spotted. Comparison with bash:
5bash-3.2# echo "TEST`date;echo;echo`BEST"
6TESTSun May 6 09:21:05 CEST 2007BEST [we dont strip eols]
7bash-3.2# echo "TEST`echo '$(echo ZZ)'`BEST"
8TEST$(echo ZZ)BEST [we execute inner echo]
9bash-3.2# echo "TEST`echo "'"`BEST"
10TEST'BEST [we totally mess up this one]
11bash-3.2# echo `sleep 5`
12[Ctrl-C should work, Ctrl-Z should do nothing][we totally mess up this one]
13bash-3.2# if true; then
14> [Ctrl-C]
15bash-3.2# [we re-issue "> "]
16bash-3.2# if echo `sleep 5`; then
17> true; fi [we execute sleep before "> "]
18
Denis Vlasenkoac0e5ab2007-05-04 21:37:27 +0000192007-05-04
Denis Vlasenko21f0d4c2007-05-06 14:15:42 +000020hush: made ctrl-Z/C work correctly for "while true; do true; done"
21(namely, it backgrounds/interrupts entire "while")
Denis Vlasenkoac0e5ab2007-05-04 21:37:27 +000022
Denis Vlasenkoe725bfe2007-05-03 22:45:39 +0000232007-05-03
Denis Vlasenko3349fc42007-05-04 14:54:36 +000024hush: new bug spotted: Ctrl-C on "while true; do true; done" doesn't
25work right:
26# while true; do true; done
27[1] 0 true <-- pressing Ctrl-C several times...
28[2] 0 true
29[3] 0 true
30Segmentation fault
Denis Vlasenko400c5b62007-05-04 13:07:27 +000031
322007-05-03
Denis Vlasenkoe725bfe2007-05-03 22:45:39 +000033hush: update on "sleep 1 | exit 3; echo $?" bug.
34parse_stream_outer() repeatedly calls parse_stream().
35parse_stream() is now fixed to stop on ';' in this example,
36fixing it (parse_stream_outer() will call parse_stream() 1st time,
37execute the parse tree, call parse_stream() 2nd time and execute the tree).
38But it's not the end of story.
39In more complex situations we _must_ parse way farther before executing.
40Example #2: "{ sleep 1 | exit 3; echo $?; ...few_lines... } >file".
41Because of redirection, we cannot execute 1st pipe before we parse it all.
42We probably need to learn to store $var expressions in parse tree.
43Debug printing of parse tree would be nice too.
44
Denis Vlasenko08c8c1d2007-04-28 22:39:02 +0000452007-04-28
46hush: Ctrl-C and Ctrl-Z for single NOFORK commands are working.
47Memory and other resource leaks (opendir) are not addressed
48(testcase is "rm -i" interrupted by ctrl-c).
49
Denis Vlasenko52881e92007-04-21 13:42:52 +0000502007-04-21
Denis Vlasenko1359da62007-04-21 23:27:30 +000051hush: "sleep 5 | sleep 6" + Ctrl-Z + fg seems to work.
52"rm -i" + Ctrl-C, "sleep 5" + Ctrl-Z still doesn't work
53for SH_STANDALONE case :(
54
552007-04-21
Denis Vlasenko52881e92007-04-21 13:42:52 +000056hush: fixed non-backgrounding of "sleep 1 &" and totally broken
57"sleep 1 | sleep 2 &". Noticed a bug where successive jobs
58get numbers 1,2,3 even when job #1 has exited before job# 2 is started.
59(bash reuses #1 in this case)
60
612007-04-21
Denis Vlasenko2f1bb362007-04-21 10:01:14 +000062hush: "sleep 1 | exit 3; echo $?" prints 0 because $? is substituted
63_before_ pipe gets executed!! run_list_real() already has "pipe;echo"
64parsed and handed to it for execution, so it sees "pipe"; "echo 0".
65
Denis Vlasenko54e7ffb2007-04-21 00:03:36 +0000662007-04-21
67hush: removed setsid() and made job control sort-of-sometimes-work.
68Ctrl-C in "rm -i" works now except for SH_STANDALONE case.
69"sleep 1 | exit 3" + "echo $?" works, "sleep 1 | exit 3; echo $?"
70shows exitcode 0 (should be 3). "sleep 1 | sleep 2 &" fails horribly.
71
Denis Vlasenkoe4712752007-04-14 15:08:41 +0000722007-04-14
73lash, hush: both do setsid() and as a result don't have ctty!
74Ctrl-C doesn't work for any child (try rm -i), etc...
75lash: bare ">file" doesn't create a file (hush works)