From unknown Fri Jun 20 07:16:50 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#64485 <64485@debbugs.gnu.org> To: bug#64485 <64485@debbugs.gnu.org> Subject: Status: "diff -y" broken since yesterday Reply-To: bug#64485 <64485@debbugs.gnu.org> Date: Fri, 20 Jun 2025 14:16:50 +0000 retitle 64485 "diff -y" broken since yesterday reassign 64485 diffutils submitter 64485 Bruno Haible severity 64485 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Jul 05 13:30:44 2023 Received: (at submit) by debbugs.gnu.org; 5 Jul 2023 17:30:44 +0000 Received: from localhost ([127.0.0.1]:38908 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qH6Kx-0006fQ-LK for submit@debbugs.gnu.org; Wed, 05 Jul 2023 13:30:43 -0400 Received: from lists.gnu.org ([209.51.188.17]:59620) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qH6Kv-0006bN-PT for submit@debbugs.gnu.org; Wed, 05 Jul 2023 13:30:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qH6Ks-0004jQ-AA for bug-diffutils@gnu.org; Wed, 05 Jul 2023 13:30:38 -0400 Received: from mo4-p00-ob.smtp.rzone.de ([81.169.146.160]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qH6Kq-0005wj-5a for bug-diffutils@gnu.org; Wed, 05 Jul 2023 13:30:38 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1688578231; cv=none; d=strato.com; s=strato-dkim-0002; b=jqTlgMj2DdcTTWXrUe7nLjWrZtfUF0JrGKJ2vIBXIBxo3yaEeN6Cfc4kVphN/yVW+a WUD0Hsgpu3FKlJsKZgmAp+jVK5KuDkB+B+6HoNs4/PrgXpWg9AdFGMvdqC8ETDLTat9w kh2o7qQMQe7KgZtoj9pU/MEGvpkdGmBlIzxIJzHsiq6WRMOT+rSCqQA5ZXWqxKbwOHX/ P7P+BKpJCe6eHwi2lPAx29hc0K2O3q0MRrd2qRLVMkuJOvXRiojUfDIeaZBrJlVSaVqX CQEu+ciCnr++RQ5Xtgn/b7H+rqgAMCWv6dwQ2iYwljI73cANMPjFWZCpgGS56b1VrB6S rpnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1688578231; s=strato-dkim-0002; d=strato.com; h=Message-ID:Date:Subject:To:From:Cc:Date:From:Subject:Sender; bh=xbcKAcuU6bnb5TLn8/704LllFraxDdV1UHQUXLyumNs=; b=lBS8nsAwzgYS3cU22qw85dNCtxbZVR1QDBE0KB0gCs1C3Z5H4s2gNlBibRJ+5Gbu/M eIdLrf5sF/czPZKbTgg3UbLaI+faUCm6wyiNxPE64FVSQ/eOpK0/3yQP1XjGi0mb7AmC C/MnYVgEMagG/85qsj5+o4ms0nK/aNAqCDjX6XFxzHQ1KqvAJq0y4O72GIjnfV6VYhXw q6ywqBt1ZM40PrcaNrzpzLVOHCGhu/bVwFvy6VFCBofzJ6+vIYK3nnRzE1PEQkx2Irhj IrftTr0nAwepAYTw9y0OFGgoeGwF1tICF08jEG+TIiS8/+R5diUS/+db9THPopSGqva/ ilQg== ARC-Authentication-Results: i=1; strato.com; arc=none; dkim=none X-RZG-CLASS-ID: mo00 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1688578231; s=strato-dkim-0002; d=clisp.org; h=Message-ID:Date:Subject:To:From:Cc:Date:From:Subject:Sender; bh=xbcKAcuU6bnb5TLn8/704LllFraxDdV1UHQUXLyumNs=; b=gKZSFtkzXB7xFPdoyCJjv09boNBw+BuFyGDK0+mnOdtIwidHg8u3edylyUJlRZBula bNv0vTF6oVdtz4/7p2aRrXCR23VDuKLUx1PD5r/6oKhiO+fBS1BirBGgZIDvOSvJY6IM gAcQ4vlo0wd/80tgGIuZFzS/9q4gkd9PFVXMOIcKpFc7j9i/fXdTHj8QcA4iXG4ZzZ74 ag7mw8yw13sxjirUP51bDZ2+tqb/oPAZrx+nnRPvIak381sIHpnBZThKh1c/9V+r06r7 Om5j9EQX0kao7nDx+Ml3JSMWmGSOG20hw4cI6zGeLcrCTOMQDf1aablgKkdT3QR1n1BJ wZfw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1688578231; s=strato-dkim-0003; d=clisp.org; h=Message-ID:Date:Subject:To:From:Cc:Date:From:Subject:Sender; bh=xbcKAcuU6bnb5TLn8/704LllFraxDdV1UHQUXLyumNs=; b=2iH/0BL8rUrTadJoEb4+JBDyExGekDywr0RaTUb3lCEkRLBSoZFv9yFxQhcQbBr3UH vAgpvgXqgXytvosgf6CA== X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlIWs+iCP5vnk6shH0WWb0LN8XZoH94zq68+3cfpOSivat2tMpXbYDo/CgPzQqQq9haQ==" Received: from nimes.localnet by smtp.strato.de (RZmta 49.6.0 AUTH) with ESMTPSA id 6b0accz65HUV8yA (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Wed, 5 Jul 2023 19:30:31 +0200 (CEST) From: Bruno Haible To: bug-diffutils@gnu.org Subject: "diff -y" broken since yesterday Date: Wed, 05 Jul 2023 19:30:31 +0200 Message-ID: <2312350.ECZNHGQPT7@nimes> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart5785196.zQ0Gbyo6oJ" Content-Transfer-Encoding: 7Bit Received-SPF: none client-ip=81.169.146.160; envelope-from=bruno@clisp.org; helo=mo4-p00-ob.smtp.rzone.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: submit 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: -3.3 (---) This is a multi-part message in MIME format. --nextPart5785196.zQ0Gbyo6oJ Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Hi Paul, I'm trying to understand the meaning of 'in_position' and 'out_position' in function 'print_half_line'. While doing this, I spotted a bug: $ cat foo1.txt a ab abc $ cat foo2.txt ab abcd $ src/diff -t -y foo1.txt foo2.txt a < ab ab abc | abcd This is obviously not how it's intended to be. The attached patch fixes it. The cause is that in the case of a character of width 1, the assignment out_position = in_position; was lost in commit 05cdf3102ef3fb261db311a3e5d090fb63dbc792 (yesterday). With this patch, the result is again as it should be: $ src/diff -t -y foo1.txt foo2.txt a < ab ab abc | abcd The patch also improves comments in this function. So that next time, I (or anyone else) don't spent 30 minutes to understand the difference between 'in_position' and 'out_position'. Bruno --nextPart5785196.zQ0Gbyo6oJ Content-Disposition: attachment; filename="0001-diff-Fix-diff-y-output.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="0001-diff-Fix-diff-y-output.patch" >From 9826aa322e65815288ae63c3a0bb81c1c1267cd8 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Wed, 5 Jul 2023 19:26:52 +0200 Subject: [PATCH] diff: Fix "diff -y" output This fixes a regression from 2023-07-04. * src/side.c (print_half_line): Restore the assignment to out_position. --- src/side.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/side.c b/src/side.c index 8404c3a..49c7fe5 100644 --- a/src/side.c +++ b/src/side.c @@ -66,14 +66,19 @@ tab_from_to (intmax_t from, intmax_t to) } /* Print the text for half an sdiff line. This means truncate to - width observing tabs, and trim a trailing newline. Return the - last column written (not the number of chars). */ + OUT_BOUND columns, observing tabs, and trim a trailing newline. + Return the presumed column position on the output device after + the write (not the number of chars). */ static intmax_t print_half_line (char const *const *line, intmax_t indent, intmax_t out_bound) { FILE *out = outfile; + /* IN_POSITION is the current column position if we were outputting the + entire line, i.e. ignoring OUT_BOUND. */ intmax_t in_position = 0; + /* OUT_POSITION is the current column position. It stays <= OUT_BOUND + at any moment. */ intmax_t out_position = 0; char const *text_pointer = line[0]; char const *text_limit = line[1]; @@ -188,9 +193,14 @@ print_half_line (char const *const *line, intmax_t indent, intmax_t out_bound) case 'z': case '{': case '|': case '}': case '~': if (ckd_add (&in_position, in_position, 1)) return out_position; - FALLTHROUGH; + if (in_position <= out_bound) + { + out_position = in_position; + putc (c, out); + } + break; - /* Print width already handled. */ + /* Print width 0. */ case '\0': case '\f': case '\v': if (in_position <= out_bound) putc (c, out); -- 2.34.1 --nextPart5785196.zQ0Gbyo6oJ-- From debbugs-submit-bounces@debbugs.gnu.org Wed Jul 05 13:40:37 2023 Received: (at 64485-done) by debbugs.gnu.org; 5 Jul 2023 17:40:37 +0000 Received: from localhost ([127.0.0.1]:38920 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qH6UX-0007Nq-2k for submit@debbugs.gnu.org; Wed, 05 Jul 2023 13:40:37 -0400 Received: from mail.cs.ucla.edu ([131.179.128.66]:49096) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qH6UT-0007NY-2o for 64485-done@debbugs.gnu.org; Wed, 05 Jul 2023 13:40:35 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id C6B953C011BD8; Wed, 5 Jul 2023 10:40:26 -0700 (PDT) Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id iJSOvjis6kL8; Wed, 5 Jul 2023 10:40:26 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 7897E3C011BD9; Wed, 5 Jul 2023 10:40:26 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 7897E3C011BD9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1688578826; bh=KRzllEZo/EPiexQB48wBzI40g+yloPleOOw2gRVpvN8=; h=Message-ID:Date:MIME-Version:To:From; b=HXbnussCzIjq1J7LUne/camAd0sj7a4PNGYz7s8MI4r7PlbMsVdCiO3KXoSPQ9pFl kxx/5Bq4wboSwied2wDBHgbhUK0Cnf55jN7BnJTaQ10gFsnvEvm1Ep5ErNhljulWVS iP3Sst3TvRlICUIVHLfzNl/Twd+KQjK6yBesk2FxGSlstleZZwsYFVswldzs+P6c// FlbjyhxPm1BwGUZDnNy5RyUKSJ9HralVEqBxapf0pUKDBpckuUiA7ftYkw7JKaryuD sBBbFzIgiVN54pS00TMB2AgUcA+5bmN5VfaTkL5ZKunm2N9thTq+Ini+PsLs0xwKOS z3gwaRQuNKCnQ== X-Virus-Scanned: amavisd-new at mail.cs.ucla.edu Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id cLejHNMJ3i9k; Wed, 5 Jul 2023 10:40:26 -0700 (PDT) Received: from [192.168.1.9] (cpe-172-91-119-151.socal.res.rr.com [172.91.119.151]) by mail.cs.ucla.edu (Postfix) with ESMTPSA id 573173C011BD8; Wed, 5 Jul 2023 10:40:26 -0700 (PDT) Message-ID: Date: Wed, 5 Jul 2023 10:40:26 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [bug-diffutils] bug#64485: "diff -y" broken since yesterday To: Bruno Haible References: <2312350.ECZNHGQPT7@nimes> Content-Language: en-US From: Paul Eggert Organization: UCLA Computer Science Department In-Reply-To: <2312350.ECZNHGQPT7@nimes> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -1.1 (-) X-Debbugs-Envelope-To: 64485-done Cc: 64485-done@debbugs.gnu.org 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: -2.1 (--) Thanks, I installed that. From unknown Fri Jun 20 07:16:50 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 03 Aug 2023 11:24:08 +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