From unknown Sun Jun 22 22:45:01 2025 X-Loop: help-debbugs@gnu.org Subject: bug#19319: ? Unexpected behavior in diff(1) Resent-From: Todd Shandelman Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Mon, 08 Dec 2014 22:29:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 19319 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: P@draigbrady.com, 19319@debbugs.gnu.org X-Debbugs-Original-To: =?UTF-8?Q?P=C3=A1draig?= Brady , bug-coreutils@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.141807768513468 (code B ref -1); Mon, 08 Dec 2014 22:29:01 +0000 Received: (at submit) by debbugs.gnu.org; 8 Dec 2014 22:28:05 +0000 Received: from localhost ([127.0.0.1]:58225 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xy6mh-0003V9-Tl for submit@debbugs.gnu.org; Mon, 08 Dec 2014 17:28:04 -0500 Received: from eggs.gnu.org ([208.118.235.92]:55553) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xy6mf-0003Uk-25 for submit@debbugs.gnu.org; Mon, 08 Dec 2014 17:28:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xy6mc-0000Xp-SN for submit@debbugs.gnu.org; Mon, 08 Dec 2014 17:28:00 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, HTML_MESSAGE,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:35356) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xy6mc-0000Xl-Pt for submit@debbugs.gnu.org; Mon, 08 Dec 2014 17:27:58 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57255) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xy6mb-0006kF-3c for bug-coreutils@gnu.org; Mon, 08 Dec 2014 17:27:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xy6mY-0000Wz-Sw for bug-coreutils@gnu.org; Mon, 08 Dec 2014 17:27:57 -0500 Received: from mail-la0-x22b.google.com ([2a00:1450:4010:c03::22b]:48830) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xy6mX-0000Wa-Vy for bug-coreutils@gnu.org; Mon, 08 Dec 2014 17:27:54 -0500 Received: by mail-la0-f43.google.com with SMTP id s18so4302039lam.16 for ; Mon, 08 Dec 2014 14:27:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=bmlbprp+vjOCMd3HPYfnMdEQZ55emHXQh+VIYyGaH5Q=; b=grZpvud2mJWZkuq/zn+4Q2jLZJyYI5fSL12nrvcYg6Bl8sC+cJkTCZ5+lSI+tPp5K6 0rSd5FXg5LPeHs54JWT+l41T4jGjkkmmkXBE1+OmQSibtdtnYGOtYBciJprpqKEjFCdL KlrFCqhC0KNoQBx7qSLF8y/acEubHr+b/uM5Ot0GjKSR0dq1D0npE97DYkhEiDLIkoO5 g479w3jf3Dukb4qdW5eXLSBC/yiPvaU5xtUYDjGCoYMyPEfslUZa7uuZvXLjgOB+//RB N0gM/7tkzeAz+hKnKLsJzjuhJ5K2WeeyfmcPxkd+TlOLqhux0QkmGPHsTU6+SfsaYoTf hJ2w== MIME-Version: 1.0 X-Received: by 10.112.199.138 with SMTP id jk10mr18524904lbc.86.1418077672065; Mon, 08 Dec 2014 14:27:52 -0800 (PST) Received: by 10.25.38.21 with HTTP; Mon, 8 Dec 2014 14:27:52 -0800 (PST) Date: Mon, 8 Dec 2014 16:27:52 -0600 Message-ID: From: Todd Shandelman Content-Type: multipart/alternative; boundary=001a11c3358ae84ff40509bbef88 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) --001a11c3358ae84ff40509bbef88 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hello, Padraig - How are you? Can you explain the behavior of diff(1) shown below? With -U1 and -U2 , the --ignore-matching-lines=3D'Id' argument suppresses display of the difference between the 'Id' lines, as expected. But with -U3, the diff of the 'Id' lines reappears, in spite of the --ignore-matching-lines=3D'Id' argument. Why is that? Thanks, Todd Shandelman Houston, Texas ############################################################ $ cat a # # ORIG: 2014-12-04 09:28:56 CST Thu # # $Id: a,v 1.8 2014/12/04 15:29:99 todd Exp todd $ # a b c d e ############################################################ $ cat b # # ORIG: 2014-12-04 09:28:56 CST Thu # # $Id: a,v 1.8 2014/12/04 15:29:27 todd Exp $ # a c D e ############################################################ $ diff -v diff (GNU diffutils) 2.8.1 Copyright (C) 2002 Free Software Foundation, Inc. This program comes with NO WARRANTY, to the extent permitted by law. You may redistribute copies of this program under the terms of the GNU General Public License. For more information about these matters, see the file named COPYING. Written by Paul Eggert, Mike Haertel, David Hayes, Richard Stallman, and Len Tower. ############################################################ $ diff -U1 a b --- a 2014-12-08 16:07:05.974621828 -0600 +++ b 2014-12-08 16:07:09.693672957 -0600 @@ -3,8 +3,7 @@ # - # $Id: a,v 1.8 2014/12/04 15:29:99 todd Exp todd $ + # $Id: a,v 1.8 2014/12/04 15:29:27 todd Exp $ # a -b c -d +D e ############################################################ $ diff -U1 --ignore-matching-lines=3D'Id' a b --- a 2014-12-08 16:07:05.974621828 -0600 +++ b 2014-12-08 16:07:09.693672957 -0600 @@ -6,5 +6,4 @@ a -b c -d +D e ############################################################ $ diff -U2 --ignore-matching-lines=3D'Id' a b --- a 2014-12-08 16:07:05.974621828 -0600 +++ b 2014-12-08 16:07:09.693672957 -0600 @@ -5,6 +5,5 @@ # a -b c -d +D e ############################################################ $ diff -U3 --ignore-matching-lines=3D'Id' a b --- a 2014-12-08 16:07:05.974621828 -0600 +++ b 2014-12-08 16:07:09.693672957 -0600 @@ -1,10 +1,9 @@ # # ORIG: 2014-12-04 09:28:56 CST Thu # - # $Id: a,v 1.8 2014/12/04 15:29:99 todd Exp todd $ + # $Id: a,v 1.8 2014/12/04 15:29:27 todd Exp $ # a -b c -d +D e ############################################################ On 9 December 2012 at 06:34, P=C3=A1draig Brady wrote: > On 12/07/2012 08:23 PM, Todd Shandelman wrote: > >> Hi, bug-coreutils@gnu.org - >> >> Not quite a bug, but why does the same option, essentially, have two ver= y >> different names in the 'expand' and 'unexpand' utilities? >> >> This is confusing and hampers convenient usage. >> >> I am referring to* --initial* in the one case and* --first-only* in the >> other. >> >> See below. >> >> Or what am I missing? >> > > Yes that is inconsistent. > Interestingly the POSIX defined expand and unexpand are inconsistent > in relation to this to start with. > > unexpand only processes leading blanks by default, but > expand processes all blanks by default. > > So unexpand needs the -a option to process all blanks, > and expand needs the -i, --initial option to process only leading blanks. > > Given the above you might think that the --first-only option to unexpand > is redundant. However -a is implied by -t (as per POSIX), therefore > to really limit to initial blanks, you need this option. > > So as for naming. I agree that --first-only is inconsistent. > It's also a bit ambiguous. Does it mean only the first tab is written, > or all leading blanks are processed. Now deprecating --first-only > for the more consistent --initial has some cost. For example > it would break part of my FSlint program: > http://code.google.com/p/fslint/source/browse/trunk/ > fslint/supprt/rmlint/fix_ws.sh > Also, I see busybox copied --first-only into its unexpand implementation. > But I guess to be forward looking --first-only should be deprecated > in favor of --initial? > > thanks, > P=C3=A1draig. > --001a11c3358ae84ff40509bbef88 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hello, Padraig -

Ho= w are you?

Can= you explain the behavior of diff(1) shown below?

With -U= 1 and -U2 , the= --ignore-matching-lines=3D'Id' argument suppresses display= of the difference between the 'Id' lines, as expected.
<= /div>

But with -U3,=C2=A0the diff of the '= ;Id' lines reappears, =C2=A0in spite of the=C2=A0--ignore-matc= hing-lines=3D'Id' argument.

Why is that?<= /div>

Thanks,
Todd Shandelman
Houston, Texas


##= ##########################################################

$ cat a
<= font face=3D"monospace">=C2=A0 #
=C2=A0 # ORIG: 2014-12-04 09:28:5= 6 CST Thu
=C2=A0 #
=C2=A0 # $Id: a,v 1.8 2014/12/04 15:29:99 todd Exp todd $
= =C2=A0 #
a
b
c
d
e

######= ######################################################

$ cat b
=C2=A0 #
=C2=A0 # ORIG: 2014-12-04 09:28:56 CST Thu
=C2=A0 #
=C2=A0 # $Id: a,v 1.8 2014/12/04 1= 5:29:27 todd Exp $
=C2=A0 = #
a
c
D
e

############################################################=

$ diff -v
diff (GNU diffutils) 2.8.1
Copyright (C) 2002 Free Software Foundation, Inc.

