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

From: Filipp Gunbin <[email-masked]>
Date: Thu, 25 Oct 2018 18:51:17 +0300

On 24/10/2018 18:07 -0400, Thomas Fitzsimmons wrote:

> Hi Filipp,
[...]
> However, ttname's value on my system does correspond to the
> process-connection-type setting.

Yes, so in your case child process doesn't have controlling terminal,
while in my case it does.

process.c Line 2069:

  #ifdef DARWIN_OS
    /* Darwin doesn't let us run setsid after a vfork, so use fork when
       necessary.  Also, reset SIGCHLD handling after a vfork, as
       apparently macOS can mistakenly deliver SIGCHLD to the child.  */
    if (pty_flag)
      pid = fork ();
    else
      {
        pid = vfork ();
        if (pid == 0)
          signal (SIGCHLD, SIG_DFL);
      }
  #else
    pid = vfork ();
  #endif

With process-connection-type nil, we call vfork() and then setsid()
apparently fails (at least to reset child's controlling terminal).

I tried to change the above to just use fork(), and got the correct
behavior.

If only I knew how to fix this correctly, without reverting to fork()
:-) Does anyone have ideas?  I'll try to look into this further myself,
and will write back.

Filipp