GNU bug report logs - #6060
24.0.50; Process filters can no longer kill buffers

Previous Next

Package: emacs;

Reported by: Helmut Eller <eller.helmut <at> gmail.com>

Date: Wed, 28 Apr 2010 14:59:02 UTC

Severity: normal

Found in version 24.0.50

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 6060 in the body.
You can then email your comments to 6060 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6060; Package emacs. (Wed, 28 Apr 2010 14:59:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Helmut Eller <eller.helmut <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 28 Apr 2010 14:59:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Helmut Eller <eller.helmut <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.0.50; Process filters can no longer kill buffers
Date: Wed, 28 Apr 2010 16:08:12 +0200
When GNU Emacs 24.0.50.7 (i686-pc-linux-gnu, GTK+ Version 2.12.12) of
2010-04-28 executes code like this:

(defun filter-test ()
  (let* ((proc (start-process 
                "test" nil "/bin/bash" "-c" 
                "for i in 1 2 3 4 ; do echo $i ; sleep 1 ; done"))
         (buffer (generate-new-buffer "test-buffer"))
         (filter (lambda (proc str)
                   (message "filter: %S" str)
                   (kill-buffer buffer))))
    (set-process-filter proc filter)
    (unwind-protect
        (with-current-buffer buffer
          (while (buffer-live-p buffer)
            (accept-process-output proc)))
      (kill-process proc))))

Emacs signals this error:  (error "Selecting deleted buffer")

This used to work in earlier versions of Emacs.
The problem was most likely introduced by:

2010-04-11  Stefan Monnier  <monnier <at> iro.umontreal.ca>

	* process.c (exec_sentinel): Preserve current-buffer.

	* process.c (read_process_output): Move the save-current-buffer to
	apply to both the filter and the non-filter branches.





Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6060; Package emacs. (Thu, 29 Apr 2010 14:32:03 GMT) Full text and rfc822 format available.

Message #8 received at 6060 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Helmut Eller <eller.helmut <at> gmail.com>
Cc: 6060 <at> debbugs.gnu.org
Subject: Re: bug#6060: 24.0.50; Process filters can no longer kill buffers
Date: Thu, 29 Apr 2010 10:31:46 -0400
> Emacs signals this error:  (error "Selecting deleted buffer")
[...]
> This used to work in earlier versions of Emacs.
> The problem was most likely introduced by:
[...]
> 	* process.c (exec_sentinel): Preserve current-buffer.
> 	* process.c (read_process_output): Move the save-current-buffer to
> 	apply to both the filter and the non-filter branches.

Indeed, thank you.  I believe the patch below has fixed this, can you confirm?


        Stefan


=== modified file 'src/process.c'
--- src/process.c	2010-04-13 02:07:48 +0000
+++ src/process.c	2010-04-29 14:17:52 +0000
@@ -5396,7 +5396,7 @@
   /* There's no good reason to let process filters change the current
      buffer, and many callers of accept-process-output, sit-for, and
      friends don't expect current-buffer to be changed from under them.  */
-  record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
+  record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ());
 
   /* Read and dispose of the process output.  */
   outstream = p->filter;
@@ -6814,7 +6814,7 @@
   /* There's no good reason to let sentinels change the current
      buffer, and many callers of accept-process-output, sit-for, and
      friends don't expect current-buffer to be changed from under them.  */
-  record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
+  record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ());
 
   sentinel = p->sentinel;
   if (NILP (sentinel))





Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6060; Package emacs. (Thu, 29 Apr 2010 16:02:02 GMT) Full text and rfc822 format available.

Message #11 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Helmut Eller <eller.helmut <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#6060: 24.0.50; Process filters can no longer kill buffers
Date: Thu, 29 Apr 2010 18:00:48 +0200
* Stefan Monnier [2010-04-29 16:31+0200] writes:

>> Emacs signals this error:  (error "Selecting deleted buffer")
> [...]
>> This used to work in earlier versions of Emacs.
>> The problem was most likely introduced by:
> [...]
>> 	* process.c (exec_sentinel): Preserve current-buffer.
>> 	* process.c (read_process_output): Move the save-current-buffer to
>> 	apply to both the filter and the non-filter branches.
>
> Indeed, thank you.  I believe the patch below has fixed this, can you confirm?

Yes, works. Thanks for the quick fix.

Helmut






Reply sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
You have taken responsibility. (Thu, 29 Apr 2010 23:13:02 GMT) Full text and rfc822 format available.

Notification sent to Helmut Eller <eller.helmut <at> gmail.com>:
bug acknowledged by developer. (Thu, 29 Apr 2010 23:13:02 GMT) Full text and rfc822 format available.

Message #16 received at 6060-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Helmut Eller <eller.helmut <at> gmail.com>
Subject: Re: bug#6060: 24.0.50; Process filters can no longer kill buffers
Date: Thu, 29 Apr 2010 18:52:39 -0400
> Yes, works. Thanks for the quick fix.

Thanks for confirming,


        Stefan




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 28 May 2010 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 15 years and 105 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.