Skip to content

fix(unset): preserve same-named functions - #648

Merged
caomengxuan666 merged 1 commit into
masterfrom
fix/645-unset-function
Oct 16, 2026
Merged

caomengxuan666 merged 1 commit into
masterfrom
fix/645-unset-function

Conversation

@caomengxuan666

@caomengxuan666 caomengxuan666 commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Keep a same-named function when ordinary unset removes an existing variable.
  • Retain GNU-compatible fallback removal when no variable exists.
  • Add regressions for rubash#645.

The implementation follows GNU Bash 5.3 set.def:827 unset_builtin, including the variable-first path and function fallback at set.def:1024.

Validation

  • cargo test --test issue645_unset_function_regressions --locked -- --nocapture (2 passed)
  • cargo test --lib builtins::set --locked (11 passed)
  • cargo fmt --all -- --check
  • git diff --check

Closes #645

GNU Bash 5.3 set.def:827 unset_builtin resolves variables before the function fallback at set.def:1024. Keep ordinary unset from deleting a function when the variable exists, while retaining the fallback when no variable is found. Regression: rubash#645.
@caomengxuan666
caomengxuan666 merged commit 69ff0c6 into master Oct 16, 2026
8 checks passed
@caomengxuan666
caomengxuan666 deleted the fix/645-unset-function branch October 16, 2026 03:47
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.

unset: a function sharing the variable's name is removed along with the variable

1 participant