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: echo "$(echo '\r')" oddity


Hi,

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
$() ...

Thx,

JJ

> -----Original Message-----
> From: cygwin-owner@cygwin.com 
> [mailto:cygwin-owner@cygwin.com]On Behalf
> Of Brian Dessent
> Sent: Tuesday, May 03, 2005 17:31
> To: 'cygwin@cygwin.com'
> Subject: Re: echo "$(echo '\r')" oddity
> 
> 
> Jan Just Keijser wrote:
> 
> > I have just run into a Cygwin vs Linux oddity that I cannot 
> explain. I've
> > managed to trace the problem back to a very simple statement:
> >   echo "$(echo -e '\r')" | od -x
> > on my W2K Cygwin install (Cygwin1.dll 2005/04/01), this produces
> >   0000000 000a
> >   0000001
> > On Linux, this command produces:
> >   # echo "$(echo -e '\r')" | od -x
> >   0000000 0a0d
> >   0000002
> > (which is what I'd expect).
> > Also, the Cygwin command
> >   echo -e '\r' | od -x
> > also returns
> >   0000000 0a0d
> >   0000002
> 
> It appears that bash's handling of `` and $() is hardwired to 
> do \r\n ->
> \n translation.  I am not sure but that may be one of those 
> patches that
> was added to bash that makes more things work than it breaks. 
> 
> ... *checks* ...
> 
> Yes indeed:
> 
> subst.c, function read_comsub() (which implements command 
> substitution)
> 
> #ifdef __CYGWIN__
>   setmode (fd, O_TEXT);    /* we don't want CR/LF, we want 
> Unix-style */
> #endif
> 
> 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/


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