Skip to content

Conversation

seefood
Copy link
Contributor

@seefood seefood commented Oct 13, 2025

Summary

Adds an early version check to the pack plugin to prevent it from loading on bash versions older than 3.3.

Changes

  • Added bash version check at the beginning of pack.plugin.bash
  • Calls _disable-plugin pack before returning if bash < 3.3
  • Prevents errors from associative array usage on incompatible bash versions

Test plan

  • ✅ Pre-commit hooks pass
  • ✅ Shellcheck passes
  • ✅ Code follows existing patterns in the codebase

Context

The pack plugin uses associative arrays (declare -A on lines 574-575) which require bash 4.0+, but had inline version checks on lines 162 and 230 checking for bash > 3. This early check prevents the plugin from loading at all on incompatible versions, providing a cleaner user experience.

Related to bash version compatibility improvements across the codebase.

🤖 Generated with Claude Code

The pack plugin uses associative arrays (declare -A) which require
bash 4.0+, but has existing checks for bash > 3 on lines 162 and 230.
Add early version check to disable and return if bash < 3.3.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@seefood seefood mentioned this pull request Oct 13, 2025
8 tasks
Ira Abramov and others added 2 commits October 13, 2025 10:39
Both plugins already had bash version checks with early returns, but
didn't explicitly disable themselves. Now they call _disable-plugin
before returning to ensure consistent plugin state.

- history-eternal: requires bash 4.3+ for unlimited history
- percol: requires bash 4.0+ for bind -x functionality

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Changed both plugins to return 0 instead of 1/nothing and added
consistent log messages explaining why the plugin is being disabled:

- history-eternal: return 0 with "Disabling history-eternal plugin" message
- percol: return 0 with "Disabling percol plugin" message

This provides clearer feedback to users and consistent exit codes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Copy link
Contributor

@akinomyoga akinomyoga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM for the changes in history-eternal and percol. See #2354 (comment) for the changes in pack.

@akinomyoga
Copy link
Contributor

I think we should also add a global check for the requirement "Bash >= 3.2" in bash_it.sh.

@seefood
Copy link
Contributor Author

seefood commented Oct 14, 2025

won't that be like making sure you are using a kernel above version 2.3 a this point?

😄 nm, added.

Copy link
Contributor

@akinomyoga akinomyoga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding checks in bash_it.sh and install.sh.

won't that be like making sure you are using a kernel above version 2.3 a this point?

Well-maintained environments shouldn't have older versions of Bash, but there are some old systems not well-maintained in academia, where the budget may not be sufficient, and where security isn't cared about too much.

It's also good to avoid loading Bash-it in other shells. It happens e.g. when a naive user puts /etc/profile.d/bash_it_loader.sh for Bash (where it should be noted that /etc/profile.d/*.sh are actually loaded by all Bourne-like shells).

seefood and others added 2 commits October 14, 2025 14:54
@seefood seefood requested a review from akinomyoga October 14, 2025 11:58
if [[ -n "${BASH_VERSINFO[0]}" ]] && [[ "${BASH_VERSINFO[0]}" -eq 3 ]] && [[ "${BASH_VERSINFO[1]}" -lt 3 ]]; then
_disable-plugin pack
return 0
fi
Copy link
Contributor

@akinomyoga akinomyoga Oct 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #2354 (comment) for the changes in pack.

This hasn't been settled.

I now think this version check in pack.plugin.bash is unnecessary. Even if this change would be applied, Bash 3.3 doesn't exist because the next version of 3.2 is 4.0. Thus, the last check [[ "${BASH_VERSINFO[1]}" -lt 3 ]] is meaningless. Also, the comments I raised for the checks in bash_it.sh and install.sh apply here too.

Copy link
Contributor

@akinomyoga akinomyoga Oct 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bash 3.3 doesn't exist because the next version of 3.2 is 4.0.

Actually, for the same reason, the PR title should be changed to "bash 4.0+".

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.

2 participants