Skip to content

fix(interpreter): reset last_exit_code in VFS subprocess isolation#850

Merged
chaliy merged 3 commits intomainfrom
fix/issue-842-set-e-vfs-script
Mar 26, 2026
Merged

fix(interpreter): reset last_exit_code in VFS subprocess isolation#850
chaliy merged 3 commits intomainfrom
fix/issue-842-set-e-vfs-script

Conversation

@chaliy
Copy link
Copy Markdown
Contributor

@chaliy chaliy commented Mar 26, 2026

Summary

  • Reset last_exit_code = 0 and nounset_error = None in execute_script_content subprocess isolation, matching real bash behavior where subprocesses start with $? = 0
  • Previously, VFS scripts inherited the parent shell's last_exit_code, causing set -euo pipefail scripts to see stale non-zero exit codes and fail spuriously
  • Added TM-ISO-024 to threat model documenting the exit code leakage vector

Test plan

  • exec_vfs_script_initial_exit_code_is_zero — verifies $? starts at 0 in subprocess after parent false
  • exec_vfs_script_set_e_after_prior_failureset -euo pipefail script succeeds after parent non-zero exit
  • exec_vfs_script_set_e_nested_scripts — nested VFS scripts with set -e and command substitution
  • All 2800+ existing tests pass, fmt clean, clippy clean

Closes #842

chaliy added 3 commits March 26, 2026 18:10
…ocess isolation

Subprocess isolation in execute_script_content did not reset
last_exit_code or nounset_error, causing the VFS script subprocess
to inherit stale parent state. In real bash, a subprocess starts
with $?=0. This caused set -euo pipefail scripts to see a non-zero
$? from the parent shell, leading to false errexit failures.

Closes #842
Documents the threat vector where parent last_exit_code was visible
inside VFS script subprocesses, causing false set -e failures.
@chaliy chaliy merged commit f92e1af into main Mar 26, 2026
18 of 23 checks passed
@chaliy chaliy deleted the fix/issue-842-set-e-vfs-script branch March 26, 2026 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: set -e triggers false failure in VFS script execution

1 participant