Your message dated Sat, 1 Jul 2017 21:46:39 +0100
with message-id <[email protected]>
and subject line colordiff --color=no to a pipe is not working
has caused the Debian Bug report #862878,
regarding colordiff --color=no to a pipe is not working
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
862878: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=862878
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: colordiff
Version: 1.0.16-1
Severity: normal
Tags: patch

Dear Maintainer,

The README says that one can do:

    If you want to force disable colour escape sequences (for example
    pipe the output to patch), you can use option '--color=no' to do
    so:

    $ diff -u file1 file2 | colordiff --color=no | patch -p0 -d 
another-working-dir


However in 1.0.16 this does not work bcause $color_patch is only used
if output is to a file:

    if ((-f STDOUT) && ($color_patch == 0)) {
        ... disable color output ...


So I propose the attached patch to make sure that *if set*
$color_patch can override the automatic decisions either way.

It would also make sense to ship a /etc/colordiffrc file where
color_patches is set to auto, but whatever the case one would be able
to get the desired behavior by using --color=XXX on the command line.



-- System Information:
Debian Release: 9.0
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'stable')
Architecture: amd64
 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.9.0-2-amd64 (SMP w/8 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages colordiff depends on:
ii  perl  5.24.1-2

colordiff recommends no packages.

colordiff suggests no packages.

-- Configuration Files:
/etc/colordiffrc changed:
banner=no
color_patches=auto
diff_cmd=diff
plain=off
newtext=darkgreen
oldtext=darkred
diffstuff=darkcyan
cvsstuff=cyan


-- no debconf information
--- colordiff   2015-10-26 15:50:33.000000000 +0100
+++ colordiff.new       2017-05-18 05:27:38.616380978 +0200
@@ -31,7 +31,7 @@
 my $app_www      = 'http://www.colordiff.org/';
 my $copyright    = '(C)2002-2015';
 my $show_banner  = 1;
-my $color_patch  = 0;
+my $color_patch  = undef;
 my $diff_cmd     = "diff";
 
 # ANSI sequences for colours
@@ -210,6 +210,8 @@
             if ($setting eq 'color_patches') {
                 if ($value eq 'yes') {
                     $color_patch = 1;
+                } elsif ($value eq 'no') {
+                    $color_patch = 0;
                 }
                 next;
             }
@@ -269,12 +271,13 @@
     $color_patch = 1;
 } elsif ($color_mode eq "no") {
     $color_patch = 0;
+} elsif ($color_mode eq "auto") {
+    $color_patch = undef;
 }
 
-# If output is to a file, switch off colours, unless 'color_patch' is set,
-# which might be due to --color=no being specified
+# If output is to a file, switch off colours unless overriden by $color_patch.
 # Relates to http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=378563
-if ((-f STDOUT) && ($color_patch == 0)) {
+if (!$color_patch && (defined $color_patch || -f STDOUT)) {
     $plain_text  = '';
     $file_old    = '';
     $file_new    = '';

--- End Message ---
--- Begin Message ---
This bug was fixed in 1.0.17 (and mentioned in the debian/changelog) but
that version didn't get uploaded since it was followed too quickly by
1.0.18.

So manually closing the bug now 1.0.18 is in unstable.

-- 
Colin Tuckley    | +44(0)1223 830814 |  PGP/GnuPG Key Id
Debian Developer | +44(0)7799 143369 | 0xFA0C410738C9D903

--- End Message ---

Reply via email to