Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Date: Thu, 8 Aug 2002 16:18:59 +0400
From: egor duda <deo@logos-m.ru>
Reply-To: egor duda <cygwin@cygwin.com>
Organization: deo
X-Priority: 3 (Normal)
Message-ID: <168935202570.20020808161859@logos-m.ru>
To: Laurent Pinchart <laurent.pinchart@capflow.com>
CC: cygwin@cygwin.com
Subject: Re: OpenSSH and WinCVS in Windows 9x
In-Reply-To: <200208081356.37427.laurent.pinchart@capflow.com>
References: <20020806140534.757a155a.steven.obrien2@ntlworld.com>
 <200208081138.11412.laurent.pinchart@capflow.com>
 <124926316162.20020808135052@logos-m.ru>
 <200208081356.37427.laurent.pinchart@capflow.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hi!

Thursday, 08 August, 2002 Laurent Pinchart laurent.pinchart@capflow.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@logos-m.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/

