Results for sh-options.test.sh

statusbashdashmkshosh
pass 35172138
ok 8662
N-I 120152
BUG 0120
FAIL 0002
total44444444
casebashdashmkshoshdescription
0ok pass ok pass $- with -c
detailsdetails
1ok N-I ok pass $- with pipefail
detailsdetailsdetails
2pass N-I pass pass $- and more options
details
3pass pass pass pass $- with interactive shell
4pass pass pass pass pass short options like sh -e
5pass pass pass pass pass long options like sh -o errexit
6pass N-I N-I pass pass shopt options like sh -O nullglob
detailsdetails
7pass BUG BUG pass can continue after unknown option
detailsdetails
8pass pass pass pass set with both options and argv
9pass pass pass pass set -o vi/emacs
10pass N-I N-I pass vi and emacs are mutually exclusive
detailsdetails
11pass N-I ok pass interactive shell starts with emacs mode on
detailsdetails
12pass ok pass pass nounset
details
13pass ok pass pass -u is nounset
details
14pass pass pass pass nounset with "$@"
15pass pass pass pass set -u -- clears argv
16pass pass pass pass set -u -- x y z
17pass pass pass pass reset option with long flag
18pass pass pass pass reset option with short flag
19pass ok pass pass set -eu (flag parsing)
details
20pass pass pass FAIL -n for no execution (useful with --ast-output)
details
21pass N-I pass pass pipefail
details
22pass N-I N-I pass shopt -p -o prints 'set' options
detailsdetails
23pass N-I N-I pass shopt -p prints 'shopt' options
detailsdetails
24pass N-I N-I pass shopt with no flags prints options
detailsdetails
25pass pass pass pass noclobber off
26pass ok pass FAIL noclobber on
detailsdetails
27pass N-I N-I pass SHELLOPTS is updated when options are changed
detailsdetails
28pass N-I N-I ok SHELLOPTS is readonly
detailsdetailsdetails
29pass pass BUG ok set - -
detailsdetails
30pass pass pass pass set -o lists options
31pass ok ok pass set without args lists variables
detailsdetails
32pass pass pass pass 'set' and 'eval' round trip
33pass N-I ok N-I set without args and array variables (not in OSH)
detailsdetailsdetails
34pass N-I N-I N-I set without args and assoc array variables (not in OSH)
detailsdetailsdetails
35pass N-I N-I pass shopt -q
detailsdetails
36ok N-I N-I pass shopt -q invalid
detailsdetailsdetails
37N-I N-I N-I pass shopt -s strict:all
detailsdetailsdetails
38pass N-I N-I pass shopt allows for backward compatibility like bash
detailsdetails
39ok N-I N-I pass shopt -p validates option names
detailsdetailsdetails
40ok N-I N-I pass shopt -p -o validates option names
detailsdetailsdetails
41ok ok ok pass stubbed out bash options
detailsdetailsdetails
42ok N-I N-I pass shopt -s nounset works in Oil, not in bash
detailsdetailsdetails
43ok pass pass pass no-ops not in shopt -p output
details
111 passed, 22 OK, 38 not implemented, 3 BUG, 2 failed, 0 timeouts, 0 cases skipped
2 failed under osh

Details on runs that didn't PASS

bash0 $- with -c

stdout:
huBc
stderr:
mksh0 $- with -c

stdout:
uhc
stderr:
bash1 $- with pipefail

stdout:
huBs
stderr:
dash1 $- with pipefail

stdout:
stderr: 
dash: 1: set: Illegal option -o pipefail
mksh1 $- with pipefail

stdout:
ush
stderr:
dash2 $- and more options

