unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stephen Berman <stephen.berman@gmx.net>
To: 53343@debbugs.gnu.org
Subject: bug#53343: 29.0.50; assertion failure in diff--iterate-hunks
Date: Tue, 18 Jan 2022 13:20:18 +0100	[thread overview]
Message-ID: <878rvdkzgd.fsf@gmx.net> (raw)
In-Reply-To: <87czkpl32e.fsf@gmx.net> (Stephen Berman's message of "Tue, 18 Jan 2022 12:02:17 +0100")

On Tue, 18 Jan 2022 12:02:17 +0100 Stephen Berman <stephen.berman@gmx.net> wrote:

> Trying to view in Gnus an attached and buttonized diff in a certain
> article raises an assertion failure.  To reproduce:
>
> 0. emacs -Q
> 1. M-x gnus
> 2. Type `y' at prompt
> 3. Type `B RET news.gmane.io RET'
> 4. Type `C-s gmane.emacs.bugs RET RET'
> 5. Type `1 RET' at prompt
> 6. Type `j' and enter `<87fspm0z47.fsf@stranik.org> RET' at the prompt
> 7. Click on the Options menu and check "Enter Debugger on Error"
> 8. Type `2 b'
> =>
> Debugger entered--Lisp error: (cl-assertion-failed ((looking-at diff-hunk-header-re) nil))
[...]
> The assertion fails when point is at the beginning of the last line in
> the following excerpt from the diff (in buffer " *temp*")
>
>   *** /var/home/janstranik/src/emacs-27.2/lib-src/ebrowse.c~	2021-01-28 11:52:16.000000000 -0600
>   --- /var/home/janstranik/src/emacs-27.2/lib-src/ebrowse.c	2021-09-24 09:31:49.136287028 -0500
>   ***************
>   *** 1924,1931 ****
>
> This happens because diff-beginning-of-hunk calls re-search-forward on
> diff-hunk-header-re, which puts point at the end the line "*** 1924,1931
> ****" and then calls (forward-line 0), putting point at the beginning of
> that line.  But then (looking-at diff-hunk-header-re) returns nil,
> raising the assertion in diff--iterate-hunks.  Replacing (forward-line
> 0) in diff-beginning-of-hunk with (forward-line -1) makes the assertion
> succeed.
>
> I'm not sure if this is a bug or if the diff is malformed.  But evidence
> that the diff is not malformed is that if the diff in the article is
> saved to a file (by typing `2 K o' in the *Summary* buffer), then
> visiting that file in diff-mode with -Q does not raise an assertion
> failure.

On the other hand, I get the assertion failure with the above recipe in
emacs-28 and emacs-27, and it seems unlikely that such a bug in
diff-mode would have gone unnoticed till now, so maybe the diff is
malformed.  (Though if so, why does the failure not happen when visiting
the file containing the diff?)

Steve Berman





  reply	other threads:[~2022-01-18 12:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-18 11:02 bug#53343: 29.0.50; assertion failure in diff--iterate-hunks Stephen Berman
2022-01-18 12:20 ` Stephen Berman [this message]
2022-01-21 11:07   ` Lars Ingebrigtsen
2022-01-21 13:29     ` Stephen Berman
2022-01-21 13:31       ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878rvdkzgd.fsf@gmx.net \
    --to=stephen.berman@gmx.net \
    --cc=53343@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).