Results for sh-options.test.sh

casedashbashmkshoshosh_ALTdescription
0pass ok ok pass pass $- with -c
detailsdetails
1N-I ok ok pass pass $- with pipefail
detailsdetailsdetails
2pass pass pass pass pass $- with interactive shell
3pass pass pass pass pass pass short options on command line
4pass pass pass pass pass pass long options on command line
5BUG pass BUG pass pass can continue after unknown option
detailsdetails
6pass pass pass pass pass set with both options and argv
7pass pass pass pass pass set -o vi/emacs
8ok pass pass pass pass nounset
details
9ok pass pass pass pass -u is nounset
details
10pass pass pass pass pass nounset with "$@"
11pass pass pass pass pass set -u -- clears argv
12pass pass pass pass pass set -u -- x y z
13pass pass pass pass pass reset option with long flag
14pass pass pass pass pass reset option with short flag
15ok pass pass pass pass set -eu (flag parsing)
details
16pass pass pass FAIL FAIL -n for no execution (useful with --ast-output)
detailsdetails
17N-I pass pass pass pass pipefail
details
18N-I pass N-I pass pass shopt -p -o prints 'set' options
detailsdetails
19N-I pass N-I pass pass shopt -p prints 'shopt' options
detailsdetails
20N-I pass N-I pass pass shopt with no flags prints options
detailsdetails
21pass pass pass pass pass noclobber off
22ok pass pass FAIL FAIL noclobber on
detailsdetailsdetails
23N-I pass N-I pass pass SHELLOPTS is updated when options are changed
detailsdetails
24N-I pass N-I ok ok SHELLOPTS is readonly
detailsdetailsdetailsdetails
25pass pass pass pass pass set -o lists options
26pass ok ok pass pass set without args lists variables
detailsdetails
27pass pass pass pass pass 'set' and 'eval' round trip
28N-I pass ok N-I N-I set without args and array variables (not in OSH)
detailsdetailsdetailsdetails
29N-I pass N-I N-I N-I set without args and assoc array variables (not in OSH)
detailsdetailsdetailsdetails
30N-I pass N-I pass pass shopt -q
detailsdetails
31N-I ok N-I pass pass shopt -q invalid
detailsdetailsdetails
32N-I N-I N-I pass pass shopt -s all:strict
detailsdetailsdetails
33N-I pass N-I pass pass shopt allows for backward compatibility like bash
detailsdetails

122 passed, 14 ok, 28 known unimplemented, 2 known bugs, 2 failed, 0 skipped

Details on runs that didn't PASS

bash0 $- with -c

stdout:
huBc
stderr:
mksh0 $- with -c

stdout:
uhc
stderr:
dash1 $- with pipefail

stdout:
stderr: 
_tmp/spec-bin/dash: 1: set: Illegal option -o pipefail
bash1 $- with pipefail

stdout:
huBs
stderr:
mksh1 $- with pipefail

stdout:
ush
stderr:
dash5 can continue after unknown option

stdout:
stderr: 
_tmp/spec-bin/dash: 2: set: Illegal option -o STRICT
mksh5 can continue after unknown option

stdout:
stderr: 
_tmp/spec-bin/mksh: <stdin>[2]: set: STRICT: bad option
dash8 nounset

stdout:
[]
stderr:
_tmp/spec-bin/dash: 3: unset: parameter not set
dash9 -u is nounset

stdout:
[]
stderr:
_tmp/spec-bin/dash: 3: unset: parameter not set
dash15 set -eu (flag parsing)

stdout:
stderr: 
_tmp/spec-bin/dash: 2: unset: parameter not set
osh16 -n for no execution (useful with --ast-output)

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

stdout:
1
2
3
stderr:
osh_ALT16 -n for no execution (useful with --ast-output)

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

stdout:
1
2
3
stderr:
dash17 pipefail

stdout:
0
stderr:
_tmp/spec-bin/dash: 3: set: Illegal option -o pipefail
dash18 shopt -p -o prints 'set' options

stdout:
stderr: 
_tmp/spec-bin/dash: 1: shopt: not found
_tmp/spec-bin/dash: 3: shopt: not found
mksh18 shopt -p -o prints 'set' options

stdout:
stderr: 
_tmp/spec-bin/mksh: <stdin>[1]: shopt: not found
_tmp/spec-bin/mksh: <stdin>[3]: shopt: not found
dash19 shopt -p prints 'shopt' options

stdout:
stderr: 
_tmp/spec-bin/dash: 1: shopt: not found
_tmp/spec-bin/dash: 2: shopt: not found
_tmp/spec-bin/dash: 3: shopt: not found
mksh19 shopt -p prints 'shopt' options

