delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2017/09/11/18:00:49

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:subject:to:references:from:message-id:date
:mime-version:in-reply-to:content-type; q=dns; s=default; b=skha
gAxg2SQJVV2Z1s9z+AkkL2q6ipNi0JLMRZCPNqHL4fgTe9hKImwbi9JoztZY9ZcH
DJrrCuYRAQ381P2vMt4AuR7FbccnW5+n1h5c/9RwF3+m52kV4TfU1A4/893IZrk3
aecKEdhYK15RhAEelA7o2Ra1RlZrbrpC299gTF4=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:subject:to:references:from:message-id:date
:mime-version:in-reply-to:content-type; s=default; bh=pRGY+NIJug
aoXk+atTHY0SjKdbI=; b=GYDG98tvJOYo/9bs5oZdgzamWULZRtWSKr7I4RYgQ9
PW4ka2+Mw6vwjrzYM6VYSOq9KkLBLbouortoDWaw+dAFbameE7dI8GFLsgOojXGR
AvF7z5u2Uhfoq9hnZalWw4sUmSUJkfpSdMw8NdaHCyHvGKBXviI2sVgs/M0DUiqd
M=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=blake, Blake, H*M:4929, H*c:application
X-HELO: mx1.redhat.com
DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 3515BC0CC61F
Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=eblake AT redhat DOT com
Subject: Re: Extra CR symbol from backticks on Cygwin 2.9.0
To: cygwin AT cygwin DOT com, Nikolay Melekhin <nikolay DOT melekhin AT gmail DOT com>
References: <CAAq9174Ffd-zFLrCsUSz5DcxW8DYaeQbxsPxWMH0bh0vPBJCLA AT mail DOT gmail DOT com>
From: Eric Blake <eblake AT redhat DOT com>
Openpgp: url=http://people.redhat.com/eblake/eblake.gpg
Message-ID: <7ed18312-4929-8299-d186-9cb0aa541a93@redhat.com>
Date: Mon, 11 Sep 2017 17:00:10 -0500
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0
MIME-Version: 1.0
In-Reply-To: <CAAq9174Ffd-zFLrCsUSz5DcxW8DYaeQbxsPxWMH0bh0vPBJCLA@mail.gmail.com>
X-IsSubscribed: yes

--wVdo3xfFh689DtqV73vvJ5BdLdn0tfW8S
Content-Type: multipart/mixed; boundary="GDTasafR8eHK4EXxs9BNMr1sGfmjn6F0B";
 protected-headers="v1"
From: Eric Blake <eblake AT redhat DOT com>
To: cygwin AT cygwin DOT com, Nikolay Melekhin <nikolay DOT melekhin AT gmail DOT com>
Message-ID: <7ed18312-4929-8299-d186-9cb0aa541a93 AT redhat DOT com>
Subject: Re: Extra CR symbol from backticks on Cygwin 2.9.0
References: <CAAq9174Ffd-zFLrCsUSz5DcxW8DYaeQbxsPxWMH0bh0vPBJCLA AT mail DOT gmail DOT com>
In-Reply-To: <CAAq9174Ffd-zFLrCsUSz5DcxW8DYaeQbxsPxWMH0bh0vPBJCLA AT mail DOT gmail DOT com>


--GDTasafR8eHK4EXxs9BNMr1sGfmjn6F0B
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: quoted-printable

On 09/11/2017 04:27 PM, Nikolay Melekhin wrote:
>=20
> 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,

>=20
> 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.

--=20
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org


--GDTasafR8eHK4EXxs9BNMr1sGfmjn6F0B--

--wVdo3xfFh689DtqV73vvJ5BdLdn0tfW8S
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEzBAEBCAAdFiEEccLMIrHEYCkn0vOqp6FrSiUnQ2oFAlm3B2oACgkQp6FrSiUn
Q2rdkggAhLwaCnap8NDEvs0Il3fSjdzhuaRCvoYWmG6O8VB8J1wcaywsFAMqSVu0
U129ITQV72wJV0Niiv3OWAM+cRerK3+EyF+5A4auX+VIbv+N0m4O1ddwRQVF1d78
5s4PLDjV6B/K2NqwO7ddBi9sHgCghrlyA0uA1WHzEI9ZDhLFn24sZgo2xxP2FNH+
d9DGLphFSvsG0NioI6Ye7ArOjc2YY8hAfprJmvhNiyJqkyu2dGRZLrGaNF579FUR
evSbtSqn07AkaF7LxFbVCZSxfM4mk9VMXTcHFu0Crs4NQRn7Q2LTRnvoiO8MbpMk
ih5gOig5JvjTYgBeS3NuckS7Yj8ObA==
=7jht
-----END PGP SIGNATURE-----

--wVdo3xfFh689DtqV73vvJ5BdLdn0tfW8S--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019