Skip to content

Conversation

@Chemaclass
Copy link
Member

πŸ“š Description

Closes: #468 by @akinomyoga

Right now, the min supported version is bash 3.2

πŸ”– Changes

  • Allow bash 3.0 and above

βœ… To-do list

  • I updated the CHANGELOG.md to reflect the new feature or fix
  • I updated the documentation to reflect the changes

@Chemaclass Chemaclass self-assigned this Sep 27, 2025
@Chemaclass Chemaclass added the enhancement New feature or request label Sep 27, 2025
@Chemaclass Chemaclass mentioned this pull request Sep 27, 2025
2 tasks
src/runner.sh Outdated
if [[ -n "$provider_output" ]]; then
local line
while IFS=" " read -r line; do
provider_data+=("$line")

Choose a reason for hiding this comment

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

Variable assignments of the form var+=rhs and arr+=(...) don't exist in Bash 3.0. It was introduced in Bash 3.1.

Choose a reason for hiding this comment

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

lines 50 and 244: local name=(...) creates a scalar variable local name="(...)" in Bash 3.0. It doesn't create an array.

lines 53, 124, 306, and 326: Loop variables i, fn, and line are leaked.

Comment on lines -549 to +551
additional_new_lines=$(grep -o '\\n' <<< "$input_str" | wc -l | tr -d '[:blank:]')
additional_new_lines=$(echo "$input_str" | grep -o '\\n' | wc -l | tr -d '[:blank:]')

Choose a reason for hiding this comment

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

What does this change try to fix? <<< "$input_str" works in Bash 3.0.

src/runner.sh Outdated
Comment on lines 256 to 259
set -- "$annotation_result"
revs="$1"
its="$2"
max_ms="$3"

Choose a reason for hiding this comment

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

This doesn't work. The "$annotation_result" will not be split.

In the first place, what is the background of rewriting read -r vars... <<< str?

Comment on lines +54 to +59
local eval_pattern='^eval'
local alias_pattern='^alias'

if [[ "$cmd" =~ ^eval ]]; then
if [[ "$cmd" =~ $eval_pattern ]]; then
eval "${cmd#eval }" &> /dev/null
elif [[ "$(command -v "$cmd")" =~ ^alias ]]; then
elif [[ "$(command -v "$cmd")" =~ $alias_pattern ]]; then

Choose a reason for hiding this comment

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

There are many cases of rewriting the regex matching this way, but this can simply be solved by defining a utility function like function regex_match() { [[ $1 =~ $2 ]]; }. Then, you can write the regular expressions inline as regex_match "$cmd" '^eval' or regex_match "$(command -v "$cmd")" '^alias'. This works in all cases of bash <= 3.1, bash >= 3.2, and bash >= 3.2 with shopt -s compat31.

@Chemaclass Chemaclass force-pushed the feat/468-bash-support-3.0 branch from 390bff0 to 96ec56f Compare October 25, 2025 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for Bash 3.0

3 participants