Extra CR symbol from backticks on Cygwin 2.9.0
Eric Blake
eblake@redhat.com
Mon Sep 11 22:00:00 GMT 2017
On 09/11/2017 04:27 PM, Nikolay Melekhin wrote:
>
> I'd expect that Cygwin must remove CRLF symbols from backtick results,
You expected wrong - by default Cygwin does the same as Linux, which
does NOT remove CR from command substitution (only LF).
> but remove only LF symbol. It gets different results on Windows and
> Linux. Result on Windows has additional CR symbol and for example
> string comparision, which is working in Linux, fails in Windows.
It is NOT a bug in Cygwin, but in your failure to sanitize your input.
You'd get the same behavior on Linux if you pass in CR bytes. That said,
>
> Is any kind of an option/setting which removes such CRs or it is a bug
> in Cygwin?
Read the release announcements: Cygwin bash DOES have an 'igncr' shell
option (set -o igncr) that does exactly what you are asking for - it
makes bash ignore CR characters in command substitutions and other places:
https://cygwin.com/ml/cygwin-announce/2017-01/msg00047.html
The option is not on by default, but exists because it is a common
desire when you can't be bothered to otherwise sanitize CR out of your
input stream.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://cygwin.com/pipermail/cygwin/attachments/20170911/c8281707/attachment.sig>
More information about the Cygwin
mailing list