All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: git@vger.kernel.org, "Junio C Hamano" <gitster@pobox.com>,
	"Alex Henrie" <alexhenrie24@gmail.com>,
	"Felipe Contreras" <felipe.contreras@gmail.com>,
	"Fabian Stelzer" <fabian.stelzer@campoint.net>,
	"Zbigniew Jędrzejewski-Szmek" <zbyszek@in.waw.pl>
Subject: Re: [PATCH] test-lib.sh: use GIT_TEST_COLUMNS over COLUMNS
Date: Tue, 27 Jul 2021 13:38:14 -0400	[thread overview]
Message-ID: <YQBEhj/Y6m0pqOth@coredump.intra.peff.net> (raw)
In-Reply-To: <patch-1.1-f81f3911d5-20210726T235452Z-avarab@gmail.com>

On Tue, Jul 27, 2021 at 01:57:09AM +0200, Ævar Arnfjörð Bjarmason wrote:

> In my c49a177beca (test-lib.sh: set COLUMNS=80 for --verbose
> repeatability, 2021-06-29) the test suite started breaking on recent
> versions of bash.
> 
> This is because it sets "shopt -s checkwinsize" starting with version
> 5.0, furthermore it started setting COLUMNS under "shopt -s
> checkwinsize" for non-interactive use around version 4.3.
> 
> A narrow fix for that issue would be to add this just above our
> setting of COLUMNS in test-lib.sh:
> 
> 	shopt -u checkwinsize >/dev/null 2>&1
> 
> But we'd then be at the mercy of the next shell or terminal that wants
> to be clever about COLUMNS.
> 
> Let's instead solve this more thoroughly. We'll now take
> GIT_TEST_COLUMNS over COLUMNS, and furthermore intentionally spoil the
> COLUMNS variable to break any tests that rely on it being set to a
> sane value.
> 
> If something breaks because we have a codepath that's not
> term_columns() checking COLUMNS we'd like to know about it, the narrow
> "shopt -u checkwinsize" fix won't give us that.

I guess people running with bash won't see the test breakage (because
bash will quietly "fix" the COLUMNS setting). But enough people run with
/bin/sh that we'll eventually notice.

> This approach does mean that any tests of ours that expected to test
> term_columns() behavior by setting COLUMNS will need to explicitly
> unset GIT_TEST_COLUMNS, or set it to the empty string. I'm doing the
> latter in all the tests changed here.

This is rather ugly, and I'm not in general a fan of adding more
test-only code into the bowels of Git itself. But it may be the least
bad solution.

The only alternative I could come up with is _not_ to set COLUMNS
everywhere, but instead insist on each individual test manually doing
"COLUMNS=80 git ...". Setting it as a one-shot seems to be reliable
enough. The downside is just that various tests will need to do so. We
already have quite a few that do, but I guess anything that uses the
progress meter is now subject to it.

-Peff

  reply	other threads:[~2021-07-27 17:38 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-14 12:39 progress test failure on fedora34 Fabian Stelzer
2021-07-14 15:35 ` Ævar Arnfjörð Bjarmason
2021-07-14 16:35   ` Alex Henrie
2021-07-18  8:05     ` Ævar Arnfjörð Bjarmason
2021-07-19  9:00       ` Jeff King
2021-07-19 17:18       ` Alex Henrie
2021-07-19 18:21         ` Alex Henrie
2021-07-19 18:43       ` Felipe Contreras
2021-07-19 19:34         ` Felipe Contreras
2021-07-19 20:42           ` Alex Henrie
2021-07-20  0:40             ` Felipe Contreras
2021-07-21  0:45               ` ZheNing Hu
2021-07-21  2:50                 ` Felipe Contreras
2021-07-26 23:57             ` [PATCH] test-lib.sh: use GIT_TEST_COLUMNS over COLUMNS Ævar Arnfjörð Bjarmason
2021-07-27 17:38               ` Jeff King [this message]
2021-07-28  0:53                 ` Junio C Hamano
2021-08-02 13:46               ` [PATCH v2 0/3] " Ævar Arnfjörð Bjarmason
2021-08-02 13:46                 ` [PATCH v2 1/3] test-lib-functions.sh: rename test_must_fail_acceptable() Ævar Arnfjörð Bjarmason
2021-08-02 13:46                 ` [PATCH v2 2/3] test-lib-functions.sh: add a test_with_columns function Ævar Arnfjörð Bjarmason
2021-08-02 17:14                   ` SZEDER Gábor
2021-08-02 17:24                     ` Eric Sunshine
2021-08-02 13:46                 ` [PATCH v2 3/3] test-lib.sh: use GIT_TEST_COLUMNS over COLUMNS Ævar Arnfjörð Bjarmason
2021-08-04 23:05                 ` [PATCH v3 0/3] " Ævar Arnfjörð Bjarmason
2021-08-04 23:05                   ` [PATCH v3 1/3] test-lib-functions.sh: rename test_must_fail_acceptable() Ævar Arnfjörð Bjarmason
2021-08-04 23:05                   ` [PATCH v3 2/3] test-lib-functions.sh: add a test_with_columns function Ævar Arnfjörð Bjarmason
2021-08-04 23:05                   ` [PATCH v3 3/3] test-lib.sh: use GIT_TEST_COLUMNS over COLUMNS Ævar Arnfjörð Bjarmason

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YQBEhj/Y6m0pqOth@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=alexhenrie24@gmail.com \
    --cc=avarab@gmail.com \
    --cc=fabian.stelzer@campoint.net \
    --cc=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=zbyszek@in.waw.pl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.