Re: [PATCH v2] test: fix for COLUMNS and bash 5

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Felipe Contreras <felipe.contreras@xxxxxxxxx> 于2021年8月7日周六 上午12:44写道:
>
> 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@xxxxxxxxxxxx>
> Signed-off-by: Felipe Contreras <felipe.contreras@xxxxxxxxx>
> ---
>
> Since v1 moved the code before setting COLUMNS as SZEDER Gábor suggested
> and mention checkwinsize could be set before bash 5 as Ævar Arnfjörð
> Bjarmason mentioned.
>
> Range-diff against v1:
> 1:  40273074de < -:  ---------- test: fix for COLUMNS and bash 5
> -:  ---------- > 1:  9f8c3ffa6a test: fix for COLUMNS and bash 5
>
>  t/test-lib.sh | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/t/test-lib.sh b/t/test-lib.sh
> index db61081d6b..6b1015a5af 100644
> --- a/t/test-lib.sh
> +++ b/t/test-lib.sh
> @@ -409,6 +409,12 @@ then
>         verbose=t
>  fi
>
> +# In bash if checkwinsize is enabled the COLUMNS variable is updated every time
> +# an external command completes, even for non-interactive shells. Since bash 5.0
> +# this is enabled by default.
> +# Disable that since we are aiming for reproducibility.
> +test -n "$BASH_VERSION" && shopt -u checkwinsize 2>/dev/null
> +
>  # For repeatability, reset the environment to known value.
>  # TERM is sanitized below, after saving color control sequences.
>  LANG=C
> --
> 2.32.0.40.gb9b36f9b52
>

This can work on Arch-Linux. LGTM.

Thanks.
--
ZheNing Hu




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux