From 3a3952aca82c5a3119954b0a4cd64e6e02115b8a Mon Sep 17 00:00:00 2001 From: Danny Ben Shitrit Date: Wed, 6 Aug 2025 09:16:34 +0000 Subject: [PATCH 1/3] - Update bash version bouncer to require bash 4.2 --- lib/bashly/libraries/strings/strings.yml | 2 +- lib/bashly/views/wrapper/bash3_bouncer.gtx | 7 +++++-- spec/approvals/bash/error | 2 +- spec/approvals/script/wrapper/code | 4 ++-- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/bashly/libraries/strings/strings.yml b/lib/bashly/libraries/strings/strings.yml index 13834bed..6a56be79 100644 --- a/lib/bashly/libraries/strings/strings.yml +++ b/lib/bashly/libraries/strings/strings.yml @@ -40,6 +40,6 @@ examples_caption_on_error: 'examples:' disallowed_flag: "%{name} must be one of: %{allowed}" disallowed_argument: "%{name} must be one of: %{allowed}" disallowed_environment_variable: "%{name} environment variable must be one of: %{allowed}" -unsupported_bash_version: "bash version 4 or higher is required" +unsupported_bash_version: "bash version 4.2 or higher is required" validation_error: "validation error in %s:\\n%s" environment_variable_validation_error: "validation error in environment variable %s:\\n%s" diff --git a/lib/bashly/views/wrapper/bash3_bouncer.gtx b/lib/bashly/views/wrapper/bash3_bouncer.gtx index 7ef77919..22a9e9f6 100644 --- a/lib/bashly/views/wrapper/bash3_bouncer.gtx +++ b/lib/bashly/views/wrapper/bash3_bouncer.gtx @@ -1,7 +1,10 @@ = view_marker -> if [[ "${BASH_VERSINFO:-0}" -lt 4 ]]; then +> if (( BASH_VERSINFO[0] < 4 || (BASH_VERSINFO[0] == 4 && BASH_VERSINFO[1] < 2) )); then > printf "{{ strings[:unsupported_bash_version] }}\n" >&2 > exit 1 > fi -> \ No newline at end of file +> + + + diff --git a/spec/approvals/bash/error b/spec/approvals/bash/error index 16067072..dced700d 100644 --- a/spec/approvals/bash/error +++ b/spec/approvals/bash/error @@ -1 +1 @@ -bash version 4 or higher is required +bash version 4.2 or higher is required diff --git a/spec/approvals/script/wrapper/code b/spec/approvals/script/wrapper/code index 1655d418..aa189fcf 100644 --- a/spec/approvals/script/wrapper/code +++ b/spec/approvals/script/wrapper/code @@ -3,8 +3,8 @@ # Modifying it manually is not recommended # :wrapper.bash3_bouncer -if [[ "${BASH_VERSINFO:-0}" -lt 4 ]]; then - printf "bash version 4 or higher is required\n" >&2 +if (( BASH_VERSINFO[0] < 4 || (BASH_VERSINFO[0] == 4 && BASH_VERSINFO[1] < 2) )); then + printf "bash version 4.2 or higher is required\n" >&2 exit 1 fi From d4bef31059a26095a4c7291e9cfe8603231b9188 Mon Sep 17 00:00:00 2001 From: Danny Ben Shitrit Date: Wed, 6 Aug 2025 09:21:26 +0000 Subject: [PATCH 2/3] fix shfmt --- lib/bashly/views/wrapper/bash3_bouncer.gtx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bashly/views/wrapper/bash3_bouncer.gtx b/lib/bashly/views/wrapper/bash3_bouncer.gtx index 22a9e9f6..0da4c93e 100644 --- a/lib/bashly/views/wrapper/bash3_bouncer.gtx +++ b/lib/bashly/views/wrapper/bash3_bouncer.gtx @@ -1,6 +1,6 @@ = view_marker -> if (( BASH_VERSINFO[0] < 4 || (BASH_VERSINFO[0] == 4 && BASH_VERSINFO[1] < 2) )); then +> if ((BASH_VERSINFO[0] < 4 || (BASH_VERSINFO[0] == 4 && BASH_VERSINFO[1] < 2))); then > printf "{{ strings[:unsupported_bash_version] }}\n" >&2 > exit 1 > fi From ccd7b921e7f4a5c6fbb36e42e823f482e472ec52 Mon Sep 17 00:00:00 2001 From: Danny Ben Shitrit Date: Wed, 6 Aug 2025 09:22:41 +0000 Subject: [PATCH 3/3] approvals --- spec/approvals/script/wrapper/code | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/approvals/script/wrapper/code b/spec/approvals/script/wrapper/code index aa189fcf..e1cd1df7 100644 --- a/spec/approvals/script/wrapper/code +++ b/spec/approvals/script/wrapper/code @@ -3,7 +3,7 @@ # Modifying it manually is not recommended # :wrapper.bash3_bouncer -if (( BASH_VERSINFO[0] < 4 || (BASH_VERSINFO[0] == 4 && BASH_VERSINFO[1] < 2) )); then +if ((BASH_VERSINFO[0] < 4 || (BASH_VERSINFO[0] == 4 && BASH_VERSINFO[1] < 2))); then printf "bash version 4.2 or higher is required\n" >&2 exit 1 fi