delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2017/02/13/14:07:54

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=Uq7e
/C6OYuylPGBvj9XUb/k0qQsjQxGTawJ9u46ewyi9n0DAVOGQpVx5Nj3A9H7bHK12
gFFfcqc2rXo+aTVUmMmzmD1Oj7kvqqjhyBW0NwWGE9PYSxvLVgQFLBCeNFbiEzTh
lG1kbfGk2pyZITeBZcc/5VY0OZkndpg4XPP7yRc=
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=En7e1Dz+QG
78qmt2KfITqQuu9YU=; b=HV6XdsKTKyTI+ZpSSqOUZzLfniEf0ri+VoCNGPDfzw
WzdxAUipBVFYaR0pkQoNG/nHKmLMgIKCGBsazTFbuU3rNgEb3XeNEel+qNegdptw
GK3mX4Nm/DMhhGwhC2DevhlPpEpCd5BsENKn0esRP5fnHdnlqqMYF3b7zuGPMyZq
k=
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=-2.0 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Kenneth, kenneth, conduent, Conduent
X-HELO: mx1.redhat.com
Subject: Re: [ANNOUNCEMENT] Updated [test]: sed-4.4-1
To: cygwin AT cygwin DOT com
References: <58a07b9b DOT 085fca0a DOT 8af3f DOT 103c AT mx DOT google DOT com> <0D835E9B9CD07F40A48423F80D3B5A704BBE5793 AT USA7109MB022 DOT na DOT xerox DOT net> <468737ff-2ca2-f65a-89a1-a4b166567f54 AT gmail DOT com>
From: Eric Blake <eblake AT redhat DOT com>
Openpgp: url=http://people.redhat.com/eblake/eblake.gpg
Message-ID: <a7a432f2-1d41-37b6-ca4a-a41dc2014aa5@redhat.com>
Date: Mon, 13 Feb 2017 13:07:27 -0600
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0
MIME-Version: 1.0
In-Reply-To: <468737ff-2ca2-f65a-89a1-a4b166567f54@gmail.com>
X-IsSubscribed: yes

--7LJWkWNNPHivR0DejeFiWfSkdv4skQA11
Content-Type: multipart/mixed; boundary="RIe3FVRUjqLwbidJ1bwTOhNwmxAMNCpDJ";
 protected-headers="v1"
From: Eric Blake <eblake AT redhat DOT com>
To: cygwin AT cygwin DOT com
Message-ID: <a7a432f2-1d41-37b6-ca4a-a41dc2014aa5 AT redhat DOT com>
Subject: Re: [ANNOUNCEMENT] Updated [test]: sed-4.4-1
References: <58a07b9b DOT 085fca0a DOT 8af3f DOT 103c AT mx DOT google DOT com>
 <0D835E9B9CD07F40A48423F80D3B5A704BBE5793 AT USA7109MB022 DOT na DOT xerox DOT net>
 <468737ff-2ca2-f65a-89a1-a4b166567f54 AT gmail DOT com>
In-Reply-To: <468737ff-2ca2-f65a-89a1-a4b166567f54 AT gmail DOT com>


--RIe3FVRUjqLwbidJ1bwTOhNwmxAMNCpDJ
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 02/13/2017 09:53 AM, cyg Simple wrote:
> On 2/13/2017 9:14 AM, Nellis, Kenneth (Conduent) wrote:
>> From: Steven Penny=20=20
>>> Perhaps I am missing something, but cant all that be said about Sed too=
? I
>>> just cant see a situation where we are justified changing one and not t=
he
>>> other. They should either both strip carriage returns or neither.
>>
>> How about grep?
>>
>> $ printf 'hello\r\nworld\r\n' | grep hello | od -An -tcx1
>>    h   e   l   l   o  \n
>>   68  65  6c  6c  6f  0a
>> $
>>
>> Are there others?
>>
>> (BTW, I support the change.)
>>
>=20
> All pipe handles should be binary or at least an option to make it that
> way.  The file handles should be bound to the mounted mode.

I'm in favor of reducing special cases of FORCED text mode. It's great
on text mounts, but text mounts are discouraged for a reason (slower
computing, surprising results when seeking), and I recently patched bash
to quit forcing text mode (bash 4.3.42-4).

Pipes are indeed binary mode by default (and should stay that way), so
even if you have a long pipeline chain:

cmd1 < file_in | cmd2 | cmd3 | cmd4 > file_out

if file_in and file_out are mounted on text mounts, then cmd1 won't see
any carriage returns, so neither will cmd2, cmd3, or cmd4, and finally
cmd4 writes in text mode back to file_out.

But when you are operating on a binary mount, and WANT carriage returns
to be preserved, forcing a text mount at any point in the chain corrupts
all later points in the chain.

There's a big difference between using "rt" to force text mode (which is
what I killed in this sed release), using "rb" to force binary mode
(which is what I use in tar, because tar MUST preserve binary data), and
using "r" (which is what sed now uses) to let the mount point decide
whether CR are important.

So I'd be in favor of a patch to awk dropping forced text mode on binary
mounts.

And I'll look into fixing grep to quit misbehaving as well.

--=20
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


--RIe3FVRUjqLwbidJ1bwTOhNwmxAMNCpDJ--

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

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

iQEcBAEBCAAGBQJYogPvAAoJEKeha0olJ0NqVa0H/071IGfbb3iY1tIeLqCYWHjT
F1hAjRiwSeIPi0EB8GNnUpmB9eU7iT+yaKnd98issyva++pspD8GUyImRYX07r/v
z5Q9ljHUP09Ze78XZfiXLf/X85JhnL2PCUopmS0P4KSGINctBd7C3n8E8GioyoNC
KbQ0vx89gI8Y9N1EG5hTVnVtlDs/tUrNlYgWW4WFz3tqIu3FKQ2ct2TLbwCRjwWY
UcucyRZoBeda9HW1uTR27cN7FYaAwkN0i7/kP9QU9/ywtsPlHE8FsSI+O12bT44g
3Rh1Nr6okpb7tj+FaZwFRsdrCuesThhSE1pWm2Ho0W7vWhhdo/7MfqARK3/cD1A=
=bjxc
-----END PGP SIGNATURE-----

--7LJWkWNNPHivR0DejeFiWfSkdv4skQA11--

- Raw text -


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