This pro= gram comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of this program
under the terms of the GNU General P= ublic License.
For more informati= on about these matters, see the file named COPYING.

Written b= y Paul Eggert, Mike Haertel, David Hayes,
Richard Stallman, and Len Tower.

=
############################################################
<= br>
$ diff -U1 =C2=A0 =C2=A0a b
--- a 2014= -12-08 16:07:05.974621828 -0600
+= ++ b 2014-12-08 16:07:09.= 693672957 -0600
@@ -3,8 +3,7 @@
=C2=A0 =C2=A0#
- =C2=A0= # $Id: a,v 1.8 2014/12/04 15:29:99 todd Exp todd $
+ =C2=A0# $Id= : a,v 1.8 2014/12/04 15:29:27 todd Exp $
=C2=A0 =C2=A0#
=C2=A0a
-b
=C2=A0c
-d
=
+D
= =C2=A0e

#############= ###############################################


$ = diff -U1 =C2=A0 --ignore-matching-lines=3D'Id'= =C2=A0 a b
--- a 2014-12-08 16:0= 7:05.974621828 -0600
+++ b 2014-1= 2-08 16:07:09.693672957 -0600
@@ = -6,5 +6,4 @@
=C2=A0a
=
-b
= =C2=A0c
-d
+D
=C2=A0e


############################################################=


$ diff -U2 = =C2=A0 --ignore-matching-= lines=3D'Id' =C2=A0 a b
--- a 2014-12-08 16:07:05.974621828 -0600
+++ b 2014-12-08 16:07:09.693672957 -0600
<= font face=3D"monospace">@@ -5,6 +5,5 @@
=C2=A0 =C2=A0#
=C2=A0a
-b
=C2=A0c
-d
<= div>+D
= =C2=A0e

#############################= ###############################

$ diff -U3 =C2=A0 --ign= ore-matching-lines=3D'Id' =C2=A0 a b
--- a 2014-12-08 16:07:05.974621828 -0600
+++ b 2014-12-08 16:07:09.693672957 -0600
@@ -1,10 +1,9 @@
=C2=A0 =C2=A0#
=C2=A0 =C2=A0# ORIG: 2014-12-04 09:28:56 CST Thu
=C2=A0 =C2=A0#
- =C2=A0# $Id: a,v 1.8 2014/12= /04 15:29:99 todd Exp todd $
+ =C2=A0# $Id: a,v 1.8 2014/12/04 1= 5:29:27 todd Exp $
=C2=A0 =C2=A0#=
=C2=A0a
-b
=C2=A0c
-d
+D
=C2=A0e

=C2=A0############################################################








On 9 December 2012 at 06:34, P=C3=A1draig Brady <P@drai= gbrady.com> wrote:
On 12/07/2012 08:23 PM, Todd Shandelman wrote:
Hi,=C2=A0 bug-co= reutils@gnu.org=C2=A0 -

Not quite a bug, but why does the same option, essentially, have two very different names in the 'expand' and 'unexpand'=C2=A0 utilit= ies?

This is confusing and hampers convenient usage.

I am referring to* --initial* in the one case and* --first-only* in the
other.

See below.

Or what am I missing?

Yes that is inconsistent.
Interestingly the POSIX defined expand and unexpand are inconsistent
in relation to this to start with.

unexpand only processes leading blanks by default, but
expand processes all blanks by default.

So unexpand needs the -a option to process all blanks,
and expand needs the -i, --initial option to process only leading blanks.
Given the above you might think that the --first-only option to unexpand is redundant.=C2=A0 However -a is implied by -t (as per POSIX), therefore to really limit to initial blanks, you need this option.

So as for naming.=C2=A0 I agree that --first-only is inconsistent.
It's also a bit ambiguous. Does it mean only the first tab is written,<= br> or all leading blanks are processed.=C2=A0 Now deprecating --first-only
for the more consistent --initial has some cost.=C2=A0 For example
it would break part of my FSlint program:
http://code.google.com/p/fslin= t/source/browse/trunk/fslint/supprt/rmlint/fix_ws.sh
Also, I see busybox copied --first-only into its unexpand implementation. But I guess to be forward looking --first-only should be deprecated
in favor of --initial?

