From 5ed06a7956e6e7236659b5dd306980559a2d2d35 Mon Sep 17 00:00:00 2001 From: Alex Hedges Date: Mon, 20 Feb 2023 18:36:59 -0500 Subject: [PATCH] Handle undeclared POSIXLY_CORRECT in Bash completions As of `brew` 4.0.2, sourcing the Bash completions with `set -eu` causes a failure if `POSIXLY_CORRECT` is not declared. The check will now properly handle this situation. I'm not sure if the resulting code is POSIX-compliant, but it prevents a breaking change until a better solution can be found. --- Library/Homebrew/completions/bash.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/completions/bash.erb b/Library/Homebrew/completions/bash.erb index 936bdd3abc..d86e0f4b50 100644 --- a/Library/Homebrew/completions/bash.erb +++ b/Library/Homebrew/completions/bash.erb @@ -15,7 +15,7 @@ # This file is automatically generated by running `brew generate-man-completions`. # See Library/Homebrew/completions/bash.erb for editing instructions. -if [[ -n ${POSIXLY_CORRECT} ]] || shopt -oq posix +if [[ -n ${POSIXLY_CORRECT:-} ]] || shopt -oq posix then echo "Homebrew Bash completions do not work in POSIX mode" 1>&2 return