git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] test: fix for COLUMNS and bash 5
@ 2021-08-05 19:48 Felipe Contreras
  2021-08-05 23:35 ` Ævar Arnfjörð Bjarmason
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Felipe Contreras @ 2021-08-05 19:48 UTC (permalink / raw)
  To: git; +Cc: ZheNing Hu, Felipe Contreras, Fabian Stelzer

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 <fabian.stelzer@campoint.net>
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 t/test-lib.sh | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/t/test-lib.sh b/t/test-lib.sh
index db61081d6b..a2b7dfecee 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -419,6 +419,12 @@ COLUMNS=80
 export LANG LC_ALL PAGER TZ COLUMNS
 EDITOR=:
 
+# Since bash 5.0, checkwinsize is enabled by default which does update the
+# COLUMNS variable every time a command completes, even for non-interactive
+# shells.
+# Disable that since we are aiming for reproducibility.
+test -n "$BASH_VERSION" && shopt -u checkwinsize 2>/dev/null
+
 # A call to "unset" with no arguments causes at least Solaris 10
 # /usr/xpg4/bin/sh and /bin/ksh to bail out.  So keep the unsets
 # deriving from the command substitution clustered with the other
-- 
2.32.0.40.gb9b36f9b52


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-08-23 20:24 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-05 19:48 [PATCH] test: fix for COLUMNS and bash 5 Felipe Contreras
2021-08-05 23:35 ` Ævar Arnfjörð Bjarmason
2021-08-06 16:15   ` Felipe Contreras
2021-08-06 14:49 ` SZEDER Gábor
2021-08-06 16:59   ` Junio C Hamano
2021-08-23 12:59     ` Ævar Arnfjörð Bjarmason
2021-08-23 20:24       ` Junio C Hamano
2021-08-06 16:44 ` [PATCH v2] " Felipe Contreras
2021-08-07  1:37   ` ZheNing Hu

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).