From unknown Tue Jun 17 01:25:42 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#18076 <18076@debbugs.gnu.org> To: bug#18076 <18076@debbugs.gnu.org> Subject: Status: Lines are not ignored by option -I if they are followed by a line with a difference Reply-To: bug#18076 <18076@debbugs.gnu.org> Date: Tue, 17 Jun 2025 08:25:42 +0000 retitle 18076 Lines are not ignored by option -I if they are followed by a = line with a difference reassign 18076 diffutils submitter 18076 Jean-Francois Thuong severity 18076 normal tag 18076 notabug thanks From debbugs-submit-bounces@debbugs.gnu.org Tue Jul 22 04:01:16 2014 Received: (at submit) by debbugs.gnu.org; 22 Jul 2014 08:01:16 +0000 Received: from localhost ([127.0.0.1]:34224 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1X9V0a-0003H3-58 for submit@debbugs.gnu.org; Tue, 22 Jul 2014 04:01:16 -0400 Received: from na3sys009aog109.obsmtp.com ([74.125.149.201]:41933) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1X9U3S-0001QS-Pn for submit@debbugs.gnu.org; Tue, 22 Jul 2014 03:00:09 -0400 Received: from mail-oa0-f51.google.com ([209.85.219.51]) (using TLSv1) by na3sys009aob109.postini.com ([74.125.148.12]) with SMTP ID DSNKU84L9G94Ht2BPjmZu+I9xQp6vkU3wiuo@postini.com; Tue, 22 Jul 2014 00:00:06 PDT Received: by mail-oa0-f51.google.com with SMTP id o6so9060253oag.38 for ; Tue, 22 Jul 2014 00:00:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to :content-type; bh=Mq+2iYMKA2NJPzvPgneLUlppTDG0q3wEkGkiddB5nDQ=; b=AQeixK7BdOuiKQ6s/Jh/+QICKl4XqvruJtRVjg308R7iDIQzcej1xf5kjCtuzWTCxE ugY0ZmNRorNWh29LTQGtqfJEw/rw0ZLihskl5I49vq84OGPGOWXmkBWUnG7cuoEw5yKn HxBC0qRnhgDqB/nejXkxzAW1xZeyqQvpiTZxvOhgHJ+61jVfLiEVLY2BArhQJmIO9Cds NHTWVYb6Qft6SSfwXfWtbiSeCa5Uo+aIx8iGgMCFqvYisSbc3N05T7N/tyFKu8edCK1H CvLVam6+Mwr2kPStxvqY2yTaoRx6SjcfF+n41QFbehI1vkvBK8gZCV/7Vi42cHzj9DHl 6g9A== X-Gm-Message-State: ALoCoQn2TQvMRYR4Dl/hHQNo+vNKcnpWD6W1CPI/mmCrA3S8UuymyxBSgdlAIrxcBXR1uTUf94WkzyXz7exZvQ2pe5i5xptAfcM33bc/scOnWwJHnJZV3I0D7dnFuwDWGTbxonT/glIH X-Received: by 10.60.179.114 with SMTP id df18mr44772891oec.76.1406012404280; Tue, 22 Jul 2014 00:00:04 -0700 (PDT) X-Received: by 10.60.179.114 with SMTP id df18mr44772865oec.76.1406012404093; Tue, 22 Jul 2014 00:00:04 -0700 (PDT) MIME-Version: 1.0 Received: by 10.182.130.197 with HTTP; Mon, 21 Jul 2014 23:59:43 -0700 (PDT) From: Jean-Francois Thuong Date: Tue, 22 Jul 2014 14:59:43 +0800 Message-ID: Subject: Lines are not ignored by option -I if they are followed by a line with a difference To: submit@debbugs.gnu.org Content-Type: multipart/mixed; boundary=089e011609b8e5791104fec2c539 X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Tue, 22 Jul 2014 04:01:09 -0400 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: -2.3 (--) --089e011609b8e5791104fec2c539 Content-Type: multipart/alternative; boundary=089e011609b8e5790d04fec2c537 --089e011609b8e5790d04fec2c537 Content-Type: text/plain; charset=UTF-8 Package: diffutils Version: 3.3 When 2 (or more) consecutive lines are different between the two compared files, they are ignored by option -I if all of them are ignored; if the last line is not ignored, all the lines are returned by diff tool (instead of only the last line). Although the documentation clearly indicates this as nominal, it looks strange while looking at the results to have lines that we supposed to have been ignored. ------------------ To reproduce: 1. Create 2 files (e.g. File1.txt and File2.txt) having 2 consecutive different lines (e.g. lines 2 and 3) 2. Run diff with option -I including a pattern matching line 2 3. Observe that diff returns differences for both lines 2 and 3 Note: the files attached could be used as an example with the command line diff -I "^IGNORE:.*quot; File1.txt File2.txt The difference is as follows: 2,3c2,3 < IGNORE: Line to be ignored with value = 1 < Different line (version A) --- > IGNORE: Line to be ignored with value = 2 > Different line (version B) Jean-Francois Thuong ------------------------------ [signature removed by request] --089e011609b8e5790d04fec2c537 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Package:=C2=A0diffutils
Version: 3= .3

