Skip to content

fix(interpreter): get_ifs_separator respects local IFS#902

Merged
chaliy merged 2 commits intomainfrom
fix/ifs-local-scoping
Mar 30, 2026
Merged

fix(interpreter): get_ifs_separator respects local IFS#902
chaliy merged 2 commits intomainfrom
fix/ifs-local-scoping

Conversation

@chaliy
Copy link
Copy Markdown
Contributor

@chaliy chaliy commented Mar 30, 2026

Summary

  • get_ifs_separator() only checked self.variables for IFS, missing local IFS declarations stored in call_stack.locals. This caused local IFS=":" to have no effect on "${arr[*]}" array joining inside functions.
  • Fix: use expand_variable("IFS") which checks locals first, with proper handling of unset vs empty IFS.
  • Includes regression test.

Test plan

  • cargo test --all-features -p bashkit --lib — all 2123 tests pass
  • cargo clippy --all-targets --all-features -- -D warnings — clean
  • cargo fmt --check — clean
  • Regression test test_local_ifs_array_join covers the exact bug

get_ifs_separator() only checked self.variables for IFS, missing
local IFS declarations stored in call_stack.locals. This caused
local IFS=":" to have no effect on "${arr[*]}" array joining.

Fix: use expand_variable("IFS") which checks locals first.
@chaliy chaliy force-pushed the fix/ifs-local-scoping branch from 1638f9a to 045f988 Compare March 30, 2026 23:06
@chaliy chaliy merged commit 17abfba into main Mar 30, 2026
27 checks passed
@chaliy chaliy deleted the fix/ifs-local-scoping branch March 30, 2026 23:30
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.

1 participant