Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bug with `-w' (`--ignore-all-space') option

0 views
Skip to first unread message

Khalukhin Alexander

unread,
Nov 11, 2009, 1:25:57 PM11/11/09
to bug-gn...@gnu.org
Here are two simple text files:

[bugman@localhost 1]$ cat test1.txt
a a a a

[bugman@localhost 1]$ cat test2.txt
a
a
a
a

Now I'm trying to find difference, using -w (or --ignore-all-space) option:

[bugman@localhost 1]$ diff -w test1.txt test2.txt
1c1,4
< a a a a
---
> a
> a
> a
> a


But judging to MANs they should have no differences:

http://www.gnu.org/software/diffutils/manual/html_node/diff-Options.html#diff%20Options
-w --ignore-all-space Ignore white space when comparing lines. See White
Space<http://www.gnu.org/software/diffutils/manual/html_node/White-Space.html#White%20Space>.


http://www.gnu.org/software/diffutils/manual/html_node/White-Space.html#White%20Space
The -w and --ignore-all-space options are stronger still. They ignore
difference even if one line has white space where the other line has
none. White
space characters include tab, *newline*, vertical tab, form feed, carriage
return, and space; some locales may define additional characters to be white
space.

Is it a BUG? Or how can I get wishing result (ignore newlines while
comparing)?

Andreas Schwab

unread,
Nov 12, 2009, 10:07:53 AM11/12/09
to Khalukhin Alexander, bug-gn...@gnu.org
Khalukhin Alexander <khal...@gmail.com> writes:

> Here are two simple text files:
>
> [bugman@localhost 1]$ cat test1.txt
> a a a a
>
> [bugman@localhost 1]$ cat test2.txt
> a
> a
> a
> a
>
> Now I'm trying to find difference, using -w (or --ignore-all-space) option:
>
> [bugman@localhost 1]$ diff -w test1.txt test2.txt
> 1c1,4
> < a a a a
> ---
>> a
>> a
>> a
>> a
>
>
> But judging to MANs they should have no differences:

diff always operates on lines, which separated by newlines that are not
considered part of them.

> http://www.gnu.org/software/diffutils/manual/html_node/diff-Options.html#diff%20Options
> -w --ignore-all-space Ignore white space when comparing lines. See White
> Space<http://www.gnu.org/software/diffutils/manual/html_node/White-Space.html#White%20Space>.
>
>
> http://www.gnu.org/software/diffutils/manual/html_node/White-Space.html#White%20Space
> The -w and --ignore-all-space options are stronger still. They ignore
> difference even if one line has white space where the other line has
> none. White
> space characters include tab, *newline*, vertical tab, form feed, carriage
> return, and space; some locales may define additional characters to be white
> space.
>
> Is it a BUG?

It's a documentation bug.

> Or how can I get wishing result (ignore newlines while comparing)?

Try wdiff.

Andreas.

--
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."


Jim Meyering

unread,
Nov 16, 2009, 8:06:32 AM11/16/09
to Andreas Schwab, Khalukhin Alexander, bug-gn...@gnu.org

Thanks for the report.
FYI, that has been fixed for a while, and will
be updated with the next release, which will be soon.


0 new messages