On Monday, 17.07.2006 at 22:19 +0200, Adam Borowski wrote:

> --- colordiff~  2006-07-17 15:01:56.564810563 +0200
> +++ colordiff   2006-07-17 15:01:56.564810563 +0200
> @@ -31,6 +31,8 @@
>  use Getopt::Long qw(:config pass_through);
>  use IPC::Open2;
> 
> +exec "/usr/bin/diff",@ARGV unless -t STDOUT;
> +
>  my $app_name     = 'colordiff';
>  my $version      = '1.0.4';
>  my $author       = 'Dave Ewart';
> 
> (Of course, the exact place doesn't really matter.)

It's not as simple as that, though: the above will fail if colordiff (or
'diff' if aliased to colordiff) is used in a pipe.  In other words,
this is an incomplete fix.

In detail...

i.e. (assuming 'alias diff=colordiff')

diff file1 file2 - this will work and colour-highlight the output
diff file1 file2 > my.patch - this will *not* colour-highlight, as intended

but

someprog | diff > my.patch - this will give an error

    /usr/bin/diff: missing operand after `/usr/bin/diff'
    /usr/bin/diff: Try `/usr/bin/diff --help' for more information.

Given this, and the fact that colordiff's entire raison d'ĂȘtre is to
colour highlight, my feeling is that a better option is this: rather than try
to make colordiff *avoid* highlighting in certain circumstances, this
limitation is explained in the man page.

A documentation change might actually be a more thorough solution: it
will make the user know "what they're letting themselves in for" by
aliasing 'diff' to 'colordiff'.

Thoughts on that, Adam?


> > > I already reported this bug upstream over three years ago, but it
> > > appears to be left unfixed.  At least, the bug bit me today again :p
> > 
> > [Odd - I've got no record of you ever contacting me, which is strange
> > since I'm usually fairly obsessive about keeping that sort of email.
> > Did I ever reply?!  Apologies if not, but I don't think I got your
> > message.]
> 
> I'm afraid I didn't use mail, just the SourceForge bug report system:
> 
> https://sourceforge.net/tracker/?func=detail&aid=745456&group_id=65829&atid=512406
> 
> I'm not sure if they mail you any new bug reports by default; I would
> probably fail to notice such reports on my projects for years, too.

Well, that's news to me - never got any notifications of those bug
reports.  I'll go take a look at them ...

Dave.
-- 
Dave Ewart - [EMAIL PROTECTED] - jabber: [EMAIL PROTECTED] - freenode: davee
All email from me is now digitally signed, key from http://www.sungate.co.uk/
Fingerprint: AEC5 9360 0A35 7F66 66E9 82E4 9E10 6769 CD28 DA92

Attachment: signature.asc
Description: Digital signature

Reply via email to