thanks,
P=C3=A1draig.

--001a11c3358ae84ff40509bbef88-- From unknown Sun Jun 22 22:45:01 2025 X-Loop: help-debbugs@gnu.org Subject: bug#19319: ? Unexpected behavior in diff(1) Resent-From: Eric Blake Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Mon, 08 Dec 2014 23:20:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19319 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Todd Shandelman , P@draigbrady.com, 19319@debbugs.gnu.org Received: via spool by 19319-submit@debbugs.gnu.org id=B19319.141808078918325 (code B ref 19319); Mon, 08 Dec 2014 23:20:02 +0000 Received: (at 19319) by debbugs.gnu.org; 8 Dec 2014 23:19:49 +0000 Received: from localhost ([127.0.0.1]:58240 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xy7an-0004lV-2g for submit@debbugs.gnu.org; Mon, 08 Dec 2014 18:19:49 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53239) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xy7ak-0004lM-Cq for 19319@debbugs.gnu.org; Mon, 08 Dec 2014 18:19:47 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sB8NJeX8011554 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 8 Dec 2014 18:19:45 -0500 Received: from [10.3.113.52] (ovpn-113-52.phx2.redhat.com [10.3.113.52]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id sB8MkTaO006975; Mon, 8 Dec 2014 17:46:29 -0500 Message-ID: <54862A44.9000201@redhat.com> Date: Mon, 08 Dec 2014 15:46:28 -0700 From: Eric Blake Organization: Red Hat, Inc. User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 References: In-Reply-To: OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="VqW2f7s7mL7NXiCUusFaliKTdcO7mNLdv" X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --VqW2f7s7mL7NXiCUusFaliKTdcO7mNLdv Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 12/08/2014 03:27 PM, Todd Shandelman wrote: > With -U1 and -U2 , the --ignore-matching-lines=3D'Id' argument suppress= es > display of the difference between the 'Id' lines, as expected. At that (small) level of context, the hunk containing the 'Id' line is separate from the remaining hunks, so the hunk is omitted. >=20 > But with -U3, the diff of the 'Id' lines reappears, in spite of the > --ignore-matching-lines=3D'Id' > argument. >=20 > Why is that? As soon as you have enough context, the hunk for the 'Id' line is the SAME hunk as the rest of the changes. --ignore-matching-lines omits a hunk only if the entire hunk matches the regex; but as soon as you have other changes, then the entire hunk is output verbatim. --ignore-matching-lines does NOT ignore individual lines within a hunk, but only a hunk at a time. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --VqW2f7s7mL7NXiCUusFaliKTdcO7mNLdv Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg iQEcBAEBCAAGBQJUhipEAAoJEKeha0olJ0NqOvEIAKuNwWcwrYOrRt1e7xC+o9I/ jXvwMycbdntNUWWMowuba2hl6V3g36VKu2SNW489ydjsVD8h+FXZe7tvCPejaYEE Dov+/l0AmLlYkuqQbCEAgEibLtdw/qUeJYc6U4W+Kk9Qpg+JdbUqBJ3Bkt8NhNYr 6vOb4nVjayKuCTnxWA8EhyTsl+C1Zajifs9QRNwpE8m+F75M5rqggsc0BsHUo2mr C0kXH7cK2wb1OclAbHhHRzYi7ajhQhGL7DjsbwG617eyRKrt3gz58quosBLl5A6B FjXqTKF0dslhP4NHzZzsQlgdWrIv3ioYWHq/z+HQsFKpF11uBVGjnI1h76DN82E= =BtY5 -----END PGP SIGNATURE----- --VqW2f7s7mL7NXiCUusFaliKTdcO7mNLdv-- From unknown Sun Jun 22 22:45:01 2025 X-Loop: help-debbugs@gnu.org Subject: bug#19319: ? Unexpected behavior in diff(1) Resent-From: Todd Shandelman Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Mon, 08 Dec 2014 23:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19319 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Eric Blake Cc: 19319@debbugs.gnu.org, =?UTF-8?Q?P=C3=A1draig?= Brady Received: via spool by 19319-submit@debbugs.gnu.org id=B19319.141808264321349 (code B ref 19319); Mon, 08 Dec 2014 23:51:02 +0000 Received: (at 19319) by debbugs.gnu.org; 8 Dec 2014 23:50:43 +0000 Received: from localhost ([127.0.0.1]:58259 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xy84f-0005YG-Uy for submit@debbugs.gnu.org; Mon, 08 Dec 2014 18:50:42 -0500 Received: from mail-lb0-f175.google.com ([209.85.217.175]:32934) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xy84d-0005Y6-BL for 19319@debbugs.gnu.org; Mon, 08 Dec 2014 18:50:40 -0500 Received: by mail-lb0-f175.google.com with SMTP id u10so4501107lbd.20 for <19319@debbugs.gnu.org>; Mon, 08 Dec 2014 15:50:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=4k8kE4zLMhOWImj5dofbJVKSqyD22zRLxDKcQ0VlCbw=; b=Z2mpqWCjAIIY46S8iHCpIE64Iv9EgEHjyms+W2IUE1JxN9IcHIMkqznuRLKvfo4FYE pADW46+Fg6/WfNIYGSQYdN5mZMsurXkXNnS6d2+UsJdbPdfF6c6RX4M05DprkUZxKSni 6gHQuFBb6ZZRfxltfhse1+N4K4hcKnrq5UQnnXDzb6HkXHCGfj3ILePnoF71VWu7RLaT RMQZHOlRRXbblB4iQmS1cs6tpe+0j9I7t7DLkOJSwOzENE2UkqkA7wm7HJct92kZtgCh Fs8nUHMxUmP1DgaR6TfU2exULGy9+msgD3eGC77Y6nERFFctpM3wH2FLBFgzgGVFBr1I riqw== MIME-Version: 1.0 X-Received: by 10.112.234.201 with SMTP id ug9mr18734807lbc.79.1418082638466; Mon, 08 Dec 2014 15:50:38 -0800 (PST) Received: by 10.25.38.21 with HTTP; Mon, 8 Dec 2014 15:50:38 -0800 (PST) In-Reply-To: <54862A44.9000201@redhat.com> References: <54862A44.9000201@redhat.com> Date: Mon, 8 Dec 2014 17:50:38 -0600 Message-ID: From: Todd Shandelman Content-Type: multipart/alternative; boundary=001a11c3c832ed93160509bd1778 X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --001a11c3c832ed93160509bd1778 Content-Type: text/plain; charset=UTF-8 Thanks. Well, I must say that is all rather counter-intuitive. I never dreamed that the amount of context I select would actually affect the diff itself and how it is computed. But if you say so, I guess that is how it works. Todd On 8 December 2014 at 16:46, Eric Blake wrote: > On 12/08/2014 03:27 PM, Todd Shandelman wrote: > > With -U1 and -U2 , the --ignore-matching-lines='Id' argument suppresses > > display of the difference between the 'Id' lines, as expected. > > At that (small) level of context, the hunk containing the 'Id' line is > separate from the remaining hunks, so the hunk is omitted. > > > > > But with -U3, the diff of the 'Id' lines reappears, in spite of the > > --ignore-matching-lines='Id' > > argument. > > > > Why is that? > > As soon as you have enough context, the hunk for the 'Id' line is the > SAME hunk as the rest of the changes. --ignore-matching-lines omits a > hunk only if the entire hunk matches the regex; but as soon as you have > other changes, then the entire hunk is output verbatim. > > --ignore-matching-lines does NOT ignore individual lines within a hunk, > but only a hunk at a time. > > -- > Eric Blake eblake redhat com +1-919-301-3266 > Libvirt virtualization library http://libvirt.org > > --001a11c3c832ed93160509bd1778 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Thanks.
Well, I must say that is all rather counter-in= tuitive.
I never dreamed that the amount of context I select woul= d actually affect the diff itself and how it is computed.
But if = you say so, I guess that is how it works.
Todd

