From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: npostavs@users.sourceforge.net Newsgroups: gmane.emacs.bugs Subject: bug#24358: 25.1.50; re-search-forward errors with "Variable binding depth exceeds max-specpdl-size" Date: Mon, 24 Oct 2016 09:29:21 -0400 Message-ID: <87eg35swni.fsf@users.sourceforge.net> References: <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> <83pomrlz27.fsf@gnu.org> <83k2cynabi.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1477315795 9888 195.159.176.226 (24 Oct 2016 13:29:55 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 24 Oct 2016 13:29:55 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) Cc: sam.halliday@gmail.com, 24358@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Oct 24 15:29:51 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 1byfJP-0006es-Kg for geb-bug-gnu-emacs@m.gmane.org; Mon, 24 Oct 2016 15:29:11 +0200 Original-Received: from localhost ([::1]:46776 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1byfJR-0006Fw-SF for geb-bug-gnu-emacs@m.gmane.org; Mon, 24 Oct 2016 09:29:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41773) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1byfJK-0006Fo-Ns for bug-gnu-emacs@gnu.org; Mon, 24 Oct 2016 09:29:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1byfJG-0008WG-Mg for bug-gnu-emacs@gnu.org; Mon, 24 Oct 2016 09:29:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:37670) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1byfJG-0008W0-Ig for bug-gnu-emacs@gnu.org; Mon, 24 Oct 2016 09:29:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1byfJG-0006eU-7X for bug-gnu-emacs@gnu.org; Mon, 24 Oct 2016 09:29:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: npostavs@users.sourceforge.net Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 24 Oct 2016 13:29: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.147731573425553 (code B ref 24358); Mon, 24 Oct 2016 13:29:02 +0000 Original-Received: (at 24358) by debbugs.gnu.org; 24 Oct 2016 13:28:54 +0000 Original-Received: from localhost ([127.0.0.1]:53068 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1byfJ8-0006e4-L4 for submit@debbugs.gnu.org; Mon, 24 Oct 2016 09:28:54 -0400 Original-Received: from mail-qk0-f173.google.com ([209.85.220.173]:35199) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1byfJ3-0006dg-ND for 24358@debbugs.gnu.org; Mon, 24 Oct 2016 09:28:53 -0400 Original-Received: by mail-qk0-f173.google.com with SMTP id z190so237355704qkc.2 for <24358@debbugs.gnu.org>; Mon, 24 Oct 2016 06:28:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=JCFUHfgqOO9oX0vBYu4GJA95ajT2ZVVTcE/vStXYwGE=; b=NzDmcI1p1/0YWBwxETsyf2W52i9ty9tsY8laMG+eLvvbMNDKGvM13lzTR4kJBhXvf0 K9QEeLzWbY/W1lvRhu0tAsFt5s5tIoEGPTWhmAhppqOrXKR1qk1xocJJ3d5iNfbvr3kR HuNtt8n8ggfCvW1MwR1cs1O+ylq7Kxgghij7NF7nWNz4UW73O5Ikp8AlE0rsf+oa44up 6CqwcmFOQWEjPiCXUmPLtwkqkmeYhd3kNSk9H9Jzt84NfYsaz2rj6u5cNMvZMhuKL2jp tDhr6yEoAKcZoWUAy5TsX+AGIKQutZNuSZWnChvu0kDeeuWcQbzjPoSIUYRUpuSa22J5 7KTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=JCFUHfgqOO9oX0vBYu4GJA95ajT2ZVVTcE/vStXYwGE=; b=Bi5f+uh8hypaeendlWZrzOOpCo8dAIFayqu32xOnYE21ukUe3A8lESCqN7ncGDhW/O 2LTerVSBSWmKxCpCGfrjlHaCOOkKhIyyKfajRvcEzdM8sa6J7hneD1zOs1COf0FnBMkP DqVbsaHhr301ZrGCeLxxwCK3bhw9B1sqTkyo4YiN1kdSp6/rWytnZom7P9bcbzJoY4Nw A8Mz+53EMFJmT4Lr34w4dAktu7t2eHZBYoZS8X5hHq3XwL1gYiZqOKzdfACX4hWFByuj W2HW3s/0x8MNmnjLfTKCvhO9go3PVe2mCITURjXs8MTSbEbkVV5J3YmXcpmXKeDo+zFz 3Z3w== X-Gm-Message-State: ABUngvdhxXUrX2PaAYWWc9DeewNFnJI2nYy34owQVkDUfUhBLd0VV61hHtJ3+o736DaS9w== X-Received: by 10.107.31.78 with SMTP id f75mr12744047iof.141.1477315724143; Mon, 24 Oct 2016 06:28:44 -0700 (PDT) Original-Received: from zony ([45.2.7.130]) by smtp.googlemail.com with ESMTPSA id u62sm7329573iod.27.2016.10.24.06.28.42 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 24 Oct 2016 06:28:43 -0700 (PDT) In-Reply-To: <83k2cynabi.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 23 Oct 2016 22:18:25 +0300") 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:124951 Archived-At: I was able to reproduce the failure in ja-dic-cnv after removing --with-x-toolkit=lucid --without-toolkit-scroll-bars --with-gif=no --with-jpeg=no from my configure args (I guess using GTK changes the allocation patterns), and doing 'make extraclean'. The error went away after I updated to the latest emacs-25 commit: ee04aedc72 "Fix handling of buffer relocation in regex.c functions". The error occurs in the commit just before it 71ca4f6a "Avoid relocating buffers while libxml2 reads its text", so I think Eli's fix for the base pointer in search_buffer does solve the problem. Sam, can you confirm if this fixes it for you? Eli Zaretskii writes: >> From: Noam Postavsky >> Date: Sun, 23 Oct 2016 14:14:59 -0400 >> Cc: Sam Halliday , 24358@debbugs.gnu.org >> >> On Sun, Oct 23, 2016 at 2:06 PM, Eli Zaretskii wrote: >> > 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? >> >> Ack, yes! Missing the update to base was a total thinko on my part. > > Pushed. > > There might be a more serious problem with this, unfortunately: the > search registers are computed in regex.c using pointers into the C > strings that are being searched. The general paradigm is as in this > fragment: > > regstart[*p] = d; > [...] > regs->start[reg] = POINTER_TO_OFFSET (regstart[reg]); > > POINTER_TO_OFFSET assumes that the pointer in regstart[reg] is > consistent with the current base address of the string into which it > points. Did you study this aspect of regex.c when you decided which > values need to be affected by relocation? I did not look at that before, but looking now, I don't see why it would be a problem. I put the base address updating code around the only place where malloc may be called, so string1 and string2 (which POINTER_TO_OFFSET uses) should always be consistent with the base address (unless there is some other malloc call that I missed?).