Skip to content

Commit 390b44e

Browse files
felipecgitster
authored andcommitted
test: fix for COLUMNS and bash 5
Since c49a177 (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 <[email protected]> Signed-off-by: Felipe Contreras <[email protected]> [jc: with SZEDER Gábor's suggestion to do this before setting COLUMNS] Signed-off-by: Junio C Hamano <[email protected]>
1 parent c49a177 commit 390b44e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

t/test-lib.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,12 @@ then
395395
verbose=t
396396
fi
397397

398+
# Since bash 5.0, checkwinsize is enabled by default which does
399+
# update the COLUMNS variable every time a non-builtin command
400+
# completes, even for non-interactive shells.
401+
# Disable that since we are aiming for repeatability.
402+
test -n "$BASH_VERSION" && shopt -u checkwinsize 2>/dev/null
403+
398404
# For repeatability, reset the environment to known value.
399405
# TERM is sanitized below, after saving color control sequences.
400406
LANG=C

0 commit comments

Comments
 (0)