bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#5273: marked as done (23.1; format-alist encode vs write-region-post


From: Emacs bug Tracking System
Subject: bug#5273: marked as done (23.1; format-alist encode vs write-region-post-annotation-function)
Date: Sun, 10 Jan 2010 07:36:02 +0000

Your message dated Sun, 10 Jan 2010 01:31:00 -0500
with message-id <jwv3a2eiia3.fsf-monnier+emacs@gnu.org>
and subject line Re: bug#5273: 23.1; format-alist encode vs 
write-region-post-annotation-function
has caused the Emacs bug report #5273,
regarding 23.1; format-alist encode vs write-region-post-annotation-function
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact bug-gnu-emacs@gnu.org
immediately.)


-- 
5273: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=5273
Emacs Bug Tracking System
Contact bug-gnu-emacs@gnu.org with problems
--- Begin Message --- Subject: bug#5273: 23.1; format-alist encode vs write-region-post-annotation-function Date: Sun, 27 Dec 2009 11:17:04 +1100 User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.1 (gnu/linux)
In a format-alist "TO-FN" encode function, the buffer provided to that
function to operate on has write-region-post-annotation-function set to
`kill-buffer'.

This is extremely dangerous, and almost certainly incompatible with past
emacs, as it means any write-region done by the encode function will
kill the buffer it's operating on, causing it to then mangle some other
buffer, quite possibly with no indication that this happened.

A write-region in an encode function is likely if the function works by
putting data through an external program.


I struck this in three of my file formats where I use make-temp-file.
(Two for an error files for call-process-region, one because the program
needed an actual file to write to, not a pipe etc.)  Because
make-temp-file does its job by a writing an empty string to the new
file, it ran the kill-buffer from write-region-post-annotation-function.

I'm was unsure if make-temp-file ought to guard itself against this.  My
inclination is not.  There's an awful lot of read/write hooks and stuff,
and to set them so "write a string to a file" means "kill the current
buffer" is so unreasonable that there's no point anticipating it in one
particular place when so many things will be similarly affected.


I couldn't tell what that write-region-post-annotation-function is
trying to achieve.  If it's to kill the temporary buffer after writing
then an unwind-protect would sound far better, or at least apply the
kill setting only after running the format-alist encode func.


In GNU Emacs 23.1.1 (i486-pc-linux-gnu, GTK+ Version 2.16.5)
 of 2009-09-14 on raven, modified by Debian
configured using `configure  '--build=i486-linux-gnu' '--host=i486-linux-gnu' 
'--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' 
'--localstatedir=/var/lib' '--infodir=/usr/share/info' 
'--mandir=/usr/share/man' '--with-pop=yes' 
'--enable-locallisppath=/etc/emacs23:/etc/emacs:/usr/local/share/emacs/23.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.1/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/23.1/leim'
 '--with-x=yes' '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars' 
'build_alias=i486-linux-gnu' 'host_alias=i486-linux-gnu' 'CFLAGS=-DDEBIAN -g 
-O2' 'LDFLAGS=-g' 'CPPFLAGS=''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_AU
  value of $XMODIFIERS: nil
  locale-coding-system: iso-latin-1-unix
  default-enable-multibyte-characters: t



--- End Message ---
--- Begin Message --- Subject: Re: bug#5273: 23.1; format-alist encode vs write-region-post-annotation-function Date: Sun, 10 Jan 2010 01:31:00 -0500 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.91 (gnu/linux)
>>> Does the patch below help?
>> Yep.
> Thanks, installed.

I think this closes this bug,


        Stefan


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]