Subject: 24.2.91; accept-process-output hangs emacs on killed sub-process

From: Vitalie Spinu <[email-masked]>
Date: Thu, 17 Jan 2013 13:21:25 +0100

Hi, 

Accept-process-output, when run with WAIT argument, hangs emacs when the
underlying sub-process was killed. When WAIT is nil this problem does
not occur.

Start M-x shell and execute:

   (let ((proc (get-process "shell")))
     (process-send-string proc "sleep 60\n")
     (while (not (accept-process-output proc .01))))

This puts emacs in a loop as expected. Now kill the bash process from
outside emacs and you will see that emacs is still hanged.

This problem does not occur when WAIT argument is nil. For example on
the execution of the following code, emacs successfully exits the waiting
loop after the bash process has been killed:

   (let ((proc (get-process "shell")))
     (accept-process-output proc))

Thanks, 

    Vitalie

In GNU Emacs 24.2.91.1 (i686-pc-linux-gnu, GTK+ Version 2.24.13)
 of 2012-12-29 on vitoshka-home
Windowing system distributor `The X.Org Foundation', version 11.0.11300000
System Description:	Ubuntu 12.10

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
  semantic-minor-modes-format: ((:eval (if (or semantic-highlight-edits-mode semantic-show-unmatched-syntax-mode)  S)))
  global-semanticdb-minor-mode: t
  global-semantic-idle-scheduler-mode: t
  semantic-mode: t
  jabber-activity-mode: t
  TeX-PDF-mode: t
  sr-popviewer-mode: t
  global-auto-complete-mode: t
  auto-complete-mode: t
  diff-auto-refine-mode: t
  helm-match-plugin-mode: t
  shell-dirtrack-mode: t
  eldoc-mode: t
  recentf-mode: t
  show-paren-mode: t
  savehist-mode: t
  display-time-mode: t
  ido-everywhere: t
  global-auto-revert-mode: t
  global-subword-mode: t
  subword-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
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t
  hs-minor-mode: t

Recent input:
s s SPC " h <backspace> s h e l l C-f ) ) ) C-n <tab> 
C-n <tab> M-f M-f M-f M-f M-b M-d p r o c M-f M-b M-d 
. 0 0 1 <backspace> <backspace> 1 C-f <return> C-p 
C-f C-f C-e C-M-b <C-backspace> <backspace> SPC C-e 
) C-c t <return> <return> M-: M-p C-k C-y M-y C-p C-o 
C-x b s c <return> C-x C-e C-p C-n <tab> ) C-x C-e 
C-n C-p C-p <return> ( p r o c e s s - s e n d - s 
t <tab> SPC " C-b p r o c SPC <down-mouse-1> <mouse-1> 
b s <backspace> <backspace> C-b s l e e p SPC 3 0 \ 
n C-e ) C-n C-e C-x C-e C-p C-n C-o C-o <return> <return> 
C-o M-b M-b M-b M-b M-b C-b ( n o t SPC M-f C-h f <return> 
<down-mouse-5> <mouse-5> <down-mouse-5> <mouse-5> <down-mouse-4> 
<mouse-4> <down-mouse-1> <mouse-1> C-o C-o C-o <return> 
<return> C-o C-e ) C-x C-e C-p M-b M-b C-d 6 C-n C-p 
<backspace> 3 C-n C-e C-x C-e C-p M-b M-b C-d 6 C-p 
C-a C-SPC C-n C-n C-n M-w <return> C-o C-o C-o C-c 
t <return> <return> C-o C-y C-p C-p C-p M-f M-f C-n 
C-a C-k C-k M-f M-f C-f <M-backspace> <backspace> C-M-f 
C-b <M-backspace> <backspace> <backspace> M-m C-f M-f 
C-f <M-backspace> <backspace> C-M-f C-e <backspace> 
<backspace> C-M-b <tab> n <backspace> C-n <tab> C-e 
C-x C-e C-p C-p C-n C-n C-o C-o C-o <return> C-o C-p 
C-p C-p C-e C-p M-b M-b C-d 3 C-n C-e C-x C-e C-o C-o 
C-o C-c t <return> C-o C-x C-e C-o C-o C-o <return> 
C-c t C-o C-n C-n C-n C-x C-e C-p C-n C-n C-x 4 C-g 
M-x e <backspace> <backspace> r e p o r t <return>

Recent messages:
nil
Quit
Mark set [2 times]
nil
user-error: Current buffer has no process
let: Buffer *scratch* has no process
Quit
user-error: Current buffer has no process
nil
with-no-warnings: Text is read-only

Load-path shadows:
/home/vitoshka/Dropbox/ELPA/magit-20130112.1253/.dir-locals hides /home/vitoshka/Dropbox/ELPA/sunrise-commander-20130107.37/.dir-locals
/home/vitoshka/Dropbox/ELPA/magit-20130112.1253/.dir-locals hides ~/VC/gnus/.dir-locals
~/VC/gnus/lisp/lpath hides ~/VC/auctex/lpath
/home/vitoshka/Dropbox/ELPA/popup-20121020.1203/popup hides ~/VC/popup-el/popup
~/VC/gnus/lisp/format-spec hides /home/vitoshka/TVC/emacs/lisp/format-spec
~/VC/org-mode/lisp/ob-plantuml hides /home/vitoshka/TVC/emacs/lisp/org/ob-plantuml
~/VC/org-mode/lisp/org-gnus hides /home/vitoshka/TVC/emacs/lisp/org/org-gnus
~/VC/org-mode/lisp/ob-maxima hides /home/vitoshka/TVC/emacs/lisp/org/ob-maxima
~/VC/org-mode/lisp/ob-js hides /home/vitoshka/TVC/emacs/lisp/org/ob-js
~/VC/org-mode/lisp/org-footnote hides /home/vitoshka/TVC/emacs/lisp/org/org-footnote
~/VC/org-mode/lisp/org-mac-message hides /home/vitoshka/TVC/emacs/lisp/org/org-mac-message
~/VC/org-mode/lisp/ob-awk hides /home/vitoshka/TVC/emacs/lisp/org/ob-awk
~/VC/org-mode/lisp/org-wl hides /home/vitoshka/TVC/emacs/lisp/org/org-wl
~/VC/org-mode/lisp/ob-picolisp hides /home/vitoshka/TVC/emacs/lisp/org/ob-picolisp
~/VC/org-mode/lisp/org-protocol hides /home/vitoshka/TVC/emacs/lisp/org/org-protocol
~/VC/org-mode/lisp/ob-sh hides /home/vitoshka/TVC/emacs/lisp/org/ob-sh
~/VC/org-mode/lisp/org-exp hides /home/vitoshka/TVC/emacs/lisp/org/org-exp
~/VC/org-mode/lisp/ob-dot hides /home/vitoshka/TVC/emacs/lisp/org/ob-dot
~/VC/org-mode/lisp/org-archive hides /home/vitoshka/TVC/emacs/lisp/org/org-archive
~/VC/gnus/lisp/sasl hides /home/vitoshka/TVC/emacs/lisp/net/sasl
~/VC/gnus/lisp/gnus-bookmark hides /home/vitoshka/TVC/emacs/lisp/gnus/gnus-bookmark
~/VC/gnus/lisp/sieve-mode hides /home/vitoshka/TVC/emacs/lisp/gnus/sieve-mode
~/VC/gnus/lisp/gnus-setup hides /home/vitoshka/TVC/emacs/lisp/gnus/gnus-setup
~/VC/gnus/lisp/gnus-kill hides /home/vitoshka/TVC/emacs/lisp/gnus/gnus-kill
~/VC/gnus/lisp/yenc hides /home/vitoshka/TVC/emacs/lisp/gnus/yenc
~/VC/gnus/lisp/messcompat hides /home/vitoshka/TVC/emacs/lisp/gnus/messcompat
~/VC/gnus/lisp/nnml hides /home/vitoshka/TVC/emacs/lisp/gnus/nnml
~/VC/gnus/lisp/deuglify hides /home/vitoshka/TVC/emacs/lisp/gnus/deuglify
~/VC/gnus/lisp/mm-extern hides /home/vitoshka/TVC/emacs/lisp/gnus/mm-extern
~/VC/gnus/lisp/gnus-html hides /home/vitoshka/TVC/emacs/lisp/gnus/gnus-html
~/VC/gnus/lisp/nnweb hides /home/vitoshka/TVC/emacs/lisp/gnus/nnweb
~/VC/gnus/lisp/gnus-srvr hides /home/vitoshka/TVC/emacs/lisp/gnus/gnus-srvr
~/VC/gnus/lisp/pgg-gpg hides /home/vitoshka/TVC/emacs/lisp/obsolete/pgg-gpg
/home/vitoshka/Dropbox/ELPA/rebox2-20121113.2100/rebox2 hides /home/vitoshka/Dropbox/.emacs.d/site-lisp/rebox2/rebox2

Features:
(shadow emacsbug tabify cal-move rect image-file org-capture org-mks
org-archive cal-iso pcmpl-gnu tramp-cmds arc-mode archive-mode
pcmpl-unix two-column iso-transl tramp-sh gdb-mi bindat gud tramp-cache
semantic/imenu semantic/sb semantic/edit semantic/tag-write
semantic/bovine/make semantic/bovine/make-by semantic/tag-file
semantic/db-file data-debug cedet-files semantic/bovine/c
semantic/decorate/include semantic/decorate/mode semantic/decorate pulse
hideif semantic/db-find semantic/db-ref semantic/bovine/c-by
semantic/lex-spp semantic/bovine/gcc semantic/dep semantic/bovine
semantic/analyze semantic/sort semantic/scope semantic/analyze/fcn
semantic/db-mode semantic/db eieio-base semantic/idle semantic/format
semantic/tag-ls semantic/find semantic/ctxt semantic/util-modes
semantic/util semantic semantic/tag semantic/lex semantic/fw mode-local
cedet fuzzy cus-edit helm-imenu flow-fill help-mode bm dabbrev
rainbow-delimiters helm-mode helm-files image-dired helm-buffers
helm-elscreen helm-tags helm-bookmark helm-adaptative helm-info helm-net
helm-plugin helm-locate helm-help helm-external helm-grep grep
helm-regexp helm-utils make-mode yasnippet dropdown-list etags cc-langs
cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine
org-element misearch multi-isearch skeleton url-http url-auth url-gw
wdired mule-util goto-addr macros jabber-keepalive jabber-bookmarks
jabber-private jabber jabber-awesome jabber-osd jabber-wmii
jabber-xmessage jabber-festival jabber-sawfish jabber-ratpoison
jabber-screen jabber-socks5 jabber-ft-server jabber-si-server
jabber-ft-client jabber-ft-common jabber-si-client jabber-si-common
jabber-feature-neg jabber-truncate jabber-time jabber-autoaway
jabber-vcard-avatars jabber-chatstates jabber-events jabber-vcard
jabber-avatar jabber-activity jabber-watch jabber-modeline
jabber-ahc-presence jabber-ahc jabber-version jabber-ourversion
jabber-muc-nick-completion hippie-exp jabber-browse jabber-search
jabber-register jabber-roster jabber-presence jabber-muc jabber-newdisco
jabber-widget jabber-disco jabber-chat ewoc jabber-history
jabber-chatbuffer jabber-alert jabber-iq jabber-keymap jabber-core
jabber-sasl sasl sasl-anonymous sasl-login sasl-plain fsm jabber-logon
jabber-conn srv dns jabber-xml jabber-menu jabber-util debug view
magithub crm json magit-bisect magit-key-mode magit vc-git reftex-auc
ediff smex texmathp preview prv-emacs tex-buf zotelo font-latex latex
tex-style tex dbus xml latexenc shr nnfolder bbdb-message sendmail
flymake smiley gnus-cite mm-archive mail-extr gnus-async gnus-bcklg qp
gnus-ml gnus-topic utf-7 nndraft nnmh nnimap parse-time utf7 gnus-agent
gnus-srvr gnus-score score-mode nnvirtual gnus-cache bbdb-gnus bbdb-mua
bbdb-com netrc network-stream starttls tls gnus-notify gnus-demon nntp
bbdb timezone supercite regi nnir gnus-load gnus-msg gnus-art mm-uu
mml2015 epg-config mm-view mml-smime smime dig gnus-sum nnoo gnus-group
gnus-undo nnmail mail-source gnus-start gnus-spec gnus-int gnus-range
gnus-win message rfc822 mml mml-sec mm-decode mm-bodies mm-encode
mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mailabbrev gmm-utils
mailheader gnus gnus-ems gnus-compat url url-proxy url-privacy
url-expand url-methods url-history url-cookie url-domsuf mailcap
nnheader mail-utils url-util url-handlers reftex-dcr flyspell ispell
org-wl org-w3m org-vm org-rmail org-mhe org-mew org-irc org-jsinfo
org-infojs org-html org-info org-gnus org-docview org-bibtex bibtex
org-bbdb ffap url-parse url-vars sunrise-x-popviewer
sunrise-x-checkpoints bookmark sunrise-x-loop sunrise-x-tree
sunrise-commander term ehelp electric sort hl-line find-dired esh-var
esh-io esh-cmd esh-opt esh-ext esh-proc esh-arg esh-groups eshell
esh-util esh-module esh-mode disp-table enriched dired-x dired-aux
desktop ob-latex ob-R appt diary-lib diary-loaddefs org-clock org-exp
ob-exp org-agenda org ob-tangle ob-ref ob-lob ob-table org-footnote
org-src ob-comint ob-keys org-pcomplete org-list org-faces org-entities
noutline outline org-version ob-emacs-lisp ob org-compat org-macs
ob-eval org-loaddefs find-func cal-menu calendar cal-loaddefs iimage
pos-tip ac-octave octave-inf octave-mod ac-math auto-complete-config
auto-complete popup saveplace doc-view jka-compr image-mode reftex
reftex-vars reftex-cite preview-latex tex-site auto-loads info-look psvn
log-edit pcvs-util add-log diff-mode elp ediff-merg ediff-diff
ediff-wind ediff-mult ediff-help ediff-init ediff-util dired xquery-mode
generic rng-nxml rng-valid rng-loc rng-uri rng-parse nxml-parse
rng-match rng-dt rng-util rng-pttrn nxml-ns nxml-mode nxml-outln
nxml-rap nxml-util nxml-glyph nxml-enc xmltok smart-operator rx rebox2
slime-media slime-presentations slime-scratch slime-asdf slime-repl
slime derived pp hyperspec menu-bar+ helm-descbinds helm-match-plugin
helm warnings helm-config iflipb mic-paren adaptive-wrap-autoloads
bbdb-autoloads bm-autoloads bookmark+-autoloads edit-server-autoloads
eldoc-eval-autoloads esk-autoloads flex-isearch-autoloads
fuzzy-autoloads fuzzy-match-autoloads git-blame-autoloads helm-autoloads
helm-descbinds-autoloads htmlize-autoloads ido-load-library-autoloads
ido-ubiquitous-autoloads ido-yes-or-no-autoloads iflipb-autoloads
igrep-autoloads jabber-autoloads js2-mode-autoloads lacarte-autoloads
magit-gh-pulls-autoloads gh-autoloads logito-autoloads
magit-push-remote-autoloads magithub-autoloads magit-autoloads
markdown-mode+-autoloads markdown-mode-autoloads memory-usage-autoloads
mic-paren-autoloads minimap-autoloads oauth2-autoloads
persistent-soft-autoloads list-utils-autoloads pcache-autoloads
finder-inf popup-autoloads rainbow-delimiters-autoloads
rainbow-mode-autoloads rebox2-autoloads smex-autoloads stem-autoloads
sunrise-commander-autoloads synonyms-autoloads w3m-autoloads
zotelo-autoloads package tramp tramp-compat auth-source eieio byte-opt
bytecomp byte-compile cconv assoc gnus-util mm-util mail-prsvr
password-cache tramp-loaddefs format-spec ess-toolbar ess-mouse mouseme
thingatpt browse-url ess-menu ess-swv ess-noweb ess-noweb-font-lock-mode
ess-bugs-l essd-els ess-sas-d ess-sas-l ess-sas-a shell pcomplete
ess-arc-d ess-vst-d ess-xls-d ess-lsp-l ess-sta-d ess-sta-l cc-vars
cc-defs make-regexp ess-sp6-d ess-sp5-d ess-sp3-d ess-julia ess-r-d
ess-tracebug compile ess-roxy easy-mmode hideshow ess-help info reporter
ess-developer ess-r-args eldoc ess-s-l speedbar sb-image ezimage dframe
ess ess-inf comint ansi-color ring ess-mode ess-noweb-mode edmacro
kmacro ess-utils ess-custom ess-compat ess-site ibuf-ext ibuffer recentf
tree-widget wid-edit easymenu uniquify paren savehist time cus-start
cus-load solarized-dark-theme solarized imenu-anywhere cl-macs gv imenu
ido sh-script smie executable advice help-fns advice-preload autorevert
subword server cl cl-lib time-date tooltip ediff-hook vc-hooks
lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt
fringe tabulated-list newcomment lisp-mode register page menu-bar
rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax
facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak
czech european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces
cus-face macroexp files text-properties overlay sha1 md5 base64 format
env code-pages mule custom widget hashtable-print-readable backquote
make-network-process dbusbind dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs)