From unknown Sun Jun 15 09:00:44 2025 X-Loop: help-debbugs@gnu.org Subject: bug#39868: Fix for diff -ZE behaviour Resent-From: felix Original-Sender: "Debbugs-submit" Resent-CC: bug-diffutils@gnu.org Resent-Date: Mon, 02 Mar 2020 15:38:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 39868 X-GNU-PR-Package: diffutils X-GNU-PR-Keywords: To: 39868@debbugs.gnu.org X-Debbugs-Original-To: bug-diffutils@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.15831634411347 (code B ref -1); Mon, 02 Mar 2020 15:38:02 +0000 Received: (at submit) by debbugs.gnu.org; 2 Mar 2020 15:37:21 +0000 Received: from localhost ([127.0.0.1]:38285 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j8n8D-0000Lf-14 for submit@debbugs.gnu.org; Mon, 02 Mar 2020 10:37:21 -0500 Received: from lists.gnu.org ([209.51.188.17]:36611) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j8gSk-0007Cj-Tc for submit@debbugs.gnu.org; Mon, 02 Mar 2020 03:30:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38721) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j8gSj-0001QA-Ee for bug-diffutils@gnu.org; Mon, 02 Mar 2020 03:30:06 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_50,RCVD_IN_DNSWL_MED, URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j8gSi-0004rZ-B3 for bug-diffutils@gnu.org; Mon, 02 Mar 2020 03:30:05 -0500 Received: from mout02.posteo.de ([185.67.36.66]:60513) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j8gSh-0004oa-Ro for bug-diffutils@gnu.org; Mon, 02 Mar 2020 03:30:04 -0500 Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id A8C292400E6 for ; Mon, 2 Mar 2020 09:30:00 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1583137800; bh=x9buwmUsIWuk9Ud8tfQRQjSbjjo6xJX3M03b83ZWbAE=; h=Date:From:Subject:To:From; b=JvBrSgkn0OqLHi9YMBhHfmWHrjx1gU4Ru62rEBV4/oFx9dQm3um/EogOVkswx7OVQ uVmOIOwMwNta507OpQihLFnkoPVDpf/phFVYbF7IqP/VnC5yWms6NXQYpzAtqetv4D pw9WEZqmP0rliS1ah6rZPwqmre7Cxfo3+zJp4UrT8R9W7NZlJ7wDNomHfH9FYHDoHr IeX99bcHmvZEyc0gRx4JDyB+xiUGzhNmH3/k/ga+EbnBSAcw8PhrH4k2+oOQDerjzj z5HbbQi4xxrYeIwl3589eiyC1WCVysoPXltpKaVTB16wjXOFpQBmBK0PNsDFP80TtM 8cIfg81tXpGxw== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 48WCxg6mv9z9rxS for ; Mon, 2 Mar 2020 09:29:59 +0100 (CET) Date: Mon, 02 Mar 2020 08:29:57 +0000 From: felix Message-Id: <1583137797.27773.0@posteo.de> X-Mailer: geary/3.34.2 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-l4wFZnEGAONGg3yIdadD" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 185.67.36.66 X-Spam-Score: 0.3 (/) X-Mailman-Approved-At: Mon, 02 Mar 2020 10:37:20 -0500 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: -0.7 (/) --=-l4wFZnEGAONGg3yIdadD Content-Type: text/plain; charset=windows-1251; format=flowed Content-Transfer-Encoding: quoted-printable Hello, While combing through a collection of files, I noticed that whenever I=20 called diff with both --ignore-trailing-space and=20 --ignore-tab-expansion, the latter option was seemingly ignored.=20 Initially I was worried that combining them was=92t supported at all,=20 even though the documentation suggested nothing of the sort. So I dug=20 into the source code to see whether this was a feature omission or a=20 bug. Half an hour later, I had a patch ready. Attached. I don=92t believe the patch needs copyright assignment, given that it=20 changes just two lines and adds one. Though I figure writing some tests=20 to cover this case is in order, which I did not do. =97f = --=-l4wFZnEGAONGg3yIdadD Content-Type: text/x-patch Content-Disposition: attachment; filename=ignore_tabs_and_trailing_spaces.patch Index: diffutils-3.7/src/util.c =================================================================== --- diffutils-3.7.orig/src/util.c +++ diffutils-3.7/src/util.c @@ -1074,7 +1074,7 @@ lines_differ (char const *s1, char const while ((c = *p) != '\n' && isspace (c)) ++p; if (c != '\n') - break; + goto not_eol; } if (c2 != '\n') { @@ -1082,11 +1082,12 @@ lines_differ (char const *s1, char const while ((c = *p) != '\n' && isspace (c)) ++p; if (c != '\n') - break; + goto not_eol; } /* Both lines have nothing but whitespace left. */ return false; } + not_eol: if (ignore_white_space == IGNORE_TRAILING_SPACE) break; FALLTHROUGH; --=-l4wFZnEGAONGg3yIdadD--