This is the mail archive of the cygwin-apps mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Cygwin Subprocesses on XEmacs


Hi Vin,


first of all, I haven't looked into the affected piece of code in Cygwin
for a long time, and it was never my domain, so bear with me.


On Jan 27 23:05, Vin Shelton wrote:
> I spent some time debugging M-x shell in XEmacs on 32-bit Cygwin.
> Here's what I found out.
> 
> In the child after fork() but before exec(), the setsid() call in
> disconnect_controlling_terminal() is causing the subprocess not to
> function after it gets spawned.

Can you define "not function" a bit more detailed?  Does no process work
at all, or do only processes requiring a tty not work?  For instance,
does something like an "echo foo > bar" still work?

> Here is a patch which works around the problem, enabling M-x shell to
> work for bash and zsh (at least):
> 
> diff -r 00f2705e2cb3 src/sysdep.c
> --- a/src/sysdep.c Mon Jan 26 08:53:07 2015 -0500
> +++ b/src/sysdep.c Tue Jan 27 22:15:16 2015 -0500
> @@ -1319,7 +1319,7 @@
>  void
>  disconnect_controlling_terminal (void)
>  {
> -#  ifdef HAVE_SETSID
> +#  if defined(HAVE_SETSID) && !defined(CYGWIN)
>    /* Controlling terminals are attached to a session.
>       Create a new session for us; it will have no controlling
>       terminal.  This also, of course, puts us in our own
> 
> 
> HOWEVER - I don't understand why this should be necessary.
> [...]
> Since Cygwin doesn't seem to have TIOCNOTTY, commenting out the
> setsid() call reduces disconnect_controlling_terminal to:
> 
> void
> disconnect_controlling_terminal (void)
> {
> # 1330 "sysdep.c"
>   setpgid (0, 0);
> # 1362 "sysdep.c"
> }
> 
> Incidentally, that setpgid() call causes bash to complain at startup:
> 
> bash: cannot set terminal process group (-1): Inappropriate ioctl for device
> bash: no job control in this shell
> 
> Thanks for any insight you can offer.

Hmm, not off the top of my head.  Is there a chance that you could
provide a simple, self contained testcase to reproduce the setsid
behaviour?  I think I have to debug that.


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

Attachment: pgpSRl9DbhY3G.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]