stdout:
stderr: 
_tmp/spec-bin/mksh: <stdin>[1]: shopt: not found
_tmp/spec-bin/mksh: <stdin>[2]: shopt: not found
_tmp/spec-bin/mksh: <stdin>[3]: shopt: not found
dash20 shopt with no flags prints options

stdout:
0 one.txt
0
stderr:
_tmp/spec-bin/dash: 2: shopt: not found
_tmp/spec-bin/dash: 6: shopt: not found
mksh20 shopt with no flags prints options

stdout:
0 one.txt
0
stderr:
_tmp/spec-bin/mksh: <stdin>[2]: shopt: not found
_tmp/spec-bin/mksh: <stdin>[6]: shopt: not found
dash22 noclobber on

stdout:
0
2
stderr:
_tmp/spec-bin/dash: 5: cannot create /home/andy/git/oilshell/oil/_tmp/spec-tmp/sh-options.test.sh/no-clobber: File exists
osh22 noclobber on

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

stdout:
0
0
stderr:
osh_ALT22 noclobber on

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

stdout:
0
0
stderr:
dash23 SHELLOPTS is updated when options are changed

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

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

stdout:
status=0
stderr:
mksh24 SHELLOPTS is readonly

stdout:
status=0
stderr:
osh24 SHELLOPTS is readonly

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

stdout:
stderr: 
  SHELLOPTS=x
  ^~~~~~~~~~
[ stdin ]:1: fatal: Can't assign to readonly value 'SHELLOPTS'
bash26 set without args lists variables

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

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

stdout:
stderr: 
_tmp/spec-bin/dash: 1: declare: not found
_tmp/spec-bin/dash: 2: Syntax error: "(" unexpected
mksh28 set without args and array variables (not in OSH)

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

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

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

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

stdout:
stderr: 
_tmp/spec-bin/mksh: <stdin>[1]: typeset: -A: unknown option
_tmp/spec-bin/mksh: <stdin>[2]: 'k e y': multi-character character constant
osh29 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.
osh_ALT29 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.
dash30 shopt -q

stdout:
nullglob=127
nullglob=127
nullglob,failglob=127
nullglob,failglob=127
stderr:
_tmp/spec-bin/dash: 1: shopt: not found
_tmp/spec-bin/dash: 3: shopt: not found
_tmp/spec-bin/dash: 4: shopt: not found
_tmp/spec-bin/dash: 6: shopt: not found
_tmp/spec-bin/dash: 8: shopt: not found
_tmp/spec-bin/dash: 9: shopt: not found
mksh30 shopt -q

stdout:
nullglob=127
nullglob=127
nullglob,failglob=127
nullglob,failglob=127
stderr:
_tmp/spec-bin/mksh: <stdin>[1]: shopt: not found
_tmp/spec-bin/mksh: <stdin>[3]: shopt: not found
_tmp/spec-bin/mksh: <stdin>[4]: shopt: not found
_tmp/spec-bin/mksh: <stdin>[6]: shopt: not found
_tmp/spec-bin/mksh: <stdin>[8]: shopt: not found
_tmp/spec-bin/mksh: <stdin>[9]: shopt: not found
dash31 shopt -q invalid

stdout:
invalidZZ=127
stderr:
_tmp/spec-bin/dash: 1: shopt: not found
bash31 shopt -q invalid

stdout:
invalidZZ=1
stderr:
_tmp/spec-bin/bash: line 1: shopt: invalidZZ: invalid shell option name
mksh31 shopt -q invalid

stdout:
invalidZZ=127
stderr:
_tmp/spec-bin/mksh: <stdin>[1]: shopt: not found
dash32 shopt -s all:strict

stdout:
stderr: 
_tmp/spec-bin/dash: 2: Syntax error: Bad function name
bash32 shopt -s all:strict

stdout:
-
-
-
stderr:
_tmp/spec-bin/bash: line 7: shopt: all:strict: invalid shell option name
_tmp/spec-bin/bash: line 9: shopt: all:strict: invalid shell option name
mksh32 shopt -s all:strict

stdout:
-
-
-
stderr:
_tmp/spec-bin/mksh: <stdin>[6]: shopt: not found
_tmp/spec-bin/mksh: <stdin>[7]: shopt: not found
_tmp/spec-bin/mksh: <stdin>[8]: shopt: not found
_tmp/spec-bin/mksh: <stdin>[9]: shopt: not found
_tmp/spec-bin/mksh: <stdin>[10]: shopt: not found
dash33 shopt allows for backward compatibility like bash

stdout:
status=0
stderr:
_tmp/spec-bin/dash: 2: shopt: not found
_tmp/spec-bin/dash: 5: shopt: not found
mksh33 shopt allows for backward compatibility like bash

stdout:
status=0
stderr:
_tmp/spec-bin/mksh: <stdin>[2]: shopt: not found
_tmp/spec-bin/mksh: <stdin>[5]: shopt: not found