Skip to content

fix(export): sync successful exports when readonly args fail#1604

Merged
chaliy merged 1 commit intomainfrom
2026-05-08-propose-fix-for-readonly-export-error
May 8, 2026
Merged

fix(export): sync successful exports when readonly args fail#1604
chaliy merged 1 commit intomainfrom
2026-05-08-propose-fix-for-readonly-export-error

Conversation

@chaliy
Copy link
Copy Markdown
Contributor

@chaliy chaliy commented May 8, 2026

Motivation

  • Recent readonly-error handling caused export to return nonzero for an operand and the interpreter to skip syncing all exported operands into self.env, so otherwise-valid NAME=VALUE operands in the same command were not visible to printenv/export -p despite being set in shell variables.

Description

  • Update interpreter post-processing in crates/bashkit/src/interpreter/mod.rs to always perform export env sync for export and to skip only operands that are readonly by checking the _READONLY_<NAME> marker instead of gating on result.exit_code == 0.
  • Add a targeted regression test export_continues_after_readonly_error_and_exports_good_args in crates/bashkit/tests/blackbox_security_tests.rs that asserts export LOCKED=skip GOOD=ok exits 1 and that GOOD is visible via printenv.
  • Preserve the readonly error reporting in the export builtin implementation; this change only adjusts the interpreter-side env synchronization so Bash-compatible semantics are maintained.

Testing

  • Ran cargo test -p bashkit --test blackbox_security_tests finding_readonly_bypass::export_continues_after_readonly_error_and_exports_good_args and the test passed (ok).
  • The regression test verifies both the nonzero exit on readonly failure and that successful operands are exported to self.env and visible to printenv.

Codex Task

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 8, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
bashkit b07d3e8 Commit Preview URL May 08 2026, 09:12 AM

@chaliy chaliy force-pushed the 2026-05-08-propose-fix-for-readonly-export-error branch from 82532df to b07d3e8 Compare May 8, 2026 09:09
@chaliy chaliy merged commit f056342 into main May 8, 2026
34 checks passed
@chaliy chaliy deleted the 2026-05-08-propose-fix-for-readonly-export-error branch May 8, 2026 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant