oils-for-unix / oils

Oils is our upgrade path from bash to a better language and runtime. It's also for Python and JavaScript users who avoid shell!
http://www.oilshell.org/
Other
2.81k stars 154 forks source link

output of trap -l #680

Open andychu opened 4 years ago

andychu commented 4 years ago

After fixing the location. I think the EXIT and RETURN need to be turned into associative arrays, not indexed arrays?

Thank you for the report! But EXIT and RETURN must not appear here in original ble.sh. It seems there are some problems in upstream of the code, which causes the wrong values of $index.

Ah, this is caused by the format difference of trap -l between Bash and Oil. Looking at Oil trap -l outputs, ble.sh considers EXIT to be the value of ERR and RETURN to be the value of DEBUG.

bash$ builtin trap -l
 1) SIGHUP       2) SIGINT       3) SIGQUIT      4) SIGILL       5) SIGTRAP
 6) SIGABRT      7) SIGBUS       8) SIGFPE       9) SIGKILL     10) SIGUSR1
11) SIGSEGV     12) SIGUSR2     13) SIGPIPE     14) SIGALRM     15) SIGTERM
(snip)

osh$ builtin trap -l
   EXIT
   ERR
   RETURN
   DEBUG
 1 HUP
 2 INT
 3 QUIT
(snip)

Originally posted by @akinomyoga in https://github.com/oilshell/oil/issues/664#issuecomment-602005629

andychu commented 4 years ago

@akinomyoga Thanks for tracking this down!

I would like to make sure the output of everything is parseable. I don't like bash's inconsistency though, for example set -o gives one format and shopt -o -p gives another format. I feel the trap format is similarly inconsistent.

So let's leave this issue until the rest of the issues on #653 are addressed, unless you think it's blocking something now