From: Eric Blake <eblake@redhat.com>
To: cygwin@cygwin.com, Nikolay Melekhin <nikolay.melekhin@gmail.com>
Subject: Re: Extra CR symbol from backticks on Cygwin 2.9.0
Date: Mon, 11 Sep 2017 22:00:00 -0000 [thread overview]
Message-ID: <7ed18312-4929-8299-d186-9cb0aa541a93@redhat.com> (raw)
In-Reply-To: <CAAq9174Ffd-zFLrCsUSz5DcxW8DYaeQbxsPxWMH0bh0vPBJCLA@mail.gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 1281 bytes --]
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
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 619 bytes --]
next prev parent reply other threads:[~2017-09-11 22:00 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-11 21:36 Nikolay Melekhin
2017-09-11 22:00 ` Eric Blake [this message]
2017-09-12 5:38 ` Nikolay Melekhin
2017-09-12 9:20 ` Andrey Repin
2017-09-12 13:03 ` cyg Simple
2017-09-12 13:06 ` Eric Blake
2017-09-12 13:10 ` cyg Simple
2017-09-13 0:11 ` Michel LaBarre
2017-09-13 14:34 ` cyg Simple
2017-09-13 18:47 ` Brian Inglis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7ed18312-4929-8299-d186-9cb0aa541a93@redhat.com \
--to=eblake@redhat.com \
--cc=cygwin@cygwin.com \
--cc=nikolay.melekhin@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).