Commit 838b87b
authored
fix(interpreter): preserve shopt options across exec() calls (#1131)
## Summary
- `reset_transient_state()` was wiping ALL `SHOPT_*` variables between
`exec()` calls, including `shopt` options like `expand_aliases`. This
made alias expansion impossible when `shopt` and `alias` commands were
in separate `exec()` calls (the JS/Python API pattern).
- Now only `set` options (`SHOPT_e`, `SHOPT_x`, etc.) are reset between
`exec()` calls for safety (TM-ISO-023), while `shopt` options
(`expand_aliases`, `extglob`, `dotglob`, etc.) persist as session
configuration.
## Test plan
- [x] New test `alias_expansion_persists_across_exec_calls` verifies
aliases work across separate `exec()` calls
- [x] Existing `set_e_does_not_leak_between_exec` confirms `set -e` is
still properly reset
- [x] Existing `threat_isolation_alias_isolation` confirms cross-session
alias isolation
- [x] Snapshot roundtrip tests updated and passing
- [x] All 167 threat model + security + snapshot tests pass
Closes #11301 parent e03199f commit 838b87b
4 files changed
Lines changed: 45 additions & 7 deletions
File tree
- crates/bashkit
- src/interpreter
- tests
- specs
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
877 | 877 | | |
878 | 878 | | |
879 | 879 | | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
880 | 896 | | |
881 | 897 | | |
882 | | - | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
883 | 901 | | |
884 | 902 | | |
885 | 903 | | |
886 | | - | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
887 | 907 | | |
888 | 908 | | |
889 | 909 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
240 | 240 | | |
241 | 241 | | |
242 | 242 | | |
243 | | - | |
244 | | - | |
245 | | - | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
246 | 246 | | |
247 | 247 | | |
248 | 248 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
590 | 590 | | |
591 | 591 | | |
592 | 592 | | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
593 | 611 | | |
594 | 612 | | |
595 | 613 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
804 | 804 | | |
805 | 805 | | |
806 | 806 | | |
807 | | - | |
| 807 | + | |
808 | 808 | | |
809 | 809 | | |
810 | 810 | | |
| |||
1224 | 1224 | | |
1225 | 1225 | | |
1226 | 1226 | | |
1227 | | - | |
| 1227 | + | |
1228 | 1228 | | |
1229 | 1229 | | |
1230 | 1230 | | |
| |||
0 commit comments