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

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

Re: diff -b does not actually work with newlines


From: David Kastrup
Subject: Re: diff -b does not actually work with newlines
Date: Fri, 13 Jul 2007 21:04:22 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/23.0.51 (gnu/linux)

Paul Eggert <address@hidden> writes:

> David Kastrup <address@hidden> writes:
>
>>     The `-b' and `--ignore-space-change' options ignore white space at line
>>     end,
>
> It ignores all white space at the line end, but it does not ignore the
> line end itself.  This is longstanding behavior, specified by POSIX
> <http://www.opengroup.org/onlinepubs/009695399/utilities/diff.html>.
> Perhaps it could be documented more clearly (wording suggestions would
> be gratefully suggested).

Your Posix reference specifies:

-b Cause any amount of white space at the end of a line to be treated
    as a single <newline> (that is, the white-space characters
    preceding the <newline> are ignored) and other strings of
    white-space characters, not including <newline>s, to compare
    equal.

It is not a matter of "documented less clearly" if you omit "not
including <newline>s" from the option description.  It is plainly
wrong.

So fine, this is long-standing behavior _and_ prescribed by Posix.  It
is just described completely and utterly wrong in info file and
--help.  I would then wish for the following:

a) the bit about "not including <newline>s" be added to the info
file and help string.  It is absolutely essential.

b) add options, say
--one-newline-is-whitespace (for determining differing hunks, a single
                             newline after end-of-line space removal
                             counts as whitespace)
--newlines-are-whitespace (the same for multiple newlines).

This is _really_ important functionality.

Thanks,

-- 
David Kastrup




reply via email to

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