On 8 December 2014 at 16= :46, Eric Blake <eblake@redhat.com> wrote:
On 12/08/2014 03:27 PM, Todd Shandelman wrote:
> With -U1 and -U2 , the --ignore-matching-lines=3D'Id' argument= suppresses
> display of the difference between the 'Id' lines, as expected.=

At that (small) level of context, the hunk containing the 'Id' line= is
separate from the remaining hunks, so the hunk is omitted.

>
> But with -U3, the diff of the 'Id' lines reappears,=C2=A0 in s= pite of the
> --ignore-matching-lines=3D'Id'
> argument.
>
> Why is that?

As soon as you have enough context, the hunk for the 'Id' line is t= he
SAME hunk as the rest of the changes.=C2=A0 --ignore-matching-lines omits a=
hunk only if the entire hunk matches the regex; but as soon as you have
other changes, then the entire hunk is output verbatim.

--ignore-matching-lines does NOT ignore individual lines within a hunk,
but only a hunk at a time.

--
Eric Blake=C2=A0 =C2=A0eblake redhat com=C2=A0 =C2=A0 +1-919-301-3266
Libvirt virtualization library http://libvirt.org


--001a11c3c832ed93160509bd1778-- From unknown Sun Jun 22 22:45:01 2025 X-Loop: help-debbugs@gnu.org Subject: bug#19319: ? Unexpected behavior in diff(1) Resent-From: Eric Blake Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Tue, 09 Dec 2014 00:06:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19319 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Todd Shandelman Cc: 19319@debbugs.gnu.org, =?UTF-8?Q?P=C3=A1draig?= Brady Received: via spool by 19319-submit@debbugs.gnu.org id=B19319.141808350227970 (code B ref 19319); Tue, 09 Dec 2014 00:06:01 +0000 Received: (at 19319) by debbugs.gnu.org; 9 Dec 2014 00:05:02 +0000 Received: from localhost ([127.0.0.1]:58285 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xy8IX-0007Gs-BY for submit@debbugs.gnu.org; Mon, 08 Dec 2014 19:05:01 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41373) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xy8IU-0007GY-1Y for 19319@debbugs.gnu.org; Mon, 08 Dec 2014 19:04:59 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sB904uPv021524 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 8 Dec 2014 19:04:56 -0500 Received: from [10.3.113.52] (ovpn-113-52.phx2.redhat.com [10.3.113.52]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id sB904twe026998; Mon, 8 Dec 2014 19:04:56 -0500 Message-ID: <54863CA7.9000602@redhat.com> Date: Mon, 08 Dec 2014 17:04:55 -0700 From: Eric Blake Organization: Red Hat, Inc. User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 References: <54862A44.9000201@redhat.com> In-Reply-To: OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="551DDPxxSKUJb6CthLSvlFdmDBCg6WuXn" X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --551DDPxxSKUJb6CthLSvlFdmDBCg6WuXn Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 12/08/2014 04:50 PM, Todd Shandelman wrote: [please don't top-post on technical lists] > Thanks. > Well, I must say that is all rather counter-intuitive. > I never dreamed that the amount of context I select would actually affe= ct > the diff itself and how it is computed. The diff is computed the same way. All that --ignore-matching-lines changes is how the result is output, after the diff is already computed. If you think the algorithm should be changed, that is a matter for the diffutils mailing list; coreutils does not maintain diff(1), so complaining here won't change it (other than the tangential fact that many of the same developers hang out on both lists). On the other hand, there ARE cases where different diff algorithms can pick entirely different lines in a diff, but where both output forms are valid patches. If you are familiar with git, compare the Myers (greedy) vs. minimal vs. patience algorithms - they can produce DRASTICALLY different line counts and even hunk counts in the number of lines diff'd. If diff(1) were to learn multiple algorithms, the way git already has, then maybe it would be worth tweaking one or more of those algorithms to ignore input lines that match a regex prior to coming up with the final computed diff for output - but it's not necessarily going to be a trivial task to do that and still keep the diff'ing algorithm fas= t. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --551DDPxxSKUJb6CthLSvlFdmDBCg6WuXn Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg iQEcBAEBCAAGBQJUhjynAAoJEKeha0olJ0NqJ1wH/2s/kVbBavP/xggozsLuJ+Me Gq4QnBTUg2MyXw2qdP87TVSDFmfSkVn0z0iOD3bShUiyRpsM8mrmzx1i9fJVmkGh hp2vwDJrp/+0AKjXLdfYYRDCLPA4qOCvVq3s1taSDFivt8npoJZrJ4vzNmoyRF/r 2tum+fv+nifvkLPiqhgG7uwAr1sYTzo3IqpscrGazvOcKor/4JURyXyr/tNqSuOr FYYzf71rad5rL5DFnV9OVjzmRgCMc7wzxLjeNQrve0B21tMRIVwx/xaq18bOBPS6 IOwVnaxMoowCifRCtgZa1zjH+yjMzLSI+66uLZD8vlQHkmdRVxiBRvStSp4x7sY= =i49w -----END PGP SIGNATURE----- --551DDPxxSKUJb6CthLSvlFdmDBCg6WuXn-- From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 22 21:44:08 2018 Received: (at control) by debbugs.gnu.org; 23 Oct 2018 01:44:08 +0000 Received: from localhost ([127.0.0.1]:36562 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gEljr-0001mM-Sx for submit@debbugs.gnu.org; Mon, 22 Oct 2018 21:44:08 -0400 Received: from mail-io1-f42.google.com ([209.85.166.42]:33502) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gEljq-0001lT-HK for control@debbugs.gnu.org; Mon, 22 Oct 2018 21:44:06 -0400 Received: by mail-io1-f42.google.com with SMTP id l25-v6so28289076ioj.0 for ; Mon, 22 Oct 2018 18:44:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:message-id:date:user-agent:mime-version:content-language :content-transfer-encoding; bh=ckVYwikEYEswVgks4WfrYdtGFr7yTztJHsy4Rxk9jYo=; b=gZi8ephyGDWYurqbdZOH30Jnsh/+PLcrOEacGQMrqYc4NzSYpQs+U/DVevrzs10aTa eZ/soaXnEvfU+LfaZHUCqWgxKge2dUdNKph2sRE73pCXPLl+PzpHmjHp8yAac5PYwiAL A/h6rvp4zcU9MlTZaBgmhNHu7um55J56dEwggwFxMf7xCtLbd6mRlSdP3L57MM7znMlq UF029SclEVbm/ERHRXobUjwDDgiFqiiho+o4NRtyKVISmju1277mbaXPwvDYxWYcmvaK vQKjgS6cepTcYGcppa3haqoiOsukjIafwMiKkN5edF5KMfxSET7FlbZZiupgXx29z8KR glAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=ckVYwikEYEswVgks4WfrYdtGFr7yTztJHsy4Rxk9jYo=; b=YH4WFnE8WGRZZ6fYO7xdWYkz5AC1fho5fADCjWInBoLoklw3qmqgSUQv9h/8cR9N6Y 0PT2rUEkd8UCvgMfRWQsuyr1oqJoifk4hhxmDxVjhzsHqS0vAPNCs9XMy6CO2IQMhTuD V0sJXJJVLivVT/uD5UdFX79NmuaqbUwusNvA1z+C2wpb4hrIaa2a+njW75hlfmVzXevh aZfXBHmpio6rWKHtk4EQr6GOlKGnYbP0skQ5Wn0ZtNHFIQSlKHn2gcwrroPnsCk5skOy 0NY2WKkM2HhFeqfLtvM4vi5X+yusDcKtaf3hB/kYX8AkM+7U16ss5Qy0py+ognFxsC1R yCUQ== X-Gm-Message-State: AGRZ1gI4cLgVF3TUYTu7C0Kzijk6gkNvysF8lK8abAMOS3TxqpN1PVa8 A4yA0ILy8QU27lUaHvwsG2gX7QcB X-Google-Smtp-Source: AJdET5ca2GWzpu5th2jYbj2gwVguXmwUMmuAeqNd+c4isNBCQcM2oOcypzYmN/F5TWyF3BVb0GxlKg== X-Received: by 2002:a6b:b749:: with SMTP id h70-v6mr5677408iof.83.1540259040433; Mon, 22 Oct 2018 18:44:00 -0700 (PDT) Received: from tomato.housegordon.com (moose.housegordon.com. [184.68.105.38]) by smtp.googlemail.com with ESMTPSA id p185-v6sm5800itg.34.2018.10.22.18.43.59 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Oct 2018 18:43:59 -0700 (PDT) To: control@debbugs.gnu.org From: Assaf Gordon Message-ID: Date: Mon, 22 Oct 2018 19:43:58 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: 2.0 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: tags 19319 notabug close 19319 [...] Content analysis details: (2.0 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [209.85.166.42 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (assafgordon[at]gmail.com) -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.166.42 listed in wl.mailspike.net] 1.8 MISSING_SUBJECT Missing Subject: header 0.2 NO_SUBJECT Extra score for no subject X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) tags 19319 notabug close 19319