When 2 (or more) consecutive lines are differen= t between the two compared files, they are ignored by option -I if all of t= hem are ignored; if the last line is not ignored, all the lines are returne= d by diff tool (instead of only the last line).

Although the documentation clearly indicates this= as nominal, it looks strange while looking at the results to have lines th= at we supposed to have been ignored.


------------------
To reproduce:
1. Create 2 files (e.g. File1.txt an= d File2.txt) having 2 consecutive different lines (e.g. lines 2 and 3)
2= . Run diff with option -I including a pattern matching line 2
3. Observe= that diff returns differences for both lines 2 and 3


Note: the files attached could be used as an example with the= command line
diff -I "^IGNORE:.*quot; File1.txt File2.txt The difference is as follows:
2,3c2,3
< IGNORE: Line to be ignored with value =3D 1
< Different line= (version A)
---
> IGNORE: Line to be ignored with value =3D 2
> Different line (version B)


[signature removed by request]
--089e011609b8e5790d04fec2c537-- --089e011609b8e5791104fec2c539 Content-Type: text/plain; charset=US-ASCII; name="File1.txt" Content-Disposition: attachment; filename="File1.txt" Content-Transfer-Encoding: base64 X-Attachment-Id: f_hxwvg4zu0 I0hFQURFUg0KSUdOT1JFOiBMaW5lIHRvIGJlIGlnbm9yZWQgd2l0aCB2YWx1ZSA9IDENCkRpZmZl cmVudCBsaW5lICh2ZXJzaW9uIEEpDQpTYW1lIGxpbmUNCklHTk9SRTogTGluZSBpZ25vcmVkIHdp dGggdmFsdWUgPSAzDQo= --089e011609b8e5791104fec2c539 Content-Type: text/plain; charset=US-ASCII; name="File2.txt" Content-Disposition: attachment; filename="File2.txt" Content-Transfer-Encoding: base64 X-Attachment-Id: f_hxwvg51j1 I0hFQURFUg0KSUdOT1JFOiBMaW5lIHRvIGJlIGlnbm9yZWQgd2l0aCB2YWx1ZSA9IDINCkRpZmZl cmVudCBsaW5lICh2ZXJzaW9uIEIpDQpTYW1lIGxpbmUNCklHTk9SRTogTGluZSBpZ25vcmVkIHdp dGggdmFsdWUgPSA0DQo= --089e011609b8e5791104fec2c539-- From debbugs-submit-bounces@debbugs.gnu.org Tue Jul 22 12:59:05 2014 Received: (at control) by debbugs.gnu.org; 22 Jul 2014 16:59:06 +0000 Received: from localhost ([127.0.0.1]:34831 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1X9dP7-0005Rk-EQ for submit@debbugs.gnu.org; Tue, 22 Jul 2014 12:59:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52396) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1X9dP3-0005R8-K5; Tue, 22 Jul 2014 12:59:03 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s6MGwwlH007361 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 22 Jul 2014 12:58:58 -0400 Received: from [10.3.113.59] (ovpn-113-59.phx2.redhat.com [10.3.113.59]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s6MGwwKX018174; Tue, 22 Jul 2014 12:58:58 -0400 Message-ID: <53CE9852.9090505@redhat.com> Date: Tue, 22 Jul 2014 10:58:58 -0600 From: Eric Blake Organization: Red Hat, Inc. User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: Jean-Francois Thuong , 18076-done@debbugs.gnu.org Subject: Re: [bug-diffutils] bug#18076: Lines are not ignored by option -I if they are followed by a line with a difference References: In-Reply-To: X-Enigmail-Version: 1.6 OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="XFQo7T7vaHXdtTThnoBdeUBVr7md8kgsv" X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: control 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) --XFQo7T7vaHXdtTThnoBdeUBVr7md8kgsv Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable tag 18076 notabug thanks On 07/22/2014 12:59 AM, Jean-Francois Thuong wrote: > To reproduce: > 1. Create 2 files (e.g. File1.txt and File2.txt) having 2 consecutive > different lines (e.g. lines 2 and 3) > 2. Run diff with option -I including a pattern matching line 2 > 3. Observe that diff returns differences for both lines 2 and 3 Thanks for the report. However, this is not a bug, but documented behavior. -I only suppresses entire hunks where EVERY difference in the hunk matches the regex. The mode of operation you are requesting, where diff ignores lines that match the regex prior to doing the comparison (although line numbers are then a bit off), can be accomplished via this trick in bash: patt=3D'^IGNORE:' diff <(sed "/$patt/d" File1.txt) <(sed "/$patt/d" File2.txt) Maybe it's worth a new option to diff to allow this mode of operation by default (and so that line numbers are still accurate); but -I cannot be changed semantics to match that new option. I'm closing this report as we are matching our documentation, although we can reopen it if someone is interested in writing a patch for such a new option. > *The information transmitted is intended only for the person or entity = to Sorry, but such disclaimers are unenforceable on publicly-archived mailing lists. You may want to consider sending from a personal account in the future, rather than slamming the list with your employer's legalese spam. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --XFQo7T7vaHXdtTThnoBdeUBVr7md8kgsv 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 Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJTzphSAAoJEKeha0olJ0Nq05sIAIpWika013tH/ZxFSqv4CQ2J NlsS79Hh8u0d7WO0QE0t1sF3Z70w+fGpVN9IAtFbBuK7efXr8CsLJQO5sBFz/q0A Z4Bvqme8LX1GZ9fCZ3Oe9jD0YPF800YYwHco9RwJmJozUDl1CqYDYBY1uf98i50t KvT75wW8VrgqSP2Px3qQNFsIdyMMhyQqvdeWbXDAtl8Y1sD8UOXMHo8xQh5svcBR qd3xoI/rnhhzoRAh9qP54uLyNbO2VNTbXqt1oqhf7pUnyaiD4kJ7W1GVkxLygFWa 77QYLCXpbKv4lZbl1x/j4S6+YfOuVGZrTBE7JTs7qEzxkPd+0vV4fyqpsS5az/o= =rmxD -----END PGP SIGNATURE----- --XFQo7T7vaHXdtTThnoBdeUBVr7md8kgsv-- From debbugs-submit-bounces@debbugs.gnu.org Wed Jul 23 03:53:18 2014 Received: (at 18076) by debbugs.gnu.org; 23 Jul 2014 07:53:18 +0000 Received: from localhost ([127.0.0.1]:35235 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1X9rMP-0003Fm-Be for submit@debbugs.gnu.org; Wed, 23 Jul 2014 03:53:18 -0400 Received: from na3sys009aog135.obsmtp.com ([74.125.149.84]:47749) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1X9rMI-0003FX-Ml for 18076@debbugs.gnu.org; Wed, 23 Jul 2014 03:53:12 -0400 Received: from mail-oa0-f41.google.com ([209.85.219.41]) (using TLSv1) by na3sys009aob135.postini.com ([74.125.148.12]) with SMTP ID DSNKU89p4Xp8ByEgeL+r1H48ZwGLgL50gsC3@postini.com; Wed, 23 Jul 2014 00:53:06 PDT Received: by mail-oa0-f41.google.com with SMTP id j17so1108114oag.14 for <18076@debbugs.gnu.org>; Wed, 23 Jul 2014 00:53:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=8YYmpD2ELAiqOsmhYT8j3jkJuXufgIG6QnS65mdo0so=; b=MJfTTY8bAKa/CneC2fxzJWgRMWiHugMxYNd/PerU891G1erHk9kRsYzrHbJhrtCpuf UXRtA3gXUMIPSUkjpGhKOj7pVhLflU66zr1brGd42Y3hbNE8QqNAm7n4QoyyYoy7fNu6 n9JC968OFxxItYmvD5atq8cJt0UDdUOHEVSoDbEpcb9+MHVP5JUACPQPdr/Q+Fxewv2I AFzLYHQW3mrR4rV6v0pCD5kC76Kdlxf2zvwoJ9WiNr3YpY5MaN+wkkrFFKEKObPVrmRI kYk3SFqm/Xdt3VXnddnxEhLSQzqDT+/jm9dZQK0II8QTHKwTlozI2QWneYFlvZv2eDWW C5cg== X-Gm-Message-State: ALoCoQntnvX8UyXeKtkoz6cck7PUrEk2HbVki5JcjAj3R7HktHv24bWbf+VGMfcp6kRmV96T56TFEcFHVGIPYK/WNRKMjpUN/AV76mKlKMzIkNtCymtY4hxQIpeC3UG2XpDFcU0M20K8 X-Received: by 10.182.52.197 with SMTP id v5mr24342032obo.85.1406101985020; Wed, 23 Jul 2014 00:53:05 -0700 (PDT) X-Received: by 10.182.52.197 with SMTP id v5mr24341907obo.85.1406101984209; Wed, 23 Jul 2014 00:53:04 -0700 (PDT) MIME-Version: 1.0 Received: by 10.182.130.197 with HTTP; Wed, 23 Jul 2014 00:52:44 -0700 (PDT) In-Reply-To: References: <53CE9852.9090505@redhat.com> From: Jean-Francois Thuong Date: Wed, 23 Jul 2014 15:52:44 +0800 Message-ID: Subject: Re: bug#18076: closed (Re: [bug-diffutils] bug#18076: Lines are not ignored by option -I if they are followed by a line with a difference) To: 18076@debbugs.gnu.org Content-Type: multipart/alternative; boundary=089e0158b0d8497dd404fed7a120 X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 18076 Cc: Jean-Francois Thuong 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: -2.3 (--) --089e0158b0d8497dd404fed7a120 Content-Type: text/plain; charset=UTF-8 Hello Eric, Thank you for the tweak using sed; I suppose a similar "grep" would work as well? May i enter a request for enhancement with a suggestion to add this new function enabling the filter of ignored lines from hunks containing differences? > *The information transmitted is intended only for the person or entity to > Sorry, but such disclaimers are unenforceable on publicly-archived > mailing lists. You may want to consider sending from a personal account > in the future, rather than slamming the list with your employer's > legalese spam. My bad. I unfortunately had to send the request from the company email because this bug report was part of our process of the qualification of GNU Diff 2.8.7. Jean-Francois Thuong On Wed, Jul 23, 2014 at 1:00 AM, GNU bug Tracking System < help-debbugs@gnu.org> wrote: > Your bug report > > #18076: Lines are not ignored by option -I if they are followed by a line > with a difference > > which was filed against the diffutils package, has been closed. > > The explanation is attached below, along with your original report. > If you require more details, please reply to 18076@debbugs.gnu.org. > > -- > 18076: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=18076 > GNU Bug Tracking System > Contact help-debbugs@gnu.org with problems > > > ---------- Forwarded message ---------- > From: Eric Blake > To: Jean-Francois Thuong , > 18076-done@debbugs.gnu.org > Cc: > Date: Tue, 22 Jul 2014 10:58:58 -0600 > Subject: Re: [bug-diffutils] bug#18076: Lines are not ignored by option -I > if they are followed by a line with a difference > tag 18076 notabug > thanks > > On 07/22/2014 12:59 AM, Jean-Francois Thuong wrote: > > > To reproduce: > > 1. Create 2 files (e.g. File1.txt and File2.txt) having 2 consecutive > > different lines (e.g. lines 2 and 3) > > 2. Run diff with option -I including a pattern matching line 2 > > 3. Observe that diff returns differences for both lines 2 and 3 > > Thanks for the report. However, this is not a bug, but documented > behavior. -I only suppresses entire hunks where EVERY difference in the > hunk matches the regex. > > The mode of operation you are requesting, where diff ignores lines that > match the regex prior to doing the comparison (although line numbers are > then a bit off), can be accomplished via this trick in bash: > > patt='^IGNORE:' > diff <(sed "/$patt/d" File1.txt) <(sed "/$patt/d" File2.txt) > > Maybe it's worth a new option to diff to allow this mode of operation by > default (and so that line numbers are still accurate); but -I cannot be > changed semantics to match that new option. > > I'm closing this report as we are matching our documentation, although > we can reopen it if someone is interested in writing a patch for such a > new option. > > > *The information transmitted is intended only for the person or entity to > > Sorry, but such disclaimers are unenforceable on publicly-archived > mailing lists. You may want to consider sending from a personal account > in the future, rather than slamming the list with your employer's > legalese spam. > > -- > Eric Blake eblake redhat com +1-919-301-3266 > Libvirt virtualization library http://libvirt.org > > > > ---------- Forwarded message ---------- > From: Jean-Francois Thuong > To: submit@debbugs.gnu.org > Cc: > Date: Tue, 22 Jul 2014 14:59:43 +0800 > Subject: Lines are not ignored by option -I if they are followed by a line > with a difference > Package: diffutils > Version: 3.3 > > When 2 (or more) consecutive lines are different between the two compared > files, they are ignored by option -I if all of them are ignored; if the > last line is not ignored, all the lines are returned by diff tool (instead > of only the last line). > > Although the documentation clearly indicates this as nominal, it looks > strange while looking at the results to have lines that we supposed to have > been ignored. > > > ------------------ > To reproduce: > 1. Create 2 files (e.g. File1.txt and File2.txt) having 2 consecutive > different lines (e.g. lines 2 and 3) > 2. Run diff with option -I including a pattern matching line 2 > 3. Observe that diff returns differences for both lines 2 and 3 > > > Note: the files attached could be used as an example with the command line > diff -I "^IGNORE:.*quot; File1.txt File2.txt > The difference is as follows: > 2,3c2,3 > < IGNORE: Line to be ignored with value = 1 > < Different line (version A) > --- > > IGNORE: Line to be ignored with value = 2 > > Different line (version B) > > --089e0158b0d8497dd404fed7a120 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hello Eric,

Thank you for the tweak usi= ng sed; I suppose a similar "grep" would work as well?
=
May i enter a request for enhancement with a suggestion to a= dd this new function enabling the filter of ignored lines from hunks contai= ning differences?



> *The = information transmitted is intended only for the person or entity to=
Sorry, but such disclaimers are unenforceable on publicly-archived
mailing lists. =C2=A0You may want to consider sending from a personal a= ccount
in the future, rather than slamming the list with your employer'= ;s
legalese spam.

My bad. I u= nfortunately had to send the request from the company email because this bu= g report was part of our process of the qualification of GNU Diff 2.8.7.

Jean-Francois Thuong

=C2=A0


On Wed, Jul 23, 2014 at 1:00 AM, GNU bug= Tracking System <help-debbugs@gnu.org> wrote:
Your bug report

#18076: Lines are not ignored by option -I if they are followed by a line w= ith a difference

which was filed against the diffutils package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 18076@debbugs.gnu.org.

--
18076: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D18076
GNU Bug Tracking System
Contact help-debbugs@gnu.org wi= th problems


---------- Forwarded message ----------
From:=C2= =A0Eric Blake <eblake@redhat.com>
To:=C2=A0Jean-Francois Thuong <
jean-francois.thuong@esterel-technologies.= com>, 18076-done@debbu= gs.gnu.org
Cc:=C2=A0
Date:=C2=A0Tue, 22 Jul 2014 10:58:58 -0600
Subject:=C2=A0Re= : [bug-diffutils] bug#18076: Lines are not ignored by option -I if they are= followed by a line with a difference
tag 18076 notabug
thanks

On 07/22/2014 12:59 AM, Jean-Francois Thuong wrote:

> To reproduce:
> 1. Create 2 files (e.g. File1.txt and File2.txt) having 2 consecutive<= br> > different lines (e.g. lines 2 and 3)
> 2. Run diff with option -I including a pattern matching line 2
> 3. Observe that diff returns differences for both lines 2 and 3

Thanks for the report. =C2=A0However, this is not a bug, but documented
behavior. =C2=A0-I only suppresses entire hunks where EVERY difference in t= he
hunk matches the regex.

The mode of operation you are requesting, where diff ignores lines that
match the regex prior to doing the comparison (although line numbers are then a bit off), can be accomplished via this trick in bash:

patt=3D'^IGNORE:'
diff <(sed "/$patt/d" File1.txt) <(sed "/$patt/d"= File2.txt)

Maybe it's worth a new option to diff to allow this mode of operation b= y
default (and so that line numbers are still accurate); but -I cannot be
changed semantics to match that new option.

I'm closing this report as we are matching our documentation, although<= br> we can reopen it if someone is interested in writing a patch for such a
new option.

> *The information transmitted is intended only for the person or entity= to

Sorry, but such disclaimers are unenforceable on publicly-archived
mailing lists. =C2=A0You may want to consider sending from a personal accou= nt
in the future, rather than slamming the list with your employer's
legalese spam.

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



---------- Forwarded message ----------
From:=C2=A0Jean-Francois= Thuong <jean-francois.thuong@esterel-technologies.com>
To:=C2=A0submit@debbugs.gnu.org
Cc:=C2=A0
Date:=C2=A0Tue, 22 Jul 2014 14:59:43 +0800
Subject:=C2=A0Li= nes are not ignored by option -I if they are followed by a line with a diff= erence
Package:=C2=A0diffutils
= Version: 3.3

When 2 (or more) consecutive lines are different betwee= n the two compared files, they are ignored by option -I if all of them are = ignored; if the last line is not ignored, all the lines are returned by dif= f tool (instead of only the last line).

Although the documentation clearly indicates this= as nominal, it looks strange while looking at the results to have lines th= at we supposed to have been ignored.


------------------
To reproduce:
1. Create 2 files (e.g. File1.txt an= d File2.txt) having 2 consecutive different lines (e.g. lines 2 and 3)
2= . Run diff with option -I including a pattern matching line 2
3. Observe= that diff returns differences for both lines 2 and 3


Note: the files attached could be used as an example with the= command line
diff -I "^IGNORE:.*quot; File1.txt File2.txt The difference is as follows:
2,3c2,3
< IGNORE: Line to be ignored with value =3D 1
< Different line= (version A)
---
> IGNORE: Line to be ignored with value =3D 2
> Different line (version B)

--089e0158b0d8497dd404fed7a120-- From unknown Tue Jun 17 01:25:42 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 20 Aug 2014 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator