fix(activate): guard bash chpwd hook under nounset#9716
Conversation
|
Self-review completed after opening the draft PR. I re-read the PR diff and checked the bash expansion behavior on Bash 3.2 for the affected states:
I did not find any changes needed from self-review. Note: This comment was generated by an AI coding assistant. |
Greptile SummaryFixes a bash crash under
Confidence Score: 5/5Safe to merge β the one-line change is a well-known bash idiom that is correct for unset, empty-array, and populated-array cases, and the new e2e test directly covers the reported failure scenario. The change is minimal and targeted: a single substitution in one shell function, backed by an automated e2e test that exercises the exact failure path. The idiom is the canonical nounset-safe pattern for bash arrays and behaves correctly across all three states of chpwd_functions (unset, empty, non-empty). The snapshot update is mechanical. No files require special attention. Important Files Changed
Reviews (1): Last reviewed commit: "fix(activate): guard bash chpwd hook und..." | Re-trigger Greptile |
There was a problem hiding this comment.
Code Review
This pull request fixes a bug where the Bash cd wrapper would fail when the nounset option (set -u) is enabled and the chpwd_functions array is unset. The fix implements a safer array expansion syntax in the shell support scripts and includes a new E2E test to prevent regressions. I have no feedback to provide as there were no review comments to evaluate.
### π Features - **(cli)** add minimum release age flag to lock and ls-remote by @risu729 in [#9269](#9269) - **(config)** add run field for hooks by @risu729 in [#9718](#9718) - **(github)** add native oauth token source by @jdx in [#9654](#9654) - **(oci)** scope build to project config by default by @jdx in [#9766](#9766) - add support for prefixed latest version queries in outdated checks by @roele in [#9767](#9767) ### π Bug Fixes - **(activate)** guard bash chpwd hook under nounset by @risu729 in [#9716](#9716) - **(backend)** date-check latest stable fast path by @risu729 in [#9650](#9650) - **(config)** parse core tool options consistently by @risu729 in [#9742](#9742) - **(exec)** propagate __MISE_DIFF so nested mise recovers pristine PATH by @jdx in [#9765](#9765) - **(forgejo)** include prereleases when opted in by @risu729 in [#9717](#9717) - **(github)** avoid caching empty release assets by @risu729 in [#9616](#9616) - **(java)** resolve lockfile URLs from metadata by @risu729 in [#9719](#9719) - **(lock)** cache unavailable github attestations by @risu729 in [#9741](#9741) - **(pipx)** preserve options when reinstalling tools by @risu729 in [#9663](#9663) - **(python)** skip redundant lockfile provenance verification by @risu729 in [#9739](#9739) - **(vfox)** run pre_uninstall hook by @risu729 in [#9662](#9662) ### π Refactor - **(schema)** extract tool options definition by @risu729 in [#9649](#9649) ### β‘ Performance - **(aqua)** bake rkyv aqua package blobs by @risu729 in [#9535](#9535) ### π¦οΈ Dependency Updates - lock file maintenance by @renovate[bot] in [#9773](#9773) ### π¦ Registry - add vector ([github:vectordotdev/vector](https://github.com/vectordotdev/vector)) by @kquinsland in [#9761](#9761) - add oc and openshift-install (http backend) by @konono in [#9669](#9669) ### New Contributors - @konono made their first contribution in [#9669](#9669) - @kquinsland made their first contribution in [#9761](#9761)
Summary
chpwd_functionsarray expansion with the same nounset-safe pattern used for__MISE_FLAGS.cdwithchpwd_functionsunset underset -u.Test plan
shellcheck src/assets/bash_zsh_support/chpwd/function.sh e2e/env/test_bash_chpwd_functions_nounsetbash --noprofile --norc -euo pipefail e2e/env/test_bash_chpwd_functions_nounsetgit diff --checkdocker run --rm bash:3.2 ...reproduces the oldchpwd_functions[@]: unbound variablefailuredocker run --rm -v "$PWD:/work:ro" -w /work bash:3.2 ...verifies the patched hook succeeds under Bash 3.2 nounsetdocker run --rm bash:3.2 ...verifies array entries with spaces remain separate wordsFixes #9658
Note: This PR description was generated by an AI coding assistant.