From: Felipe Contreras Date: Thu, 5 Aug 2021 19:48:25 +0000 (-0500) Subject: test: fix for COLUMNS and bash 5 X-Git-Tag: v2.33.0-rc1~3^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=390b44eb2bca5195d524629bccc98d8bbee74410;p=thirdparty%2Fgit.git test: fix for COLUMNS and bash 5 Since c49a177bec (test-lib.sh: set COLUMNS=80 for --verbose repeatability, 2021-06-29) multiple tests have been failing when using bash 5 because checkwinsize is enabled by default, therefore COLUMNS is reset using TIOCGWINSZ even for non-interactive shells. It's debatable whether or not bash should even be doing that, but for now we can avoid this undesirable behavior by disabling this option. Reported-by: Fabian Stelzer Signed-off-by: Felipe Contreras [jc: with SZEDER Gábor's suggestion to do this before setting COLUMNS] Signed-off-by: Junio C Hamano --- diff --git a/t/test-lib.sh b/t/test-lib.sh index 4d4439a917..52701afaea 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -395,6 +395,12 @@ then verbose=t fi +# Since bash 5.0, checkwinsize is enabled by default which does +# update the COLUMNS variable every time a non-builtin command +# completes, even for non-interactive shells. +# Disable that since we are aiming for repeatability. +test -n "$BASH_VERSION" && shopt -u checkwinsize 2>/dev/null + # For repeatability, reset the environment to known value. # TERM is sanitized below, after saving color control sequences. LANG=C