GNU bug report logs - #72274
diff: option to ignore leading white space

Previous Next

Package: diffutils;

Reported by: Vincent Lefevre <vincent <at> vinc17.net>

Date: Wed, 24 Jul 2024 12:00:02 UTC

Severity: wishlist

To reply to this bug, email your comments to 72274 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-diffutils <at> gnu.org:
bug#72274; Package diffutils. (Wed, 24 Jul 2024 12:00:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Vincent Lefevre <vincent <at> vinc17.net>:
New bug report received and forwarded. Copy sent to bug-diffutils <at> gnu.org. (Wed, 24 Jul 2024 12:00:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Vincent Lefevre <vincent <at> vinc17.net>
To: bug-diffutils <at> gnu.org
Subject: option to ignore leading white space
Date: Wed, 24 Jul 2024 13:59:33 +0200
There should be an option to ignore leading white space, like
there is one for trailing white space, and it should probably
be integrated in the -b option.

Basically, I'd like to be able to get only lines that differ by words.

Currently:

cventin:~> diff -bu <(printf "ab cd\n") <(printf " ab  cd \n")
--- /proc/self/fd/11    2024-07-24 13:58:43.515131625 +0200
+++ /proc/self/fd/14    2024-07-24 13:58:43.515131625 +0200
@@ -1 +1 @@
-ab cd
+ ab  cd 

-- 
Vincent Lefèvre <vincent <at> vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)




Changed bug title to 'diff: option to ignore leading white space' from 'option to ignore leading white space' Request was from Vincent Lefevre <vincent <at> vinc17.net> to control <at> debbugs.gnu.org. (Wed, 24 Jul 2024 12:09:01 GMT) Full text and rfc822 format available.

Severity set to 'wishlist' from 'normal' Request was from Vincent Lefevre <vincent <at> vinc17.net> to control <at> debbugs.gnu.org. (Wed, 24 Jul 2024 12:09:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-diffutils <at> gnu.org:
bug#72274; Package diffutils. (Wed, 24 Jul 2024 19:50:02 GMT) Full text and rfc822 format available.

Message #12 received at 72274 <at> debbugs.gnu.org (full text, mbox):

From: Eric Deplagne <eric <at> deplagne.name>
To: Vincent Lefevre <vincent <at> vinc17.net>
Cc: 72274 <at> debbugs.gnu.org
Subject: Re: [bug-diffutils] bug#72274: option to ignore leading white space
Date: Wed, 24 Jul 2024 21:47:02 +0200
  diff -w might be your friend.

  $ diff -wus <(printf "ab cd\n") <(printf " ab  cd \n")
  Les fichiers /dev/fd/63 et /dev/fd/62 sont identiques

On 2024-07-24 13:59, Vincent Lefevre wrote:
> There should be an option to ignore leading white space, like
> there is one for trailing white space, and it should probably
> be integrated in the -b option.
> 
> Basically, I'd like to be able to get only lines that differ by words.
> 
> Currently:
> 
> cventin:~> diff -bu <(printf "ab cd\n") <(printf " ab  cd \n")
> --- /proc/self/fd/11    2024-07-24 13:58:43.515131625 +0200
> +++ /proc/self/fd/14    2024-07-24 13:58:43.515131625 +0200
> @@ -1 +1 @@
> -ab cd
> + ab  cd

-- 
  Eric Deplagne




Information forwarded to bug-diffutils <at> gnu.org:
bug#72274; Package diffutils. (Wed, 24 Jul 2024 20:23:01 GMT) Full text and rfc822 format available.

Message #15 received at 72274 <at> debbugs.gnu.org (full text, mbox):

From: Vincent Lefevre <vincent <at> vinc17.net>
To: Eric Deplagne <eric <at> deplagne.name>
Cc: 72274 <at> debbugs.gnu.org
Subject: Re: [bug-diffutils] bug#72274: option to ignore leading white space
Date: Wed, 24 Jul 2024 22:21:50 +0200
On 2024-07-24 21:47:02 +0200, Eric Deplagne wrote:
>   diff -w might be your friend.
> 
>   $ diff -wus <(printf "ab cd\n") <(printf " ab  cd \n")
>   Les fichiers /dev/fd/63 et /dev/fd/62 sont identiques

But this one is wrong:

$ diff -wus <(printf "ab cd\n") <(printf " abcd \n")
Files /proc/self/fd/11 and /proc/self/fd/14 are identical

-- 
Vincent Lefèvre <vincent <at> vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)




