echo "$(echo '\r')" oddity

Jan Just Keijser jan.just.keijser@logicacmg.com
Wed May 4 08:34:00 GMT 2005


socat (http://www.dest-unreach.org/socat/) is a multi-purpose relay tool
that can be used to connect sockets to pipes and vice versa, or terminal
pty's to TCP sockets etc etc. I have found it a very handy tool to build
VPN-like things in a environment where you cannot or do not want to modify
the existing networking infrastructure. 

The socat code comes with a test script for testing socat functionality.
Prior to upgrading to cygwin 1.5.16 almost all socat options were functional
under cygwin, except for a few that used the 'exec:'parameter. An example of
a command that is failing is:
  ./socat -t 0.1 exec:'openssl s_server -accept 12002 -quiet -cert
testsrv.pem' pipe &
  echo hallo | ./socat -t0.1  - openssl:localhost:12002,verify=0 

this command runs fine on Linux but under Cygwin there is no output echoed
back from the openssl s_server application. More specifically, the socat
server process (first line) does return the output but it looks like the
output never reaches the client - to me, that sounds like a pipe flushing
problem or a line-termination problem. 

the command that I reported yesterday:
  echo "$(echo '\r')"
is now working under a newly-compiled version of bash 3.0 in which I
commented out the offending section in subst.c.

An interesting note is that after I upgraded to cygwin 1.5.16 (from 1.5.14)
yesterday) a few other options ALSO stopped working. I am not sure what has
caused this.

regards,

JJ Keijser

> -----Original Message-----
> From: cygwin-owner@cygwin.com 
> [mailto:cygwin-owner@cygwin.com] On Behalf Of Brian Dessent
> Sent: Tuesday, May 03, 2005 17:54
> To: 'cygwin@cygwin.com'
> Subject: Re: echo "$(echo '\r')" oddity
> 
> Jan Just Keijser wrote:
> 
> > thx for the quick answer. Lemme guess: I am going to have 
> to build my 
> > own version of bash that does not have this behaviour... 
> what is going 
> > to break if I undo this patch from the bash source code?
> > 
> > It's a shame though, coz this seems to be the only issue that stops 
> > that nifty socat from working... all tests pass except those tests 
> > that use `` or
> > $() ...
> 
> My guess is that that patch was added so that command 
> substitution on windows programs works.  Or something to that 
> effect.  You could certainly recompile without it, and see 
> what happens.
> 
> But the question that I think we're left with is what exactly 
> is socat doing that is broken by this?  If you give examples 
> I'm sure someone here will be able to show you a way to do 
> what you want without patching anything.  Note: I have no 
> idea what socat is...
> 
> Brian
> 
> --
> 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/
> 

This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.

--
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/



More information about the Cygwin mailing list