Subject: Re: bug#15992: 'ls' ignores term capabilities when generating color.

From: Pádraig Brady <[email-masked]>
Date: Fri, 18 Apr 2014 11:28:16 +0100

On 04/17/2014 02:14 AM, Pádraig Brady wrote:
> On 04/16/2014 07:21 PM, Bernhard Voelker wrote:
>> On 04/16/2014 05:56 PM, Pádraig Brady wrote:
>>> I've cleaned up the patch and added a test.
>>> If you're Ok with it I'll push.
>>
>> Minor nit:
>>
>>> +++ b/tests/ls/color-term.sh
>>> [...]
>>> +# Don#t output colors
>>
>> s/Don#t/Don't/
>>
>> Otherwise +1.
>>
>> Thanks & have a nice day,
>> Berny
>>
> Guilherme confirmed privately that adjustments are OK,
> so pushing now.

I pushed this follow up to avoid test failures
(since tests were dependent on the COLORTERM
being set in the environment).

thanks,
Pádraig.

>From 14613e2fd132a1e252849cd881706bca8428f9f9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <[email-masked]>
Date: Fri, 18 Apr 2014 11:19:10 +0100
Subject: [PATCH] tests: make ls tests independent of COLORTERM env

Since the recent commit v8.22-68-g08783f1, ls coloring
is now dependent on the COLORTERM environment variable.

* tests/envvar-check: Unset COLORTERM from test environment.
* tests/ls/color-dtype-dir.sh: Ensure coloring is used.
* tests/misc/ls-misc.pl: Likewise.

Prompted by the continuous integration build failure at:
http://hydra.nixos.org/build/10397646
---
 tests/envvar-check          |    1 +
 tests/ls/color-dtype-dir.sh |    2 +-
 tests/misc/ls-misc.pl       |    5 ++++-
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/tests/envvar-check b/tests/envvar-check
index 09b4ded..b6d94b4 100644
--- a/tests/envvar-check
+++ b/tests/envvar-check
@@ -43,6 +43,7 @@ vars='
   SIMPLE_BACKUP_SUFFIX
   TABSIZE
   TERM
+  COLORTERM
   TIME_STYLE
   TMPDIR
   VERSION_CONTROL
diff --git a/tests/ls/color-dtype-dir.sh b/tests/ls/color-dtype-dir.sh
index 88dd781..559a188 100755
--- a/tests/ls/color-dtype-dir.sh
+++ b/tests/ls/color-dtype-dir.sh
@@ -30,7 +30,7 @@ chmod o+w other-writable || framework_failure_
 chmod o+t sticky || framework_failure_

-ls --color=always > out || fail=1
+TERM=xterm ls --color=always > out || fail=1
 cat -A out > o1 || fail=1
 mv o1 out || fail=1
 
diff --git a/tests/misc/ls-misc.pl b/tests/misc/ls-misc.pl
index f562b72..a47e70b 100755
--- a/tests/misc/ls-misc.pl
+++ b/tests/misc/ls-misc.pl
@@ -303,9 +303,12 @@ my @Tests =
             . "\e[37;44msticky$e\n"
          },
 
+        {PRE => sub {
+         push_ls_colors('ow=34;42:tw=30;42:sg=30;43:su=37;41:st=37;44'); }},
         {POST => sub {
          unlink qw(setuid setgid);
-         foreach my $dir (qw(owr owt sticky)) {rmdir $dir} }},
+         foreach my $dir (qw(owr owt sticky)) {rmdir $dir}
+         restore_ls_colors; }},
          ],
 
      # For 5.97 and earlier, --file-type acted like --indicator-style=slash.
-- 
1.7.7.6