delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/01/08/06:22:28

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Date: Mon, 8 Jan 2001 13:21:10 +0200
Message-Id: <200101081121.NAA25063@linux.>
From: "Ehud Karni" <ehud AT unix DOT simonwiesel DOT co DOT il>
To: wpd AT delcomsys DOT com
Subject: Re: Why does scp leave ssh running? -- select() never returns
CC: cygwin AT cygwin DOT com
In-reply-to: <3A57E0F0.3FE252BD@delcomsys.com> (message from Patrick Doyle on
Sat, 06 Jan 2001 22:22:24 -0500)
Organization: Simon & Wiesel Insurance agency
Reply-to: ehud AT unix DOT simonwiesel DOT co DOT il
References: <3A22C383 DOT 5C16BBC8 AT delcomsys DOT com> <3A25C7DA DOT 6F76C8DA AT delcomsys DOT com> <20001129224015 DOT B21867 AT redhat DOT com> <3A266130 DOT F5877EB5 AT delcomsys DOT com> <3A271DCD DOT 99BDDBF5 AT delcomsys DOT com> <20001202200832 DOT A18661 AT redhat DOT com> <3A29C260 DOT 1C491A30 AT delcomsys DOT com> <20001202233944 DOT A19867 AT redhat DOT com> <3A2A16B5 DOT E1C3F9F4 AT redhat DOT com> <3A351ADE DOT EF54C845 AT delcomsys DOT com> <20001211133605 DOT B7497 AT redhat DOT com> <3A352393 DOT 4D8645EC AT delcomsys DOT com> <3A57E0F0 DOT 3FE252BD AT delcomsys DOT com>
X-Mailer: Emacs 20.7.1 rmail (send-msg 1.104)
MIME-Version: 1.0

On Sat, 06 Jan 2001 22:22:24 -0500, Patrick Doyle <wpd AT delcomsys DOT com> wrote:
> 
> I have been working on a hack workaround for this problem.  (Short
> summary -- select() fails to detect when all of the writers of a pipe
> have closed the pipe because PeekNamedPipe() on W9x boxen fails to
> report when all of the writers of a pipe have closed the pipe.  I am
> told that this all works correctly on NT/2K boxen).

My work around for Win95/98 is a bash script, executed directly from
the windows command (I associated sh with /bin/bash):


#! /bin/sh -ex
# --------------------------------------------------

set +e
scp -p -v -r -C "$1" ehud AT ekc-1:$2

set +x
GRP=`ps | grep "[/]PS"`                    # find this PS line      
GRP=`echo $GRP | cut "-d " -f3`            # compress spaces        
PID=`ps | grep $GRP | grep "[/]bin[/]SSH"` # My ssh line            
PID=`echo $PID | cut "-d " -f1`            # compress spaces        
                                                                    
ps                                         # show running processes 
set -x                                                              
                                                                    
if [ "$PID" != "" ] ; then                 # is there "My SSH"      
    kill $PID                              # yes kill it            
else                                                                
    : " Error in copy to linux "           # no, error message      
fi                                                                  
sleep 30                                   # keep console open      
                                           
############################## scpt.sh ##############################


> Basically, I have modified 'pipe()' to create two windows pipes (on W9x
> boxen).  The first pipe is the same one that has always been created. 
> [ snip ] 

Well, it seems a very complicated work around for the W9x bug. I would
have taken a much simpler and direct approach like this:
   1) Save the child (ssh) process id in a global variable,
           (i.e. child=fork() ;)
   2) Just before exiting, send kill signal to the child with no
     checks,  (i.e. kill(child, SIGTERM) ;)

This might look like brute force, but it works. It has the advantage
that it works with ssh unmodified and with any other program that may
be given as argument to scp.

Ehud.
       

-- 
 @@@@@@ @@@ @@@@@@ @    @   Ehud Karni  Simon & Wiesel  Insurance agency
     @    @      @  @@  @   Tel: +972-3-6212-757    Fax: +972-3-6292-544
     @    @ @    @ @  @@    (USA)  Fax  and  voice  mail:  1-815-5509341
     @    @ @    @ @    @        Better     Safe     Than     Sorry
 http://www.simonwiesel.co.il    mailto:ehud AT unix DOT simonwiesel DOT co DOT il

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019