From 799d0c8a7da358ac05323922c87d149376549672 Mon Sep 17 00:00:00 2001 From: Ivan Trubach Date: Mon, 9 Sep 2024 14:28:43 +0300 Subject: [PATCH] stdenv: bump required Bash version from 4 to 5 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently stdenv requires Bash 4.x that was released in 2009. This change bumps the required version to Bash 5.x (2019, 5 years ago). See https://mywiki.wooledge.org/BashFAQ/061 for more details. Using a relatively modern Bash version allows us to rely on newer features (e.g. ${var@a}) and remove workarounds for older quirks (e.g. https://stackoverflow.com/a/7577209, “old bash empty array problem”). Note that many setup hooks are using features added after 4.0 version, e.g. makeWrapper uses ${var@Q} from 4.4, but some even require >5.0, e.g. cargoBuildHook uses ${var@U} from 5.1. --- pkgs/stdenv/generic/setup.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index 1b4f7a89d358..d1a039311631 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -4,9 +4,9 @@ __nixpkgs_setup_set_original=$- set -eu set -o pipefail -if [[ -n "${BASH_VERSINFO-}" && "${BASH_VERSINFO-}" -lt 4 ]]; then +if [[ -n "${BASH_VERSINFO-}" && "${BASH_VERSINFO-}" -lt 5 ]]; then echo "Detected Bash version that isn't supported by Nixpkgs (${BASH_VERSION})" - echo "Please install Bash 4 or greater to continue." + echo "Please install Bash 5 or greater to continue." exit 1 fi