stdout:
stderr: 
dash: 3: [[: not found
dash6 pass shopt options like sh -O nullglob

stdout:
stderr: 
dash: 0: Illegal option -O
dash: 0: Illegal option -O
mksh6 pass shopt options like sh -O nullglob

stdout:
stderr: 
mksh: mksh: -O: unknown option
mksh: mksh: -O: unknown option
dash7 can continue after unknown option

stdout:
stderr: 
dash: 2: set: Illegal option -o STRICT
mksh7 can continue after unknown option

stdout:
stderr: 
mksh: <stdin>[2]: set: STRICT: bad option
dash10 vi and emacs are mutually exclusive

stdout:
___
___
___
stderr:
dash: 2: shopt: not found
dash: 2: shopt: not found
dash: 2: shopt: not found
mksh10 vi and emacs are mutually exclusive

stdout:
___
___
___
stderr:
mksh: <stdin>[5]: shopt: not found
mksh: <stdin>[8]: shopt: not found
mksh: <stdin>[11]: shopt: not found
dash11 interactive shell starts with emacs mode on

stdout:
stderr: 
mksh11 interactive shell starts with emacs mode on

stdout:
non-interactive
0
1
interactive
0
1
stderr:
dash12 nounset

stdout:
[]
stderr:
dash: 3: unset: parameter not set
dash13 -u is nounset

stdout:
[]
stderr:
dash: 3: unset: parameter not set
dash19 set -eu (flag parsing)

stdout:
stderr: 
dash: 2: unset: parameter not set
osh20 -n for no execution (useful with --ast-output)

[osh stdout] Expected '1\n', got '1\n2\n3\n'

stdout:
1
2
3
stderr:
dash21 pipefail

stdout:
0
stderr:
dash: 3: set: Illegal option -o pipefail
dash22 shopt -p -o prints 'set' options

stdout:
stderr: 
dash: 1: shopt: not found
dash: 3: shopt: not found
mksh22 shopt -p -o prints 'set' options

stdout:
stderr: 
mksh: <stdin>[1]: shopt: not found
mksh: <stdin>[3]: shopt: not found
dash23 shopt -p prints 'shopt' options

stdout:
stderr: 
dash: 1: shopt: not found
dash: 2: shopt: not found
dash: 3: shopt: not found
mksh23 shopt -p prints 'shopt' options

stdout:
stderr: 
mksh: <stdin>[1]: shopt: not found
mksh: <stdin>[2]: shopt: not found
mksh: <stdin>[3]: shopt: not found
dash24 shopt with no flags prints options

stdout:
0 one.txt
0
stderr:
dash: 3: shopt: not found
dash: 8: shopt: not found
mksh24 shopt with no flags prints options

stdout:
0 one.txt
0
stderr:
mksh: <stdin>[3]: shopt: not found
mksh: <stdin>[8]: shopt: not found
dash26 noclobber on

stdout:
0
2
stderr:
rm: cannot remove '/home/andy/git/oilshell/oil/_tmp/spec-tmp/sh-options.test.sh.4600/26-dash/no-clobber': No such file or directory
dash: 5: cannot create /home/andy/git/oilshell/oil/_tmp/spec-tmp/sh-options.test.sh.4600/26-dash/no-clobber: File exists
osh26 noclobber on

[osh stdout] Expected u'0\n1\n', got '0\n0\n'

stdout:
0
0
stderr:
rm: cannot remove '/home/andy/git/oilshell/oil/_tmp/spec-tmp/sh-options.test.sh.4600/26-osh/no-clobber': No such file or directory
dash27 SHELLOPTS is updated when options are changed

stdout:
1
1
1
stderr:
+ echo
+ grep -q xtrace
+ echo 1
+ set +x
mksh27 SHELLOPTS is updated when options are changed

stdout:
1
1
1
stderr:
+ echo
+ grep -q xtrace
+ echo 1
+ set +x
dash28 SHELLOPTS is readonly

stdout:
status=0
stderr:
mksh28 SHELLOPTS is readonly

stdout:
status=0
stderr:
osh28 SHELLOPTS is readonly

stdout:
stderr: 
  SHELLOPTS=x
  ^~~~~~~~~~
[ stdin ]:1: fatal: Can't assign to readonly value 'SHELLOPTS'
mksh29 set - -

stdout:
a b
a b
a b
-
+
-
--
stderr:
osh29 set - -

stdout:
a b
- a b
a b
- -
- +
+ -
--
stderr:
dash31 set without args lists variables

stdout:
__GLOBAL='mutated'
__OTHERLOCAL='L'
__mylocal='L'
__var_in_parent_scope='D'
stderr:
mksh31 set without args lists variables

stdout:
__GLOBAL=mutated
__var_in_parent_scope=D
__OTHERLOCAL=L
__mylocal=L
stderr:
dash33 set without args and array variables (not in OSH)

stdout:
stderr: 
dash: 1: declare: not found
dash: 2: Syntax error: "(" unexpected
mksh33 set without args and array variables (not in OSH)

stdout:
__array[0]=1
__array[1]=2
__array[2]='3 4'
stderr:
mksh: <stdin>[1]: declare: not found
osh33 set without args and array variables (not in OSH)

stdout:
stderr: 
dash34 set without args and assoc array variables (not in OSH)

stdout:
stderr: 
dash: 1: typeset: not found
dash: 2: __assoc[k e y]=v a l: not found
dash: 3: __assoc[a]=b: not found
mksh34 set without args and assoc array variables (not in OSH)

stdout:
stderr: 
mksh: <stdin>[1]: typeset: -A: unknown option
mksh: <stdin>[2]: 'k e y': multi-character character constant
osh34 set without args and assoc array variables (not in OSH)

stdout:
stderr: 
  __assoc[a]=b
  ^~~~~~~~
[ stdin ]:3: fatal: Associative array keys must be strings: $x 'x' "$x" etc.
dash35 shopt -q

stdout:
nullglob=127
nullglob=127
nullglob,failglob=127
nullglob,failglob=127
stderr:
dash: 1: shopt: not found
dash: 4: shopt: not found
dash: 6: shopt: not found
dash: 9: shopt: not found
dash: 12: shopt: not found
dash: 13: shopt: not found
mksh35 shopt -q

stdout:
nullglob=127
nullglob=127
nullglob,failglob=127
nullglob,failglob=127
stderr:
mksh: <stdin>[1]: shopt: not found
mksh: <stdin>[4]: shopt: not found
mksh: <stdin>[6]: shopt: not found
mksh: <stdin>[9]: shopt: not found
mksh: <stdin>[12]: shopt: not found
mksh: <stdin>[13]: shopt: not found
bash36 shopt -q invalid

stdout:
invalidZZ=1
stderr:
bash: line 1: shopt: invalidZZ: invalid shell option name
dash36 shopt -q invalid

stdout:
invalidZZ=127
stderr:
dash: 1: shopt: not found
mksh36 shopt -q invalid

stdout:
invalidZZ=127
stderr:
mksh: <stdin>[1]: shopt: not found
bash37 shopt -s strict:all

stdout:
-
-
-
stderr:
bash: line 9: shopt: strict:all: invalid shell option name
bash: line 11: shopt: strict_arith: invalid shell option name
dash37 shopt -s strict:all

stdout:
stderr: 
dash: 3: Syntax error: Bad function name
mksh37 shopt -s strict:all

stdout:
-
-
-
stderr:
mksh: <stdin>[8]: shopt: not found
mksh: <stdin>[9]: shopt: not found
mksh: <stdin>[10]: shopt: not found
mksh: <stdin>[11]: shopt: not found
mksh: <stdin>[12]: shopt: not found
dash38 shopt allows for backward compatibility like bash

stdout:
status=0
stderr:
dash: 3: shopt: not found
dash: 8: shopt: not found
mksh38 shopt allows for backward compatibility like bash

stdout:
status=0
stderr:
mksh: <stdin>[3]: shopt: not found
mksh: <stdin>[8]: shopt: not found
bash39 shopt -p validates option names

stdout:
shopt -u nullglob
shopt -u failglob
status=1
nullglob off
failglob off
status=1
stderr:
bash: line 1: shopt: invalid: invalid shell option name
bash: line 3: shopt: invalid: invalid shell option name
dash39 shopt -p validates option names

stdout:
status=127
status=127
stderr:
dash: 1: shopt: not found
dash: 3: shopt: not found
mksh39 shopt -p validates option names

stdout:
status=127
status=127
stderr:
mksh: <stdin>[1]: shopt: not found
mksh: <stdin>[3]: shopt: not found
bash40 shopt -p -o validates option names

stdout:
set +o errexit
set +o nounset
status=1
stderr:
bash: line 1: shopt: invalid: invalid option name
dash40 shopt -p -o validates option names

stdout:
status=127
stderr:
dash: 1: shopt: not found
mksh40 shopt -p -o validates option names

stdout:
status=127
stderr:
mksh: <stdin>[1]: shopt: not found
bash41 stubbed out bash options

stdout:
1
0
0
0
stderr:
bash: line 2: shopt: foo: invalid shell option name
dash41 stubbed out bash options

stdout:
127
127
127
127
stderr:
dash: 2: shopt: not found
dash: 2: shopt: not found
dash: 2: shopt: not found
dash: 2: shopt: not found
mksh41 stubbed out bash options

stdout:
127
127
127
127
stderr:
mksh: <stdin>[4]: shopt: not found
mksh: <stdin>[4]: shopt: not found
mksh: <stdin>[4]: shopt: not found
mksh: <stdin>[4]: shopt: not found
bash42 shopt -s nounset works in Oil, not in bash

stdout:
status=1
nounset off
stderr:
bash: line 7: shopt: nounset: invalid shell option name
dash42 shopt -s nounset works in Oil, not in bash

stdout:
N-I
stderr:
mksh42 shopt -s nounset works in Oil, not in bash

stdout:
N-I
stderr:
bash43 no-ops not in shopt -p output

stdout:
shopt -u xpg_echo
--
stderr: