From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Uday S Reddy Newsgroups: gmane.emacs.bugs Subject: bug#5924: 23.1; accept-process-output switching current-buffer Date: Sat, 10 Apr 2010 22:23:57 +0100 Message-ID: <84mxxbknma.fsf@cs.bham.ac.uk> NNTP-Posting-Host: lo.gmane.org X-Trace: dough.gmane.org 1270935027 26104 80.91.229.12 (10 Apr 2010 21:30:27 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 10 Apr 2010 21:30:27 +0000 (UTC) Cc: U.S.Reddy@cs.bham.ac.uk To: 5924@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Apr 10 23:30:26 2010 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1O0iG1-0003vI-P2 for geb-bug-gnu-emacs@m.gmane.org; Sat, 10 Apr 2010 23:30:26 +0200 Original-Received: from localhost ([127.0.0.1]:41072 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O0iG0-0001i8-SL for geb-bug-gnu-emacs@m.gmane.org; Sat, 10 Apr 2010 17:30:24 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O0iEQ-0001N7-6N for bug-gnu-emacs@gnu.org; Sat, 10 Apr 2010 17:28:46 -0400 Original-Received: from [140.186.70.92] (port=38537 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O0iEO-0001MJ-FY for bug-gnu-emacs@gnu.org; Sat, 10 Apr 2010 17:28:45 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O0iEM-0003RT-4V for bug-gnu-emacs@gnu.org; Sat, 10 Apr 2010 17:28:44 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:36213) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O0iEM-0003RN-1N for bug-gnu-emacs@gnu.org; Sat, 10 Apr 2010 17:28:42 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1O0iAo-0004cm-F3; Sat, 10 Apr 2010 17:25:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Uday S Reddy Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 10 Apr 2010 21:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 5924 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.127093466017767 (code B ref -1); Sat, 10 Apr 2010 21:25:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 10 Apr 2010 21:24:20 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O0iA7-0004cW-LM for submit@debbugs.gnu.org; Sat, 10 Apr 2010 17:24:20 -0400 Original-Received: from mx10.gnu.org ([199.232.76.166]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O0iA5-0004cP-RT for submit@debbugs.gnu.org; Sat, 10 Apr 2010 17:24:18 -0400 Original-Received: from lists.gnu.org ([199.232.76.165]:40702) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1O0iA3-0003EL-V0 for submit@debbugs.gnu.org; Sat, 10 Apr 2010 17:24:16 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O0iA3-0000Qj-C1 for bug-gnu-emacs@gnu.org; Sat, 10 Apr 2010 17:24:15 -0400 Original-Received: from [140.186.70.92] (port=49252 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O0iA0-0000P8-V8 for bug-gnu-emacs@gnu.org; Sat, 10 Apr 2010 17:24:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O0i9z-0002yH-0B for bug-gnu-emacs@gnu.org; Sat, 10 Apr 2010 17:24:12 -0400 Original-Received: from sun60.bham.ac.uk ([147.188.128.137]:50373) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O0i9y-0002y1-Rm for bug-gnu-emacs@gnu.org; Sat, 10 Apr 2010 17:24:10 -0400 Original-Received: from [147.188.128.127] (helo=bham.ac.uk) by sun60.bham.ac.uk with esmtp (Exim 4.67) (envelope-from ) id 1O0i9v-0002HP-PI for bug-gnu-emacs@gnu.org; Sat, 10 Apr 2010 22:24:07 +0100 Original-Received: from mx1.cs.bham.ac.uk ([147.188.192.53]) by bham.ac.uk with esmtp (Exim 4.43) id 1O0i9v-0001F7-FP for bug-gnu-emacs@gnu.org; Sat, 10 Apr 2010 22:24:07 +0100 Original-Received: from gromit.cs.bham.ac.uk ([147.188.193.16] helo=MARUTI.cs.bham.ac.uk) by mx1.cs.bham.ac.uk with esmtp (Exim 4.51) id 1O0i9v-0002QC-Eb; Sat, 10 Apr 2010 22:24:07 +0100 X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Sat, 10 Apr 2010 17:25:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) 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: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:36175 Archived-At: Reading the elisp manual doesn't indicate anywhere that a call such as (accept-process-output process) should change the current-buffer. But it is happening. It led to some hairy asynchronous errors that took me an entire week to track down. Finally, I found an instance that was sort of reproducible, and tested it with a code fragment such as this: (let ((wait nil) (buffer-x (current-buffer))) ... (if (not (equal (current-buffer) buffer-x)) (debug nil wait)) (setq wait t) (accept-process-output process) (if (not (equal (current-buffer) buffer-x)) (debug nil wait)) (setq wait nil) ... ) If the debugger is entered with the argument 't' that means that the call to accept-process-output changed the 'current-buffer'. The following backtrace was obtained: Debugger entered: (t) vm-imap-read-object(#> t) vm-imap-read-object(#>) vm-imap-read-response(#>) vm-imap-read-response-and-verify(#> "FLAGS FETCH") vm-imap-get-message-data-list(#> 1 3672) vm-imap-retrieve-uid-and-flags-data() vm-imap-get-synchronization-data(t) vm-imap-synchronize-folder(t nil t t t t) vm-get-spooled-mail(t) vm-get-new-mail(nil) call-interactively(vm-get-new-mail nil nil) The full file containing the code, VM's IMAP client, is attached. The misbehaving accept-process-output call is in the vm-imap-read-object function. My theory of what happened here is as follows: VM ended an existing IMAP session (#) by sending a LOGOUT command, and created a new one (#>). While it was working with the second session, in the process-buffer, the server must have sent back some response to the first session, which would have been accepted during a call to accept-process-output. This caused the current-buffer to change to the process-buffer of the original session. I found the problem orignally in Emacs 22.2, but checking it with 23.1 shows that the problem is still present in the current version. Cheers, Uday ----- In GNU Emacs 23.1.1 (i386-mingw-nt5.1.2600) of 2009-07-30 on SOFT-MJASON Windowing system distributor `Microsoft Corp.', version 5.1.2600 configured using `configure --with-gcc (4.4)' 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: C.UTF-8 value of $XMODIFIERS: nil locale-coding-system: cp1252 default-enable-multibyte-characters: t Major mode: VM Summary Minor modes in effect: savehist-mode: t tooltip-mode: t mouse-wheel-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t global-auto-composition-mode: t auto-encryption-mode: t line-number-mode: t transient-mark-mode: t Recent input: g C-p C-p C-SPC C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-x C-k C-x C-f d : / g n u SPC v m SPC t r u SPC / SPC e m SPC b u SPC SPC SPC SPC - e m a c s 2 3 . t x t C-y C-x , C-x C-s C-h i m e l SPC SPC C-s p r o c e s s C-a m SPC m o u t p u t SPC SPC C-x b q C-x , q C-x u C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-k C-x C-s C-x b * B SPC q C-x m C-x k M-x v m r e p o r t - e m SPC SPC Recent messages: Composing main Info directory...done Mark saved where search started Mark set Undo! Saving file d:/gnu/vm/trunk/bug-accept-process-output-emacs23.txt... Wrote d:/gnu/vm/trunk/bug-accept-process-output-emacs23.txt Back to top level. Parsing d:/Home/udr/.mailrc... Parsing y:/dotfiles/.mailrc... done Parsing d:/Home/udr/.mailrc... done ------ [ATTACHMENT d:/gnu/vm/trunk23/lisp/vm-imap.el, text/plain]