[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#44642: 27.1; read-string does not signal on EOF after calling server
From: |
Chris Hunt |
Subject: |
bug#44642: 27.1; read-string does not signal on EOF after calling server-eval-at |
Date: |
Sat, 14 Nov 2020 11:46:42 -0500 |
Running the following shell script demonstrates the bug:
#+begin_src shell
#!/bin/sh
cd "$(mktemp -d)"
export RPC_SERVER_NAME="$PWD/emacs"
emacs --quick "--fg-daemon=$RPC_SERVER_NAME" >stdout.log 2>stderr.log &
sleep 1
cat <<EOF > script.el
(require 'server)
(setq command (read-string ""))
(message "Received '%s'" command)
(when (string= command "test")
(message "Sending request to server")
(let ((result (server-eval-at (getenv "RPC_SERVER_NAME") "hello from
server")))
(message "Response received from server '%s'" result)))
;; This should signal, since EOF.
(read-string "")
EOF
echo '[script] test 1'
echo notest | \
emacs --quick --batch --script "$PWD/script.el"
echo '[script] test 1 complete'
echo '[script] test 2'
echo test | \
emacs --quick --batch --script "$PWD/script.el"
echo '[script] test 2 complete'
#+end_src
Test 1 demonstrates the expected behavior, the second call to
`read-string' results
in an error and the non-daemon emacs process exits.
Test 2 demonstrates the bug. When `server-eval-at' is called, the
subsequent `read-string'
does not result in an error, and does not appear to return. The
non-daemon emacs process
does not exit.
On my machine, this outputs:
#+begin_src text
[script] test 1
Received ’notest’
Error reading from stdin
[script] test 1 complete
[script] test 2
Received ’test’
Sending request to server
Response received from server ’hello from server’
#+end_src
and hangs. According to `top', the non-daemon process is consuming
100% of a CPU core.
xbacktrace in gdb of the non-daemon emacs shows
#+begin_src text
"read-string" (0xb5783470)
"eval-buffer" (0xb5783660)
"load-with-code-conversion" (0xb5783928)
"load" (0xb5783c18)
"command-line-1" (0xb5784260)
"command-line" (0xb5784ac8)
"normal-top-level" (0xb5784e20)
#+end_src
Previously posted to https://emacs.stackexchange.com/q/61676/29147 and
https://lists.gnu.org/archive/html/help-gnu-emacs/2020-11/msg00405.html
In GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30)
of 2020-11-08 built on desktop
Windowing system distributor 'The X.Org Foundation', version 11.0.11906000
System Description: Ubuntu 18.04.5 LTS
Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Configured using:
'configure --prefix /home/chris/.local/evm/emacs-27.1 --without-gif'
Configured features:
XPM JPEG TIFF PNG SOUND DBUS GSETTINGS GLIB NOTIFY INOTIFY ACL
LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ XFT ZLIB TOOLKIT_SCROLL_BARS
GTK3 X11 XDBE XIM MODULES THREADS PDUMPER GMP
Important settings:
value of $LANG: en_US.UTF-8
locale-coding-system: utf-8-unix
Major mode: Lisp Interaction
Minor modes in effect:
tooltip-mode: t
global-eldoc-mode: t
eldoc-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
tool-bar-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
line-number-mode: t
transient-mark-mode: t
Load-path shadows:
None found.
Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
format-spec rfc822 mml easymenu mml-sec password-cache epa derived epg
epg-config gnus-util rmail rmail-loaddefs text-property-search time-date
subr-x seq byte-opt gv bytecomp byte-compile cconv mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs
cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils
tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode
lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch
timer select scroll-bar mouse jit-lock font-lock syntax facemenu
font-core term/tty-colors frame minibuffer cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote threads dbusbind
inotify dynamic-setting system-font-setting font-render-setting
move-toolbar gtk x-toolkit x multi-tty make-network-process emacs)
Memory information:
((conses 16 44962 7821)
(symbols 48 5981 1)
(strings 32 15464 1865)
(string-bytes 1 512027)
(vectors 16 10063)
(vector-slots 8 131781 12876)
(floats 8 19 27)
(intervals 56 187 0)
(buffers 1000 11))
- bug#44642: 27.1; read-string does not signal on EOF after calling server-eval-at,
Chris Hunt <=