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