builtin-trap-err () { run-file builtin-trap-err "$@" } run-file () { local spec_name=$1; shift; sh-spec spec/$spec_name.test.sh --compare-shells --oils-bin-dir $PWD/bin "$@" } builtin-trap-err: spec test case results

Results for builtin-trap-err.test.sh

statusbashmkshashosh
pass 20141718
ok 0001
N-I 1420
BUG 2540
FAIL 0004
total23232323
casebashmkshashoshdescription
0pass pass pass pass trap can use original $LINENO
1pass pass pass pass trap ERR and set -o errexit
2pass pass pass pass trap ERR and errexit disabled context
3pass pass pass pass trap ERR and if statement
4pass pass pass pass trap ERR and || conditional
5pass BUG BUG pass trap ERR and pipeline
detailsdetails
6BUG pass pass pass trap ERR pipelines without simple commands
details
7pass pass pass pass Pipeline group quirk
8pass pass pass pass trap ERR does not run in errexit situations
9pass pass pass pass trap ERR doesn't run in subprograms - subshell, command sub, async
10pass N-I BUG FAIL set -o errtrace: trap ERR runs in subprograms
detailsdetailsdetails
11pass pass pass pass trap ERR doesn't run with &
12pass N-I BUG FAIL set -o errtrace: trap ERR with &
detailsdetailsdetails
13pass N-I pass pass trap ERR not active in shell functions in (bash behavior)
details
14pass BUG pass FAIL set -o errtrace - trap ERR runs in shell functions
detailsdetails
15pass BUG pass FAIL set -o errtrace - trap ERR runs in shell functions (LINENO)
detailsdetails
16pass BUG pass pass trap ERR with "atoms": assignment (( [[
details
17pass pass pass pass trap ERR with for, case, { }
18BUG BUG BUG pass trap ERR with redirect
detailsdetailsdetails
19N-I N-I N-I pass trap ERR with YSH proc
detailsdetailsdetails
20pass pass pass pass trap ERR
21pass pass N-I ok trap ERR and pipelines - PIPESTATUS difference
detailsdetails
22pass pass pass pass error in trap ERR (recursive)
69 passed, 1 OK, 7 not implemented, 11 BUG, 4 failed, 0 timeouts, 0 cases skipped
4 failed under osh

Details on runs that didn't PASS

mksh5 trap ERR and pipeline

stdout:
line=1
line=1
stderr:
ash5 trap ERR and pipeline

stdout:
line=1
line=1
stderr:
bash6 trap ERR pipelines without simple commands

stdout:
assign
dparen
dbracket
subshell
subshell
subshell2
subshell2
group
ok
stderr:
mksh10 set -o errtrace: trap ERR runs in subprograms

stdout:
stderr: 
ash10 set -o errtrace: trap ERR runs in subprograms

stdout:
subshell
line=10
ok
stderr:
osh10 set -o errtrace: trap ERR runs in subprograms

[osh stdout] Expected 'line=6\nsubshell\nline=10\nok\n', got 'subshell\nline=10\nok\n'

stdout:
subshell
line=10
ok
stderr:
  set -o errtrace
  ^~~
[ stdin ]:3: 'set' got invalid option 'errtrace'
mksh12 set -o errtrace: trap ERR with &

stdout:
stderr: 
ash12 set -o errtrace: trap ERR with &

stdout:
async
stderr:
osh12 set -o errtrace: trap ERR with &

[osh stdout] Expected 'line=8\nasync\n', got 'async\n'

stdout:
async
stderr:
  set -o errtrace
  ^~~
[ stdin ]:3: 'set' got invalid option 'errtrace'
[1] Done PID 12248
[1] Done PID 12249
mksh13 trap ERR not active in shell functions in (bash behavior)

stdout:
line=4
stderr:
mksh14 set -o errtrace - trap ERR runs in shell functions

stdout:
err
err
stderr:
mksh: <stdin>[16]: set: errtrace: bad option
osh14 set -o errtrace - trap ERR runs in shell functions

[osh stdout] Expected 'err\nnow with errtrace\nerr\nerr\nerr\nok\n', got 'err\nerr\nnow with errtrace\nerr\nok\n'

stdout:
err
err
now with errtrace
err
ok
stderr:
  set -o errtrace
  ^~~
[ stdin ]:16: 'set' got invalid option 'errtrace'
mksh15 set -o errtrace - trap ERR runs in shell functions (LINENO)

stdout:
line=4
line=10
stderr:
mksh: <stdin>[16]: set: errtrace: bad option
osh15 set -o errtrace - trap ERR runs in shell functions (LINENO)

[osh stdout] Expected 'line=14\nnow with errtrace\nline=4\nline=10\nline=20\nok\n' Got 'line=10\nline=16\nnow with errtrace\nline=10\nok\n'

stdout:
line=10
line=16
now with errtrace
line=10
ok
stderr:
  set -o errtrace
  ^~~
[ stdin ]:16: 'set' got invalid option 'errtrace'
mksh16 trap ERR with "atoms": assignment (( [[

stdout:
line=3
line=3
line=7
ok
stderr:
bash18 trap ERR with redirect

stdout:
line=3
line=3
ok
stderr:
bash: line 7: /zz: Permission denied
mksh18 trap ERR with redirect

stdout:
line=3
line=3
ok
stderr:
mksh: <stdin>[7]: can't create /zz: Permission denied
ash18 trap ERR with redirect

stdout:
line=3
ok
stderr:
ash: can't create /zz: Permission denied
bash19 trap ERR with YSH proc

stdout:
stderr: 
mksh19 trap ERR with YSH proc

stdout:
stderr: 
ash19 trap ERR with YSH proc

stdout:
stderr: 
ash21 trap ERR and pipelines - PIPESTATUS difference

stdout:
stderr: 
osh21 trap ERR and pipelines - PIPESTATUS difference

stdout:
A
err [] status=1 []
B
err [] status=1 [0 1]
err [] status=1 [0 1 0]
ok
stderr: