And here's the problem. Cygwin doesn't have TIOCSCTTY, and the only way
to make a terminal a controlling tty in Cygwin is to call open() on it,
which tcsh misses to do. Bash, however, calls open("/dev/tty", O_RDWR),
so bash doesn't have this problem.
Unfortunately, luit has no alternative way to make the new tty the
controlling tty. What we need is a patch like this in luit:
--- sys.c.ORIG 2009-10-05 19:23:58.000000000 +0200
+++ sys.c 2009-10-05 19:18:34.000000000 +0200
@@ -408,7 +408,11 @@ openTty(char *line)
int rc;
int tty = -1;
+#ifdef __CYGWIN__
+ tty = open(line, O_RDWR);
+#else
tty = open(line, O_RDWR | O_NOCTTY);
+#endif
This works fine for me with tcsh now as well. This patch is really
important, since not only tcsh is affected by this. If you call, for
instance, `xterm -e /bin/vim', vim works, but it has no controlling tty
either, as easily visible in `ps -e' output. So a patch to tcsh would
only fix this for tcsh, but not for any other application.
As for the Cygwin bug, it has to do with the return value of tcgetpgrp,
which appears to be incorrect in a couple of situations. I'm not
quite sure how to explain this, yet, nor if I really understood it.
I'll follow up on this later this week on the cygwin-developers list.
Yaakov, could you please generate a new luit package with the above
patch?