From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Robert Pluim Newsgroups: gmane.emacs.bugs Subject: bug#43297: 27.1; corrupts patch when diff-update-on-the-fly is set to nil Date: Fri, 16 Oct 2020 10:29:14 +0200 Message-ID: References: <87r1rag254.fsf@netris.org> <87y2k6oebn.fsf@gnus.org> <87sgaeodr1.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29254"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Mark H Weaver , 43297@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Oct 16 10:30:25 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kTL84-0007VM-Rt for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 16 Oct 2020 10:30:24 +0200 Original-Received: from localhost ([::1]:53750 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kTL83-0001YV-Td for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 16 Oct 2020 04:30:23 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54886) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kTL7k-0001XK-PG for bug-gnu-emacs@gnu.org; Fri, 16 Oct 2020 04:30:06 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46054) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kTL7j-0002dQ-MT for bug-gnu-emacs@gnu.org; Fri, 16 Oct 2020 04:30:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kTL7j-0005cn-II for bug-gnu-emacs@gnu.org; Fri, 16 Oct 2020 04:30:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Robert Pluim Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 16 Oct 2020 08:30:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43297 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: confirmed Original-Received: via spool by 43297-submit@debbugs.gnu.org id=B43297.160283696321474 (code B ref 43297); Fri, 16 Oct 2020 08:30:03 +0000 Original-Received: (at 43297) by debbugs.gnu.org; 16 Oct 2020 08:29:23 +0000 Original-Received: from localhost ([127.0.0.1]:57593 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kTL75-0005aI-C1 for submit@debbugs.gnu.org; Fri, 16 Oct 2020 04:29:23 -0400 Original-Received: from mail-wm1-f46.google.com ([209.85.128.46]:40471) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kTL74-0005a5-Fq for 43297@debbugs.gnu.org; Fri, 16 Oct 2020 04:29:22 -0400 Original-Received: by mail-wm1-f46.google.com with SMTP id k18so1895450wmj.5 for <43297@debbugs.gnu.org>; Fri, 16 Oct 2020 01:29:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :mime-version; bh=ctj/Bb87B11x7kQMjB2HtJXlT0NpxmTdE3I2wBtiXp8=; b=O4K9Hbxwb8JYdsB431XqIlamkYKuTikq/zQDjcco4rYoSLj03RycO47M0OBws+03yT Luz7QVElc4raM8EV2nG3WmiA8h1eg9gzUTjj4fEOZwzeM4dkKRCoDEscCyvPPB2HH5f7 xKDIR+MxvKrztlg5S4/YIv76eUeej6eIuj0jn4+ciwJ1cMRU6LLTfoiUAlf5c1eGDMU3 +fkRLoLFJUTIO39w6pLfzac8qz66t5GjtpP5ILpKP/D7I43C9pKPCIQc4lmNRtVgiTwV 2d6LjJpMh0T2yl8b8E+oxWXFdYTIfZqINZGYhqbdGItgyChKIKYqeksCpyxWJEU5TCzS Mppg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:mime-version; bh=ctj/Bb87B11x7kQMjB2HtJXlT0NpxmTdE3I2wBtiXp8=; b=DvbiLJqVGEmljTNEFXDFDaZetM4qAheGlSu7rv1PQ3fNCnByHkmniY/CTKZBA3ywvp TqxrSdOXAyeriAE7QYk5g0cbQmtVPiyXjA8phg6rhhaDSRnQd1a3Ebvh3PBzA8c56ITG isNWxPF+qkPgj4mGsMctSToKDa+NthQFNYgFLRA5AiPRdMaNf4zw/NJseivaDei5K6vX hpoOFqH82B6m3gUHoN0ytcdw7yQbSS5B8OWhruBZDajC+Pjp0l3Y82dlSnP08W8zzagr cu60WLpEYex2HfIWYgd247kd8QzB+zRUCQneKdPSk+LVjeYamlDtgPRfSvXSYyLcG2Eh d4NA== X-Gm-Message-State: AOAM533X+LehdjnxjGILqoEMColpYERVjmtW6NO8+Lhmr7UO/LJxBix+ QlW5leVhbJ0lAf7RkLdZlxQZ3NFU/h8= X-Google-Smtp-Source: ABdhPJynSPMxDQ+2yb+lfgO+ZpuAtcPvZLj44RvB5F2pileGmwypeSQ0TTz8Ti+yqOhl98HfNVG/2Q== X-Received: by 2002:a1c:bc05:: with SMTP id m5mr2818781wmf.68.1602836956343; Fri, 16 Oct 2020 01:29:16 -0700 (PDT) Original-Received: from rpluim-mac ([2a01:e34:ecfc:a860:9474:cfb2:b9a9:23d4]) by smtp.gmail.com with ESMTPSA id r3sm2475887wrm.51.2020.10.16.01.29.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Oct 2020 01:29:15 -0700 (PDT) In-Reply-To: <87sgaeodr1.fsf@gnus.org> (Lars Ingebrigtsen's message of "Fri, 16 Oct 2020 09:01:54 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:190670 Archived-At: >>>>> On Fri, 16 Oct 2020 09:01:54 +0200, Lars Ingebrigtsen said: Lars> Lars Ingebrigtsen writes: >> An easier way to reproduce this bug is to just load the example patch >> into a buffer and then eval-ing >> >> (diff-fixup-modifs (point-min) (point-max)) >> >> This shouldn't change the contents, but it does. Lars> Poking around in the code shows that it is indeed the signature that Lars> triggers the misbehaviour. It goes to the end of the buffer and then Lars> goes backward, line by line, and this is triggered: Lars> (pcase (char-after) Lars> (?\s (cl-incf space)) Lars> (?+ (cl-incf plus)) Lars> (?- (cl-incf minus)) Lars> Which makes it fix the line numbers in the hunk incorrectly. Lars> I'm not familiar with this code at all -- it seems to be written with Lars> the idea that there's just a patch in the current buffer, and nothing Lars> else. (At least at the end of the buffer.) And here's it's a patch in Lars> an email, so there's extra stuff. Lars> I don't see any obvious ways of fixing this... anybody got any ideas? Search backwards from end-of-buffer for "-- " and then narrow the buffer from (point-min) to there? Kind of hacky I guess, but otherwise you'll have to complicate the pcase. Robert --