From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Maus Subject: Bug: Infinite loop when escape replace string contains escape sequence it replaces [6.35trans] Date: Fri, 07 May 2010 18:03:20 +0200 Message-ID: <8739y3aed3.wl%dmaus@ictsoc.de> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: multipart/mixed; boundary="===============1443629207==" Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1OAQ22-0000xR-To for emacs-orgmode@gnu.org; Fri, 07 May 2010 12:04:07 -0400 Received: from [140.186.70.92] (port=34502 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OAQ1z-0000ur-Sv for emacs-orgmode@gnu.org; Fri, 07 May 2010 12:04:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OAQ1x-0008Ba-GF for emacs-orgmode@gnu.org; Fri, 07 May 2010 12:04:03 -0400 Received: from mysql1.xlhost.de ([213.202.242.106]:45620) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OAQ1v-0008AV-Kz for emacs-orgmode@gnu.org; Fri, 07 May 2010 12:04:00 -0400 Received: from localhost (localhost [127.0.0.1]) by mysql1.xlhost.de (Postfix) with ESMTP id 24C646FCEB for ; Fri, 7 May 2010 18:03:59 +0200 (CEST) Received: from mysql1.xlhost.de ([127.0.0.1]) by localhost (mysql1.xlhost.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hPSQVTkCwdzS for ; Fri, 7 May 2010 18:03:59 +0200 (CEST) Received: from t41.ictsoc.de (unknown [88.130.157.216]) by mysql1.xlhost.de (Postfix) with ESMTPSA id 948076FCE7 for ; Fri, 7 May 2010 18:03:58 +0200 (CEST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --===============1443629207== Content-Type: multipart/signed; boundary="pgp-sign-Multipart_Fri_May__7_18:03:20_2010-1"; protocol="application/pgp-signature" Content-Transfer-Encoding: 7bit --pgp-sign-Multipart_Fri_May__7_18:03:20_2010-1 Content-Type: multipart/mixed; boundary="Multipart_Fri_May__7_18:03:20_2010-1" --Multipart_Fri_May__7_18:03:20_2010-1 Content-Type: text/plain; charset=US-ASCII Remember to cover the basics, that is, what you expected to happen and what in fact did happen. You don't know how to make a good report? See http://orgmode.org/manual/Feedback.html#Feedback Your bug report will be posted to the Org-mode mailing list. ------------------------------------------------------------------------ Org enters an infinite loop when `org-replace-escapes' is called with a table containing a replace string that contains the escape sequence it should be replaced with. Example: ,---- | (org-replace-escapes "%m" '(("%m" . "87zl0qq1f3.wl%maus.david@gmail.com"))) `---- I stumpled upon when I tried to store a link to a internet message whose message id contained the sequence "%m" (perfectly valid for a message id) while using "%m" as message description. Attached patch fixes this by 1. detecting such 'self reference' and replacing the offending sequence in the replace string by a string with a text property that contains the original sequence 2. replacing occurences of substrings with this text property by the original sequence. HTH -- David Emacs : GNU Emacs 23.1.1 (i486-pc-linux-gnu, GTK+ Version 2.18.2) of 2009-11-02 on raven, modified by Debian Package: Org-mode version 6.35trans -- OpenPGP... 0x99ADB83B5A4478E6 Jabber.... dmjena@jabber.org Email..... dmaus@ictsoc.de --Multipart_Fri_May__7_18:03:20_2010-1 Content-Type: application/octet-stream; type=patch Content-Disposition: attachment; filename="fix-infinite-loop-esc-repl.diff" Content-Transfer-Encoding: base64 ZGlmZiAtLWdpdCBhL2xpc3AvQ2hhbmdlTG9nIGIvbGlzcC9DaGFuZ2VMb2cKaW5kZXggODhkNDc3 ZS4uOGQwZGFkYiAxMDA2NDQKLS0tIGEvbGlzcC9DaGFuZ2VMb2cKKysrIGIvbGlzcC9DaGFuZ2VM b2cKQEAgLTEsMyArMSw4IEBACisyMDEwLTA1LTA3ICBEYXZpZCBNYXVzICA8Z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ICAgIChsZXQgKChzcmVmIChnZXQtdGV4dC1wcm9wZXJ0eSBwY2hn ICdzcmVmIHN0cmluZykpKQorCSh3aGVuIChhbmQgc3JlZiAoc3RyaW5nLW1hdGNoICJTUkVGIiBz dHJpbmcgcGNoZykpCisJICAoc2V0cSBzdHJpbmcgKHJlcGxhY2UtbWF0Y2ggc3JlZiB0IHQgc3Ry aW5nKSkpKSkKICAgICBzdHJpbmcpKQogCi0KIChkZWZ1biBvcmctc3VibGlzdCAobGlzdCBzdGFy dCBlbmQpCiAgICJSZXR1cm4gYSBzZWN0aW9uIG9mIExJU1QsIGZyb20gU1RBUlQgdG8gRU5ELgog Q291bnRpbmcgc3RhcnRzIGF0IDEuIgo= --Multipart_Fri_May__7_18:03:20_2010-1-- --pgp-sign-Multipart_Fri_May__7_18:03:20_2010-1 Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iF4EABEIAAYFAkvkOcgACgkQma24O1pEeOZSygEAi2v5ieFnZf7ZmjnsjmSqVRkC OM0sNH9yWvc/rbfqFnkBAO2mVI2pFEJhH6FyjbPJ/IlCJEsgoLNFf3Z5r9RRmEAp =jX3Q -----END PGP SIGNATURE----- --pgp-sign-Multipart_Fri_May__7_18:03:20_2010-1-- --===============1443629207== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode --===============1443629207==--