From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#24358: 25.1.50; re-search-forward errors with "Variable binding depth exceeds max-specpdl-size" Date: Sun, 23 Oct 2016 21:06:56 +0300 Message-ID: <83pomrlz27.fsf@gnu.org> References: <87eg3rvtsf.fsf@users.sourceforge.net> <83k2dihpm9.fsf@gnu.org> <8760p2wzgj.fsf@users.sourceforge.net> <838ttyhhzu.fsf@gnu.org> <871szqwu51.fsf@users.sourceforge.net> <831szqhbc2.fsf@gnu.org> <87h98hujcx.fsf@users.sourceforge.net> <831szkahyz.fsf@gnu.org> <87eg3jvfj6.fsf@users.sourceforge.net> <8360ov8lbu.fsf@gnu.org> <877f95uj66.fsf@users.sourceforge.net> <83zim0vn1t.fsf@gnu.org> <874m48v7wj.fsf@users.sourceforge.net> <83insov1zr.fsf@gnu.org> <87zilztzd5.fsf@users.sourceforge.net> <83oa2ftnvp.fsf@gnu.org> <87wph2ts1a.fsf@users.sourceforge.net> <83oa2erx0k.fsf@gnu.org> <87lgxht8hp.fsf@users.sourceforge.net> <871sz8kq2v.fsf@gmail.com> <87shroroh8.fsf@users.sourceforge.net> <838ttfpnxt.fsf@gnu.org> <83vawjo21l.fsf@gnu.org> <83bmybnopx.fsf@gnu.org> <8360ojnk0n.fsf@gnu.org> <83twc3m198.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1477246102 22506 195.159.176.226 (23 Oct 2016 18:08:22 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 23 Oct 2016 18:08:22 +0000 (UTC) Cc: sam.halliday@gmail.com, 24358@debbugs.gnu.org To: npostavs@users.sourceforge.net Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Oct 23 20:08:18 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1byNBp-0004D4-W8 for geb-bug-gnu-emacs@m.gmane.org; Sun, 23 Oct 2016 20:08:10 +0200 Original-Received: from localhost ([::1]:41935 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1byNBr-0001pZ-8K for geb-bug-gnu-emacs@m.gmane.org; Sun, 23 Oct 2016 14:08:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52072) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1byNBl-0001pP-ME for bug-gnu-emacs@gnu.org; Sun, 23 Oct 2016 14:08:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1byNBi-0005zK-Gn for bug-gnu-emacs@gnu.org; Sun, 23 Oct 2016 14:08:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:34211) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1byNBi-0005z0-EH for bug-gnu-emacs@gnu.org; Sun, 23 Oct 2016 14:08:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1byNBi-0006AM-9e for bug-gnu-emacs@gnu.org; Sun, 23 Oct 2016 14:08:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 23 Oct 2016 18:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24358 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch fixed Original-Received: via spool by 24358-submit@debbugs.gnu.org id=B24358.147724603123640 (code B ref 24358); Sun, 23 Oct 2016 18:08:02 +0000 Original-Received: (at 24358) by debbugs.gnu.org; 23 Oct 2016 18:07:11 +0000 Original-Received: from localhost ([127.0.0.1]:49605 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1byNAt-00069E-71 for submit@debbugs.gnu.org; Sun, 23 Oct 2016 14:07:11 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:60841) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1byNAs-000690-32 for 24358@debbugs.gnu.org; Sun, 23 Oct 2016 14:07:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1byNAj-0005i3-Eq for 24358@debbugs.gnu.org; Sun, 23 Oct 2016 14:07:04 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:37109) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1byNAj-0005hz-BG; Sun, 23 Oct 2016 14:07:01 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:3262 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1byNAi-000539-9j; Sun, 23 Oct 2016 14:07:00 -0400 In-reply-to: <83twc3m198.fsf@gnu.org> (message from Eli Zaretskii on Sun, 23 Oct 2016 20:19:31 +0300) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:124922 Archived-At: Noam, I think we need these two changes, because otherwise looping more than once in search_buffer will fail to update the pointers passed to re_search_2, if buffer text was relocated inside re_search_2. Do you agree? diff --git a/src/search.c b/src/search.c index ec5a1d7..5c04916 100644 --- a/src/search.c +++ b/src/search.c @@ -1233,6 +1233,8 @@ search_buffer (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte, ? &search_regs : &search_regs_1), /* Don't allow match past current point */ pos_byte - BEGV_BYTE); + /* Update 'base' due to possible relocation inside re_search_2. */ + base = current_buffer->text->beg; if (val == -2) { matcher_overflow (); @@ -1279,6 +1281,8 @@ search_buffer (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte, (NILP (Vinhibit_changing_match_data) ? &search_regs : &search_regs_1), lim_byte - BEGV_BYTE); + /* Update 'base' due to possible relocation inside re_search_2. */ + base = current_buffer->text->beg; if (val == -2) { matcher_overflow ();