From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#50096: args-out-of-range in redisplay_internal Date: Wed, 18 Aug 2021 10:42:23 +0300 Organization: LINKOV.NET Message-ID: <87im03tc6g.fsf@mail.linkov.net> References: <87r1esys1a.fsf@mail.linkov.net> <83v94456sn.fsf@gnu.org> <87h7foyo67.fsf@mail.linkov.net> <87im04x8mm.fsf@mail.linkov.net> <83sfz8543o.fsf@gnu.org> <874kbox736.fsf@mail.linkov.net> <83mtpf6hjb.fsf@gnu.org> <87eearx5tz.fsf@mail.linkov.net> <83k0kj6gmq.fsf@gnu.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="15797"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) Cc: 50096@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Aug 18 10:10:11 2021 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 1mGGeJ-0003w9-2n for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 18 Aug 2021 10:10:11 +0200 Original-Received: from localhost ([::1]:41810 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mGGeH-0000sK-9z for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 18 Aug 2021 04:10:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39586) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mGGeA-0000px-Ix for bug-gnu-emacs@gnu.org; Wed, 18 Aug 2021 04:10:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:43228) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mGGeA-00026v-Cf for bug-gnu-emacs@gnu.org; Wed, 18 Aug 2021 04:10:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mGGeA-0004RI-7J for bug-gnu-emacs@gnu.org; Wed, 18 Aug 2021 04:10:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 18 Aug 2021 08:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50096 X-GNU-PR-Package: emacs Original-Received: via spool by 50096-submit@debbugs.gnu.org id=B50096.162927419917051 (code B ref 50096); Wed, 18 Aug 2021 08:10:02 +0000 Original-Received: (at 50096) by debbugs.gnu.org; 18 Aug 2021 08:09:59 +0000 Original-Received: from localhost ([127.0.0.1]:54774 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mGGe7-0004Qx-5W for submit@debbugs.gnu.org; Wed, 18 Aug 2021 04:09:59 -0400 Original-Received: from relay1-d.mail.gandi.net ([217.70.183.193]:59611) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mGGe5-0004Qi-2x for 50096@debbugs.gnu.org; Wed, 18 Aug 2021 04:09:57 -0400 Original-Received: (Authenticated sender: juri@linkov.net) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id C9F54240009; Wed, 18 Aug 2021 08:09:49 +0000 (UTC) In-Reply-To: <83k0kj6gmq.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 17 Aug 2021 22:00:29 +0300") 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:212118 Archived-At: >> (gdb) xstring >> $8 = (struct Lisp_String *) 0x7f015341fb80 >> " *Minibuf-0*" > > Hm... something else is at work here. I don't understand how this is supposed to work. The buffer " *Minibuf-0*" is always empty at the time of calling message3_nolog, whereas the buffer " *Echo Area 0*" contains the message to display. The steps are following: 1. message3_nolog calls echo_area_display 2. echo_area_display calls redisplay_internal 3. redisplay_internal clears all matrices with clear_desired_matrices 4. redisplay_internal calls echo_area_display that temporarily changes mini_window's buffer from " *Minibuf-0*" to " *Echo Area 0*". This updates w->desired_matrix to contain information about " *Echo Area 0*" displayed in the mini_window. But unwind_with_echo_area_buffer immediately changes mini_window's buffer back to empty " *Minibuf-0*". 5. redisplay_internal calls hscroll_window_tree where cursor_row already contains information that was valid when " *Echo Area 0*" was temporarily displayed in mini_window: (gdb) l 14896 cursor_row = MATRIX_ROW (w->desired_matrix, w->cursor.vpos); (gdb) p *cursor_row ... start = { pos = { charpos = 1737, bytepos = 1737 }, ... end = { pos = { charpos = 2150, bytepos = 2150 These numbers are valid positions in " *Echo Area 0*" that was temporarily displayed in mini_window, but now mini_window's buffer is empty " *Minibuf-0*". >> PS: Some commit between e2eb58c487 and 31ab12e261 broke that, >> but maybe this is not important because these commits >> just changed the length of the git command by adding ":(literal)", >> and length change maybe exposed some other problem. > > You are saying that if you remove the ":(literal)" part without > changing anything else, the problem goes away? Indeed, it broke after the commit 3572613550. But after applying this patch it works again without errors: diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index ffe1e6832c..0bea987a06 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -950,7 +950,7 @@ vc-git-checkin (lambda (value) (when (equal value "yes") (list argument))))) ;; When operating on the whole tree, better pass "-a" than ".", since "." ;; fails when we're committing a merge. - (apply #'vc-git-command nil 0 (if only (vc-git--literal-pathspecs files)) + (apply #'vc-git-command nil 0 (if only files) (nconc (if msg-file (list "commit" "-F" (file-local-name msg-file)) (list "commit" "-m")) I guess additional ":(literal)" string increases the length of the displayed message, and longer message triggers the bug.