From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andrew Hyatt Newsgroups: gmane.emacs.bugs Subject: bug#5440: 23.1; buffer-file-format encoding temp buffers not reentrant Date: Mon, 25 Jul 2016 00:07:50 -0400 Message-ID: References: <87sk9z3vt2.fsf@blah.blah> <838twvysl2.fsf@gnu.org> <83twfft8ny.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1469419767 15139 80.91.229.3 (25 Jul 2016 04:09:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 25 Jul 2016 04:09:27 +0000 (UTC) Cc: 5440@debbugs.gnu.org, user42@zip.com.au To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jul 25 06:09:16 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bRXCd-0006fn-1M for geb-bug-gnu-emacs@m.gmane.org; Mon, 25 Jul 2016 06:09:15 +0200 Original-Received: from localhost ([::1]:58529 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bRXCb-0000D9-Nq for geb-bug-gnu-emacs@m.gmane.org; Mon, 25 Jul 2016 00:09:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48975) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bRXCV-0000Cq-C5 for bug-gnu-emacs@gnu.org; Mon, 25 Jul 2016 00:09:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bRXCR-0004ET-3u for bug-gnu-emacs@gnu.org; Mon, 25 Jul 2016 00:09:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:52120) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bRXCR-0004EC-0Y for bug-gnu-emacs@gnu.org; Mon, 25 Jul 2016 00:09:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bRXCQ-0000Ap-BV for bug-gnu-emacs@gnu.org; Mon, 25 Jul 2016 00:09:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Andrew Hyatt Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 25 Jul 2016 04:09:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 5440 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 5440-submit@debbugs.gnu.org id=B5440.1469419682587 (code B ref 5440); Mon, 25 Jul 2016 04:09:02 +0000 Original-Received: (at 5440) by debbugs.gnu.org; 25 Jul 2016 04:08:02 +0000 Original-Received: from localhost ([127.0.0.1]:36224 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bRXBR-00009K-PP for submit@debbugs.gnu.org; Mon, 25 Jul 2016 00:08:02 -0400 Original-Received: from mail-qt0-f180.google.com ([209.85.216.180]:35529) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bRXBQ-000093-CE for 5440@debbugs.gnu.org; Mon, 25 Jul 2016 00:08:00 -0400 Original-Received: by mail-qt0-f180.google.com with SMTP id x25so90860646qtx.2 for <5440@debbugs.gnu.org>; Sun, 24 Jul 2016 21:08:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=L0fNqMqys17/TOqlfQeYUFPFJL0qEyUfIUlbNibo4ks=; b=GQLcx4ts5OyI7BnlSQfhDlr5ivgGZTS0zGSNKgKeFb2SlIrNOEYTJaAx7sL63RVG/h VVUweZDgZ1B3ie5w3lDcR3l2Lc4rYGw2U3JNTSyjfrBaLpCbPHq2yzv5UoceOXfssjYJ Le5INBSY/4YkAjNgr/Fi7k/wp086tcr3ipDKdZOu0V0szOM0KPjpLkH8NU15hOwwCFjv /H+6OVFQPcjMCxo9ag+K2xBQ49ovhmJumB5yVVsA15HI9y03OfDmk5ejbSN2RaRQn7yC MevGbfT8uuT3Ky7vnfXsH6PiuzCtQ8HS4Mfp2Z9oTG0rYWR/Wy/+vZnGMV/xjDFRxT16 Znhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=L0fNqMqys17/TOqlfQeYUFPFJL0qEyUfIUlbNibo4ks=; b=S7KlXrAV1MgPnmPvb67AJB1FQZuJT51qK9UxhAzxgUSM931EK9VZ09E0u4iSLwrnO7 CMKTNTVSKNDcFMe7zlUupYBRIhBEkN5ey/Z2EfnnCEHk4/NSp68EJYyjKDw4AcZMefyJ co9usB2Cr6oQP2VvbPOX7EZhGcAP8/XuukD4d4RjyehiteEyM8hATGRJ7axIs3oggp85 jAHvQS52yeGzBjPmJ2lO0jeLBYiP2EXZa+JXvP1k9G7Cmr7Q+zr6mx5lbK5eoBJdOCfS 7arzOEgHIh1Hc4JYOtAZXZnmPCmmgZtWJ2XluU5nqzpfrv36H7kjPh4fqsVVpG3OeqfW zyuA== X-Gm-Message-State: AEkoout+wkzRkXXFwbqmPGuTa0ot2+WFvZQLBoQv1n+r9zkdws496rz8HFnpPgVmXSyIKw== X-Received: by 10.200.56.155 with SMTP id f27mr26147685qtc.26.1469419674820; Sun, 24 Jul 2016 21:07:54 -0700 (PDT) Original-Received: from Andrews-MacBook-Pro.local.ahyatt-laptop (cpe-74-73-128-199.nyc.res.rr.com. [74.73.128.199]) by smtp.gmail.com with ESMTPSA id j38sm14281514qtj.35.2016.07.24.21.07.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 24 Jul 2016 21:07:52 -0700 (PDT) In-Reply-To: <83twfft8ny.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 24 Jul 2016 17:25:37 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (darwin) 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:121507 Archived-At: --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> From: Andrew Hyatt >> Cc: user42@zip.com.au, 5440@debbugs.gnu.org >> Date: Sun, 24 Jul 2016 01:06:05 -0400 >> >> > -- Variable: format-alist >> > This list contains one format definition for each defined file >> > format. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >> > ^^^^^^ >> > >> > "Only one format definition per format." But I think it won't do any >> > harm to specifically warn about violating that. >> > >> > Thanks. >> >> I think the original bug report had one format definition for each >> defined file format, but was manipulating a file in one format while in >> another format function. > > That's more than one format in disguise. > >> How about I change the documentation to just warn not to manipulate >> other files in FROM-FN here? > > Can you show a proposed patch? > > Thanks. Attached. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Warn-against-unintentional-recursion-in-formatting.patch Content-Description: format-alist docs patch >From 18eb654c4541a49f415d4826974fd2c216f2c2db Mon Sep 17 00:00:00 2001 From: Andrew Hyatt Date: Sun, 24 Jul 2016 23:58:47 -0400 Subject: [PATCH] Warn against unintentional recursion in formatting. Change documentation for format-alist to warn against formatting when formatting, which leads to incorrect results.. --- doc/lispref/files.texi | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi index f3650a4..5763380 100644 --- a/doc/lispref/files.texi +++ b/doc/lispref/files.texi @@ -3238,7 +3238,9 @@ Format Conversion Round-Trip One responsibility of @var{from-fn} is to make sure that the beginning of the file no longer matches @var{regexp}. Otherwise it is likely to -get called again. +get called again. Also, @var{from-fn} must not involve other buffers or +files other than the one being decoded, or else formatting may happen +during formatting, leading to incorrect results. @item to-fn A shell command or function to encode data in this format---that is, to @@ -3269,6 +3271,10 @@ Format Conversion Round-Trip positions. All this takes place without modifying the buffer. @end itemize +@var{to-fn} must not involve other buffers or files other than the one +being encoded, or else formatting may happen during formatting, +leading to incorrect results. + @item modify A flag, @code{t} if the encoding function modifies the buffer, and @code{nil} if it works by returning a list of annotations. -- 2.4.9 (Apple Git-60) --=-=-=--