Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Thu, 8 Aug 2002 16:18:59 +0400 From: egor duda Reply-To: egor duda Organization: deo X-Priority: 3 (Normal) Message-ID: <168935202570.20020808161859@logos-m.ru> To: Laurent Pinchart CC: cygwin AT cygwin DOT com Subject: Re: OpenSSH and WinCVS in Windows 9x In-Reply-To: <200208081356.37427.laurent.pinchart@capflow.com> References: <20020806140534 DOT 757a155a DOT steven DOT obrien2 AT ntlworld DOT com> <200208081138 DOT 11412 DOT laurent DOT pinchart AT capflow DOT com> <124926316162 DOT 20020808135052 AT logos-m DOT ru> <200208081356 DOT 37427 DOT laurent DOT pinchart AT capflow DOT com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi! Thursday, 08 August, 2002 Laurent Pinchart laurent DOT pinchart AT capflow DOT com wrote: LP> WinCVS creates the ssh process by calling CreateProcess, which has stdin and LP> stdout redirected to pipes. The pipes are then converted to C file LP> descriptors, which in turn are converted to FILE pointers. Closing those LP> FILEs doesn't make ssh terminate. LP> I tried to modify the WinCVS code, and closed all the pipe handles right after LP> creating the child process (ssh). This doesn't make the child process LP> terminate. LP> I suppose that it is then a bug in OpenSSH/Cygwin. I'll try to investigate in LP> the OpenSSH sources. My guess is that OpenSSH calls select() on the standard LP> input, and fails to detect that the pipe has been closed. Once again, this LP> only occurs in Win98, not in Win2k. Cygwin uses the following code to periodically probe pipe status: (file select.cc) static int peek_pipe (select_record *s, bool from_select) ... else if (!PeekNamedPipe (h, NULL, 0, NULL, (DWORD *) &n, NULL)) { select_printf ("%s, PeekNamedPipe failed, %E", fh->get_name ()); n = -1; } ... Peeking into pipe for zero bytes is quite unusual, so win98 may return something wrong here. You can probably attach with a debugger or strace to running ssh instance and look what's going on. Maybe we'd have to probe for at least 1 byte here. Or maybe use some totally different approach to detect if peer's end of pipe is closed. I vaguely remember some problems with PeekNamedPipe from times when i patched tty stuff, but they were somewhat different. LP> I'm not very familiar with pipes on windows, so I'd appreciate help on this LP> subject. Egor. mailto:deo AT logos-m DOT ru ICQ 5165414 FidoNet 2:5020/496.19 -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/