This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Running ssh in background [solution/patch]


Jörg Schaible wrote on Wednesday, October 26, 2005 10:09 AM:

> Alexander Gottwald wrote on Tuesday, October 25, 2005 6:26 PM:
> 
>> On Tue, 25 Oct 2005, Jörg Schaible wrote:
>> 
>>> Good guess. While I have no console window popping up anymore, the
>>> ssh process does now no longer terminate and the Windows app hangs
>>> until I kill the ssh process :(
>> 
>> most likely run.exe does not support piping or piping data to a
>> non-console application does not work at all.
>> 
>> Why do you need cygwin openssh? the subversion plugin does ssh
>> connections too. Maybe puttys plink is an alternative. TortoiseSVN
>> has a version which is compiled without console.
> 
> Because I work extensivly with Cygwin, have already the
> ssh-agent up and use different private keys to access various
> sites. I don't want to start another agent just because of
> putty and configuring Subversion to use 1 key only is not sufficient.

My solution was to build ssh as Windows console app:

diff -u openssh-4.2p1-1-orig/Makefile.in openssh-4.2p1-1/Makefile.in
--- openssh-4.2p1-1-orig/Makefile.in    2005-10-26 10:25:20.805291200 +0200
+++ openssh-4.2p1-1/Makefile.in 2005-10-26 10:58:19.390356800 +0200
@@ -60,7 +60,7 @@
 INSTALL_SSH_PRNG_CMDS=@INSTALL_SSH_PRNG_CMDS@
 INSTALL_SSH_RAND_HELPER=@INSTALL_SSH_RAND_HELPER@
 
-TARGETS=ssh$(EXEEXT) sshd$(EXEEXT) ssh-add$(EXEEXT) ssh-keygen$(EXEEXT) ssh-keyscan${EXEEXT} ssh-keysign${EXEEXT} ssh-agent$(EXEEXT) scp$(EXEEXT) ssh-rand-helper${EXEEXT} sftp-server$(EXEEXT) sftp$(EXEEXT)
+TARGETS=ssh$(EXEEXT) sshw$(EXEEXT) sshd$(EXEEXT) ssh-add$(EXEEXT) ssh-keygen$(EXEEXT) ssh-keyscan${EXEEXT} ssh-keysign${EXEEXT} ssh-agent$(EXEEXT) scp$(EXEEXT) ssh-rand-helper${EXEEXT} sftp-server$(EXEEXT) sftp$(EXEEXT)
 
 LIBSSH_OBJS=acss.o authfd.o authfile.o bufaux.o buffer.o \
        canohost.o channels.o cipher.o cipher-acss.o cipher-aes.o \
@@ -135,6 +135,9 @@
 ssh$(EXEEXT): $(LIBCOMPAT) libssh.a $(SSHOBJS)
        $(LD) -o $@ $(SSHOBJS) $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
 
+sshw$(EXEEXT): $(LIBCOMPAT) libssh.a $(SSHOBJS)
+       $(LD) -mwindows -o $@ $(SSHOBJS) $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
+
 sshd$(EXEEXT): libssh.a        $(LIBCOMPAT) $(SSHDOBJS)
        $(LD) -o $@ $(SSHDOBJS) $(LDFLAGS) -lssh -lopenbsd-compat $(LIBWRAP) $(LIBPAM) $(LIBS)
 

I create here an additional sshw.exe that sets the -mwindows linker switch. The result is still a Cygwin app that seems to work normally from the command line and works also called as background process without popping up a console window.

Two questions:

1/ Corinna, could you provide this version with next OpenSSH releases, too? Setting the appropriate property in the Subversion config to this sshw.exe, makes the SVN Clients in the Windows worlds happy. Neither Subclipse nor RapidSVN show these steadily popping up console windows anymore, nor does the command line version of Subversion behave differently.

2/ If linking a normal console app as Windows console app does not behave differently, why is it not the default? What's the real difference for Cygwin? It is still a Cygwin app and is normally listed in the Cygwin processes. I cannot say too much about the pipe and forking stuff, but something like "tar cf - *.sh | sshw spk1 tar xf -" works just normal.

- Jörg

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]