From: "SZEDER Gábor" <szeder.dev@gmail.com>
To: Jeff King <peff@peff.net>
Cc: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
git@vger.kernel.org, "Junio C Hamano" <gitster@pobox.com>
Subject: Re: [PATCH] progress.c tests: fix breakage with COLUMNS != 80
Date: Thu, 24 Jun 2021 07:12:53 +0200 [thread overview]
Message-ID: <20210624051253.GG6312@szeder.dev> (raw)
In-Reply-To: <YNPISWEBxISC30DW@coredump.intra.peff.net>
On Wed, Jun 23, 2021 at 07:48:25PM -0400, Jeff King wrote:
> On Mon, Jun 21, 2021 at 09:01:23AM +0200, Ævar Arnfjörð Bjarmason wrote:
>
> > The tests added in 2bb74b53a49 (Test the progress display, 2019-09-16)
> > broke under anything except COLUMNS=80, i.e. when running them under
> > the "-v" mode under a differently sized terminal.
> >
> > Let's set the expected number of COLUMNS at the start of the test to
> > fix that bug. It's handy not do do this in test-progress.c itself, in
> > case we'd like to test for a different number of COLUMNS, either
> > manually or in a future test.
>
> Hmm. So I can easily reproduce the problem here, and your patch fixes
> it. But my first thought was: shouldn't test-lib.sh be handling this to
> give all of the scripts a uniform environment?
>
> And indeed, we _do_ unset COLUMNS there. So I think the problem isn't
> a bad setting of $COLUMNS, but rather that in "-v" mode, the
> sub-command's stderr is hooked to our tty, and term_columns() is smart
> enough to use TIOCGWINSZ to get the value (at least on some platforms).
>
> Setting $COLUMNS again in the environment fixes it, because we prefer
> that value to trying the ioctl.
>
> So I don't think what you have here is wrong (though the commit message
> is a little misleading).
It is misleading indeed and needs to be updated. I did my own
analysis and arrived to the same conclusions wrt COLUMNS being unset
vs. the ioctl() and stderr being a tty.
> But it seems like the original intent of our
> "unset COLUMNS" in test-lib.sh would best be fulfilled by setting it to
> a known value there (like 80), rather than unsetting it.
>
> I admit this a _bit_ of a nitpick (since as far as we know none of the
> other scripts care about the terminal width), so I'm OK with this as-is
> if you feel strongly the other way.
I remember one commit-graph test that does check the number of lines
in the progress output, assuming one progress line per commit-graph
layer, which breaks when we break the progress line in a too narrow
terminal. Running './t5324-split-commit-graph.sh -v -i' in a 46
column wide terminal fails for me, but succeeds with 47 columns.
I do suggest setting COLUMNS=80 in 'test-lib.sh'.
next prev parent reply other threads:[~2021-06-24 5:13 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-21 7:01 [PATCH] progress.c tests: fix breakage with COLUMNS != 80 Ævar Arnfjörð Bjarmason
2021-06-23 23:48 ` Jeff King
2021-06-24 5:12 ` SZEDER Gábor [this message]
2021-06-24 5:40 ` Jeff King
2021-06-24 15:05 ` Philip Oakley
2021-06-24 10:19 ` [PATCH] test-lib.sh: set COLUMNS=80 for --verbose repeatability Ævar Arnfjörð Bjarmason
2021-06-24 14:50 ` Jeff King
2021-06-27 7:44 ` SZEDER Gábor
2021-06-29 1:42 ` Junio C Hamano
2021-06-29 11:29 ` [PATCH v2] " Æ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=20210624051253.GG6312@szeder.dev \
--to=szeder.dev@gmail.com \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
/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 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 NNTP newsgroup(s).