1 |
## oils_failures_allowed: 3
|
2 |
## compare_shells: bash dash mksh
|
3 |
|
4 |
|
5 |
|
6 |
python2 -c 'print("echo -n %s" % ("x" * 65535))' > tmp.sh
|
7 |
$SH tmp.sh > out
|
8 |
wc --bytes out
|
9 |
|
10 |
## STDOUT:
|
11 |
65535 out
|
12 |
## END
|
13 |
|
14 |
|
15 |
|
16 |
python2 -c 'print("echo -n %s" % ("x" * 65536))' > tmp.sh
|
17 |
$SH tmp.sh > out
|
18 |
echo status=$?
|
19 |
wc --bytes out
|
20 |
|
21 |
## STDOUT:
|
22 |
status=2
|
23 |
0 out
|
24 |
## END
|
25 |
|
26 |
## OK dash/bash/mksh status: 0
|
27 |
## OK dash/bash/mksh STDOUT:
|
28 |
status=0
|
29 |
65536 out
|
30 |
## END
|
31 |
|
32 |
|
33 |
echo $%
|
34 |
## stdout: $%
|
35 |
|
36 |
|
37 |
echo ${%}
|
38 |
## status: 2
|
39 |
## OK bash/mksh status: 1
|
40 |
|
41 |
|
42 |
if test -f /; then
|
43 |
echo ${%}
|
44 |
else
|
45 |
echo ok
|
46 |
fi
|
47 |
## status: 2
|
48 |
## BUG dash/bash/mksh status: 0
|
49 |
|
50 |
|
51 |
echo hi; while
|
52 |
echo status=$?
|
53 |
## status: 2
|
54 |
## stdout-json: ""
|
55 |
## OK mksh status: 1
|
56 |
|
57 |
|
58 |
echo hi; for
|
59 |
echo status=$?
|
60 |
## status: 2
|
61 |
## stdout-json: ""
|
62 |
## OK mksh status: 1
|
63 |
|
64 |
|
65 |
echo hi; if
|
66 |
echo status=$?
|
67 |
## status: 2
|
68 |
## stdout-json: ""
|
69 |
## OK mksh status: 1
|
70 |
|
71 |
|
72 |
do echo hi
|
73 |
## status: 2
|
74 |
## stdout-json: ""
|
75 |
## OK mksh status: 1
|
76 |
|
77 |
|
78 |
}
|
79 |
echo should not get here
|
80 |
## stdout-json: ""
|
81 |
## status: 2
|
82 |
## OK mksh status: 1
|
83 |
|
84 |
|
85 |
# bash and mksh give parse time error because of }
|
86 |
# dash gives 127 as runtime error
|
87 |
{ls; }
|
88 |
echo "status=$?"
|
89 |
## stdout-json: ""
|
90 |
## status: 2
|
91 |
## OK mksh status: 1
|
92 |
|
93 |
|
94 |
set -o errexit
|
95 |
{ls;
|
96 |
}
|
97 |
## status: 127
|
98 |
|
99 |
|
100 |
for i.j in a b c; do
|
101 |
echo hi
|
102 |
done
|
103 |
echo done
|
104 |
## stdout-json: ""
|
105 |
## status: 2
|
106 |
## OK mksh status: 1
|
107 |
## OK bash status: 0
|
108 |
## BUG bash stdout: done
|
109 |
|
110 |
|
111 |
# bash and dash disagree on exit code.
|
112 |
FOO-BAR=foo
|
113 |
## status: 127
|
114 |
|
115 |
|
116 |
# bash and dash disagree on exit code.
|
117 |
export FOO-BAR=foo
|
118 |
## status: 1
|
119 |
## OK dash status: 2
|
120 |
|
121 |
|
122 |
# bash and dash disagree on exit code.
|
123 |
f() {
|
124 |
local FOO-BAR=foo
|
125 |
}
|
126 |
f
|
127 |
## status: 1
|
128 |
## OK dash status: 2
|
129 |
|
130 |
|
131 |
echo a(b)
|
132 |
## status: 2
|
133 |
## OK mksh status: 1
|
134 |
|
135 |
|
136 |
$(x
|
137 |
## status: 2
|
138 |
## OK mksh status: 1
|
139 |
|
140 |
|
141 |
`x
|
142 |
## status: 2
|
143 |
## OK mksh status: 1
|
144 |
|
145 |
|
146 |
echo 1 ;; echo 2
|
147 |
## stdout-json: ""
|
148 |
## status: 2
|
149 |
## OK mksh status: 1
|
150 |
|
151 |
|
152 |
# regression test for commit 451ca9e2b437e0326fc8155783d970a6f32729d8
|
153 |
[[ || true ]]
|
154 |
## status: 2
|
155 |
## N-I dash status: 0
|
156 |
## OK mksh status: 1
|
157 |
|
158 |
|
159 |
flags=''
|
160 |
case $SH in
|
161 |
*bash|*osh)
|
162 |
flags='--rcfile /dev/null'
|
163 |
;;
|
164 |
esac
|
165 |
$SH $flags -i -c 'var=)'
|
166 |
|
167 |
## status: 2
|
168 |
## OK bash/mksh status: 1
|
169 |
|
170 |
|
171 |
a=( inside=() )
|
172 |
echo len=${#a[@]}
|
173 |
## status: 2
|
174 |
## stdout-json: ""
|
175 |
## OK mksh status: 1
|
176 |
## BUG bash status: 0
|
177 |
## BUG bash stdout: len=0
|
178 |
|
179 |
|
180 |
f() {
|
181 |
for x in a=(); do
|
182 |
echo x=$x
|
183 |
done
|
184 |
echo done
|
185 |
}
|
186 |
f
|
187 |
## status: 2
|
188 |
## stdout-json: ""
|
189 |
## OK mksh status: 1
|
190 |
|
191 |
|
192 |
f() {
|
193 |
case a=() in
|
194 |
foo)
|
195 |
echo hi
|
196 |
;;
|
197 |
esac
|
198 |
}
|
199 |
f
|
200 |
## status: 2
|
201 |
## stdout-json: ""
|
202 |
## OK mksh status: 1
|
203 |
|
204 |
|
205 |
|
206 |
# Lit_VarLike and then (, but NOT at the beginning of a word.
|
207 |
|
208 |
f() {
|
209 |
%foo=()
|
210 |
}
|
211 |
## status: 2
|
212 |
## stdout-json: ""
|
213 |
## OK mksh status: 1
|
214 |
|
215 |
|
216 |
=word
|
217 |
## OK osh status: 2
|
218 |
## status: 127
|
219 |
|
220 |
|
221 |
echo =word
|
222 |
## STDOUT:
|
223 |
=word
|
224 |
## END
|