Information forwarded to bug-diffutils <at> gnu.org:
bug#72274; Package diffutils. (Wed, 24 Jul 2024 21:19:01 GMT) Full text and rfc822 format available.

Message #18 received at 72274 <at> debbugs.gnu.org (full text, mbox):

From: Eric Deplagne <eric <at> deplagne.name>
To: Vincent Lefevre <vincent <at> vinc17.net>
Cc: 72274 <at> debbugs.gnu.org
Subject: Re: [bug-diffutils] bug#72274: option to ignore leading white space
Date: Wed, 24 Jul 2024 23:15:27 +0200
On 2024-07-24 22:21, Vincent Lefevre wrote:
> On 2024-07-24 21:47:02 +0200, Eric Deplagne wrote:
>>   diff -w might be your friend.
>> 
>>   $ diff -wus <(printf "ab cd\n") <(printf " ab  cd \n")
>>   Les fichiers /dev/fd/63 et /dev/fd/62 sont identiques
> 
> But this one is wrong:
> 
> $ diff -wus <(printf "ab cd\n") <(printf " abcd \n")
> Files /proc/self/fd/11 and /proc/self/fd/14 are identical

  Wrong, indeed. :/

-- 
  Eric Deplagne




Information forwarded to bug-diffutils <at> gnu.org:
bug#72274; Package diffutils. (Thu, 25 Jul 2024 00:40:02 GMT) Full text and rfc822 format available.

Message #21 received at 72274 <at> debbugs.gnu.org (full text, mbox):

From: Tim Chase <debian <at> tim.thechases.com>
To: Vincent Lefevre <vincent <at> vinc17.net>
Cc: 72274 <at> debbugs.gnu.org, Eric Deplagne <eric <at> deplagne.name>
Subject: Re: [bug-diffutils] bug#72274: option to ignore leading white space
Date: Wed, 24 Jul 2024 16:57:49 -0500
On 2024-07-24 22:21, Vincent Lefevre wrote:
> $ diff -wus <(printf "ab cd\n") <(printf " abcd \n")
> Files /proc/self/fd/11 and /proc/self/fd/14 are identical

Doesn't even require the leading/trailing space:

 $ echo abcd > nospace
 $ echo ab cd > space
 $ diff -wus nospace space
 Files nospace and space are identical

FWIW, this happens with diff(1) on FreeBSD & OpenBSD too, so it's
not just a GNU diff(1) thing.

-tkc









Information forwarded to bug-diffutils <at> gnu.org:
bug#72274; Package diffutils. (Thu, 25 Jul 2024 00:43:02 GMT) Full text and rfc822 format available.

Message #24 received at 72274 <at> debbugs.gnu.org (full text, mbox):

From: Vincent Lefevre <vincent <at> vinc17.net>
To: Tim Chase <debian <at> tim.thechases.com>
Cc: 72274 <at> debbugs.gnu.org, Eric Deplagne <eric <at> deplagne.name>
Subject: Re: [bug-diffutils] bug#72274: option to ignore leading white space
Date: Thu, 25 Jul 2024 02:42:16 +0200
On 2024-07-24 16:57:49 -0500, Tim Chase wrote:
> On 2024-07-24 22:21, Vincent Lefevre wrote:
> > $ diff -wus <(printf "ab cd\n") <(printf " abcd \n")
> > Files /proc/self/fd/11 and /proc/self/fd/14 are identical
> 
> Doesn't even require the leading/trailing space:
> 
>  $ echo abcd > nospace
>  $ echo ab cd > space
>  $ diff -wus nospace space
>  Files nospace and space are identical
> 
> FWIW, this happens with diff(1) on FreeBSD & OpenBSD too, so it's
> not just a GNU diff(1) thing.

That's why -w is not the right option.

Contents that have been passed through HTML often get all their
leading white space removed. Hence the usefulness of an option
to ignore leading white space.

-- 
Vincent Lefèvre <vincent <at> vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)




This bug report was last modified 325 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.