zsh-workers
 help / color / mirror / code / Atom feed
* Fix for zpty under Cygwin
@ 2001-05-07 18:15 áÎÄÒÅÊ âÏÒÚÅÎËÏ×
  2001-05-07 19:47 ` Bart Schaefer
  2001-05-08 10:23 ` Peter Stephenson
  0 siblings, 2 replies; 5+ messages in thread
From: áÎÄÒÅÊ âÏÒÚÅÎËÏ× @ 2001-05-07 18:15 UTC (permalink / raw)
  To: zsh-workers

Our office connection was down today and I had some spare time to get a look 
at this problem. It turned out to be quite simple (as usual). The problem is 
this line in Src/Modules/zpty.c:

#if defined(__SVR4) || defined(sinix) || defined(__CYGWIN__)                   
.... 
static int
get_pty(int master, int *retfd)
{
.....
    if ((sfd = open(name, O_RDWR|O_NOCTTY)) < 0) {                             
 
It was O_NOCTTY. Looks like O_NOCTTY is "sticky" under Cygwin and prevents 
this tty from becoming ctty when dup()'ing it later. I do not remeber when it 
was put in, so there are two possibilities:

- we added this and that broke things
- at some point O_NOCTTY became sticky and that broke zpty
(unfortunately, my current connection is so slow I really cannot connect to 
Sourceforge CVS to check it).

So the fix under Cygwin is quite simple - just remove O_NOCTTY. Actually, I 
wonder what it does here at all - it is exactly the descriptor that *will* be 
ctty later. In case it may break on some system we can do it under ifdef 
__CYGWIN__ and then check again after 4.0.1 is out. I'd really like 4.0.1 to 
be as most feature complete on Cygwin as possible.

Related problem is testing. Completion tests consistently failed; the reason 
was this line in comptest:

zpty -b zsh "$comptest_zsh -f +Z" 

i.e. non-blocking mode. As a result the next read returned empty string and 
failed. I could not reproduce it in interactive shell, so I suspect some 
obscure scheduling issues here. Anyway, non-blocking mode looks wrong here to 
me. We cannot expect that the whole output will always be available when we 
try to read. In this case much more better would be read-with-timeout ... O.K. 
after 4.0.1 may be. With -b removed all completion tests passed under Cygwin.

Peter, could you test if above two changes work for you? In this case could 
you commit it (unfortunately, my CVS is in office and it looks like connection 
is gone for several days at least).                                           

I'll drop a line to cygwin list when I'm back again. I still consider 
stickyness of O_NOCTTY a bug ... any comments? 

-andrej

P.S. Could you please Cc me replies to this thread?


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2001-05-08 12:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-07 18:15 Fix for zpty under Cygwin áÎÄÒÅÊ âÏÒÚÅÎËÏ×
2001-05-07 19:47 ` Bart Schaefer
2001-05-08  4:08   ` Re[2]: " áÎÄÒÅÊ âÏÒÚÅÎËÏ×
2001-05-08 10:23 ` Peter Stephenson
2001-05-08 12:45   ` Andrej Borsenkow

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).