Subject: bug#33050: 27.0.50; [macOS] Problem with process input with process-connection-type nil

From: Filipp Gunbin <[email-masked]>
Date: Mon, 15 Oct 2018 22:03:19 +0300

I was investigating why eudc-ldap hangs, and stripped the problem to the
following (did this in emacs -Q):

(let ((buf (get-buffer-create "my-process-buf")))
  (with-current-buffer buf
    (erase-buffer)
    (let* ((process-connection-type nil)
	   (proc (start-process "my-process" buf "/usr/bin/read" "-p" "enter something:")))
      (while (null (progn
		     (goto-char (point-min))
		     (re-search-forward "enter something:" (point-max) t)))
	(accept-process-output proc 1)
	(message "proc status: %s" (process-status proc)))
      (message "found prompt")
      (message "proc status: %s" (process-status proc))
      (process-send-string proc "asdf")
      (process-send-string proc "\n")
      (while (not (memq (process-status proc) '(exit signal)))
	(sit-for 0.1))
      (message "exited"))))

If I let-bind process-connection-type to t (use pty) in above code, then
it works normally:

*Messages* :
proc status: run
found prompt
proc status: run
exited
"exited"

Buffer "my-process-buf":
enter something:
Process my-process<2> finished

But if I let-bind process-connection-type to nil (so does ldap.el), then
it hangs, and after a few seconds wait and C-g, *Messages* has only
this: "proc status: run [6 times]", and buffer my-process-buf is empty.

This is emacs master built with ./configure CC=/usr/bin/gcc --without-x
--without-sound --with-ns --with-file-notification=no --with-gnutls
--with-json --with-modules --with-threads --with-xml2 && make

Also tried --without-threads - same behavior.

Thanks.

In GNU Emacs 27.0.50 (build 1, x86_64-apple-darwin17.7.0, NS appkit-1561.60 Version 10.13.6 (Build 17G65))
 of 2018-10-15 built on fgunbin.playteam.ru
Repository revision: 3d91dc1bb5aeecda786ebe1805c33d14c8bd89fa
System Description:  Mac OS X 10.13.6