Re: [Bug] bash' read builtin command behaves differently on '\r' (4.3.33)
On 05/14/2015 01:32 PM, Mikhail Usenko wrote: > > Cygwin version: 2.0.2-1 > > [linux]$ bash --version > GNU bash, version 4.3.33(1)-release (i686-redhat-linux-gnu) > [cygwin]$ bash --version > GNU bash, version 4.3.33(1)-release (x86_64-unknown-cygwin) > > Testcase: > [linux]$ echo -ne "\r\n" | { read t; echo "$t"; } | od -A n -t x1 > 0d 0a > [cygwin]$ echo -ne "\r\n" | { read t; echo "$t"; } | od -A n -t x1 > 0a > > But then, the pipe itself is OK: > [cygwin]$ echo -e "\r" | od -A n -t x1 > 0d 0a Jeff Downs helped me investigate off-list, and I think he found the culprit (a typo in input.c that requested O_TEXT when it meant B_TEXT, when mapping from open() flags to bash's internal B_* flags). I'm building a new bash build right now, and will shortly be posting it for testing. -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature
Re: [Bug] bash' read builtin command behaves differently on '\r' (4.3.33)
On 05/14/2015 02:18 PM, Mikhail Usenko wrote: > Also when a bash script is launched from an external program > with connected stdio from/to the program using a UNIX domain > socket generated by socketpair() the read builtin works OK. Thanks for the additional information. I can indeed duplicate that bash is stripping \r\n to \n, but NOT stripping other \r, when reading from a pipe: $ printf ':\r:\r\n' | { read t; echo "-$t-"; } | od -tx1 000 2d 3a 0d 3a 2d 0a 006 and pipes themselves are not doing the stripping: $ printf ':\r:\r\n' | od -tx1 000 3a 0d 3a 0d 0a 005 I also confirmed that raw files have the same problem. Possibly a bug I introduced in my code to support igncr, so I'll try to root it out. -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature
Re: [Bug] bash' read builtin command behaves differently on '\r' (4.3.33)
Also when a bash script is launched from an external program with connected stdio from/to the program using a UNIX domain socket generated by socketpair() the read builtin works OK. -- -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Re: [Bug] bash' read builtin command behaves differently on '\r' (4.3.33)
On Thu, 14 May 2015 13:53:38 -0600 Eric Blake <...> wrote: > > Umm, are you sure you haven't turned on the igncr shell option in your > cygwin environment? > $ set -o allexport off braceexpand on emacs on errexit off errtraceoff functrace off hashall on histexpand on history on igncr off ignoreeof off interactive-commentson keyword off monitor on noclobber off noexec off noglob off nolog off notify off nounset off onecmd off physicaloff pipefailoff posix off privileged off verbose off vi off xtrace off -- -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Re: [Bug] bash' read builtin command behaves differently on '\r' (4.3.33)
On 05/14/2015 01:32 PM, Mikhail Usenko wrote: > > Cygwin version: 2.0.2-1 > > [linux]$ bash --version > GNU bash, version 4.3.33(1)-release (i686-redhat-linux-gnu) > [cygwin]$ bash --version > GNU bash, version 4.3.33(1)-release (x86_64-unknown-cygwin) > > Testcase: > [linux]$ echo -ne "\r\n" | { read t; echo "$t"; } | od -A n -t x1 echo -n is not portable; use printf instead: printf %s '\r\n' or with a bash-ism: printf $'\r\n' > 0d 0a > [cygwin]$ echo -ne "\r\n" | { read t; echo "$t"; } | od -A n -t x1 > 0a Umm, are you sure you haven't turned on the igncr shell option in your cygwin environment? -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature
[Bug] bash' read builtin command behaves differently on '\r' (4.3.33)
Cygwin version: 2.0.2-1 [linux]$ bash --version GNU bash, version 4.3.33(1)-release (i686-redhat-linux-gnu) [cygwin]$ bash --version GNU bash, version 4.3.33(1)-release (x86_64-unknown-cygwin) Testcase: [linux]$ echo -ne "\r\n" | { read t; echo "$t"; } | od -A n -t x1 0d 0a [cygwin]$ echo -ne "\r\n" | { read t; echo "$t"; } | od -A n -t x1 0a But then, the pipe itself is OK: [cygwin]$ echo -e "\r" | od -A n -t x1 0d 0a -- -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple