On 11/04/2022 02:05, Bruno Haible wrote:
Pádraig Brady wrote:
FAIL: tests/misc/dircolors
==========================

dircolors.pl: test term-1: stdout mismatch, comparing term-1.2 (expected) and 
term-1.O (actual)
*** term-1.2    Sun Apr 10 17:58:03 2022
--- term-1.O    Sun Apr 10 17:58:03 2022
***************
*** 1,2 ****
! LS_COLORS='tw=40;33:';
    export LS_COLORS
--- 1,2 ----
! LS_COLORS='';
    export LS_COLORS

That suggests the $TERM env var has not been unset for this test.
That should have been done by tests/envvar-check.

Indeed, it seems that the problem is more with the test framework
than with the 'dircolors' program. When I create a file named 'owt'
with

$ cat owt
TERM none
owt 40;33

then (in an interactive bash):

$ ./src/dircolors -b owt
LS_COLORS='';
export LS_COLORS

$ (unset TERM; ./src/dircolors -b owt)
LS_COLORS='tw=40;33:';
export LS_COLORS

When I add an 'echo as_unset=$as_unset' statement to tests/envvar-check,
it prints
   as_unset=unset
at each test run.

Concentrating on a single test run:
$ make check-TESTS TESTS=tests/misc/dircolors

When I add a line 'print "<<<$ENV{TERM}>>>\n" to tests/misc/dircolors.pl
and run the test, the file tests/misc/dircolors.log contains
   <<<dumb>>>
So, somewhere the empty value for TERM must be replaced with the
value 'dumb'. Since build-aux/test-driver does not do anything with TERM,
my guess is that perl is the culprit. The perl version is 5.22.2.

When I add a line
   $ENV{TERM} = '';
near the beginning of tests/misc/dircolors.sh, then the test succeeds.

Thanks for the confirmation.
It's probably best to unset that var more centrally.
The attached unsets this env var for all coreutils tests perl invocations.

thanks,
Pádraig
From 146c4c3d46e39ef3eb897ca0f467b683c15ff2d8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <p...@draigbrady.com>
Date: Mon, 11 Apr 2022 14:17:59 +0100
Subject: [PATCH] tests: dircolors.pl: avoid false failure with TERM=dumb

* tests/Coreutils.pm: Ensure an unset $TERM env var,
which is required on perl 5.22.2 on Solaris 11 OpenIndiana at least,
where TERM was being reset to 'dumb'.
Reported By Bruno Haible.
---
 tests/Coreutils.pm | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tests/Coreutils.pm b/tests/Coreutils.pm
index fad7ab9d2..982e1f1d1 100644
--- a/tests/Coreutils.pm
+++ b/tests/Coreutils.pm
@@ -42,6 +42,11 @@ my $Global_count = 1;
 defined $ENV{DJDIR}
   and $ENV{SHELL} = "$ENV{DJDIR}/bin/bash.exe";
 
+# Perl 5.22.5 was seen to default to TERM=dumb on Solaris 11 OpenIndiana
+# So ensure this variable is unset.
+defined $ENV{TERM}
+  and delete $ENV{TERM};
+
 # A file spec: a scalar or a reference to a single-keyed hash
 # ================
 # 'contents'               contents only (file name is derived from test name)
-- 
2.26.2

Reply via email to