bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: Bug Report: Diff 2.7 has incorrect output for files with LFCR as lin


From: Hans-Bernhard Broeker
Subject: Re: Bug Report: Diff 2.7 has incorrect output for files with LFCR as line terminator.
Date: 14 Dec 2001 12:44:06 GMT

Alex Bochannek <address@hidden> wrote:
>> Alex Bochannek <address@hidden> wrote:
>> > It appears that "diff - GNU diffutils version 2.7" (Solaris 8)
>> > produces incorrect output for context and unified diffs when applied
>> > to files, which use LFCR as a line termination sequence. The diffs are
>> > in fact accurate, but the first column (with '+', '-', '!', etc.) is
>> > missing:

Really _LFCR_ as a line terminator?  What strange tool would use
*that*?  DOS & friends have CRLF, Unix has LF only, Mac (before OS X)
have CR only --- I don't think I've ever seen anything trying to use
LFCR.

> Do you think there is anything within diff that you would be willing
> to do to address this? Maybe a line termination sequence option?

One obvious solution would be to transform the files in to correctly
structured Unix textfiles before you begin applying Unix textfile
utilities, like diff, to them.

IMHO it's none of diff's business to decide upon the type of line
ending in your file.  The diffs are exactly correct, it's just in
displaying them that problems arise. A clear case of GIGO, I'd say:
garbage in --> garbage out.  If a fix is to be applied, it should be
done somewhere before the file is viewed, but not in 'diff'.

You would need a filter program that corrects the line endings either
before you present the files to 'diff', or at least between production
and viewing of the files.  A very quick shot would be:

        diff -u file1 file2 | tr -d '\r' | less

But then, I guess 'less' can cope with the CR's in the files already, so
you wouldn't have to filter them out for this particular case.
-- 
Hans-Bernhard Broeker (address@hidden)
Even if all the snow were burnt, ashes would remain.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]