delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2016/09/02/09:32:57

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=ZN6k
HTASrSc/Fak++0tfRq4WLk+C+CWo9KKd/nxNCKv16RVZ6op5jzJbl0yNviQgco77
lCnTCYRNhcj4Ztgt76LqF9opG4EwVlIBjJ7MXCc8GKzxMwDDjnB7E4J1Zy1InCfT
BWvzOI3CB0oms+Vp3z8cPpyToKnXX+HqRtMYRDU=
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=OkZaB4hWVj
GtEL62xiKtqdIrZ94=; b=df7IZMr0JMPyT/0C0q9zERGgA2x6ptWHYg9hSyH5k+
UKi7qz40772YAB4qpg4YiU5VXUvG5XeRircNyCKCGhEEGOV0IDwQNtlxNSeFkyYz
68JPkQrozQyHT5//OsHytvRMR0wAMJLQdLqbhpu3SyT6aEv/U6hAetNdygRwlrBj
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=-3.4 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=H*MI:sk:hhkow AT m, H*i:sk:DHpfnw-, Hx-languages-length:1699, H*i:CqQaX8BzsV
X-HELO: mx1.redhat.com
Subject: Re: bash: igncr shell option breaks my PS1 prompt
To: cygwin AT cygwin DOT com
References: <CAPTiy3PE0gZ-hpvQbxVkfaZfxtppDx7RG85WtuigpnL54WZbDA AT mail DOT gmail DOT com> <CAPTiy3N-n5krtWcZuK8-pBQE_efzroS6rizknHqU2tE+BYaMQQ AT mail DOT gmail DOT com> <8980687a-967e-88d8-2a94-f485731fafe9 AT redhat DOT com> <9940d9b9cd565fbb0d5b395565197dfd AT xs4all DOT nl> <0294c48e-8e96-f554-3e05-6b7771dfb96e AT redhat DOT com> <CAPTiy3Ow6b6n7Nfd+DHpfnw-W7Y_ZAXS4+CqQaX8BzsV=hhkow 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: <a3b97bcb-d880-23b3-3acb-e68276509bde@redhat.com>
Date: Fri, 2 Sep 2016 08:32:29 -0500
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0
MIME-Version: 1.0
In-Reply-To: <CAPTiy3Ow6b6n7Nfd+DHpfnw-W7Y_ZAXS4+CqQaX8BzsV=hhkow@mail.gmail.com>
X-IsSubscribed: yes

--MUsOPM1Fb3uxQMcIKtBFk4SHXRouWQEUB
Content-Type: multipart/mixed; boundary="gp6TwcgiGntOEdVRSmij0FjT6N2HfdkV1"
From: Eric Blake <eblake AT redhat DOT com>
To: cygwin AT cygwin DOT com
Message-ID: <a3b97bcb-d880-23b3-3acb-e68276509bde AT redhat DOT com>
Subject: Re: bash: igncr shell option breaks my PS1 prompt
References: <CAPTiy3PE0gZ-hpvQbxVkfaZfxtppDx7RG85WtuigpnL54WZbDA AT mail DOT gmail DOT com>
 <CAPTiy3N-n5krtWcZuK8-pBQE_efzroS6rizknHqU2tE+BYaMQQ AT mail DOT gmail DOT com>
 <8980687a-967e-88d8-2a94-f485731fafe9 AT redhat DOT com>
 <9940d9b9cd565fbb0d5b395565197dfd AT xs4all DOT nl>
 <0294c48e-8e96-f554-3e05-6b7771dfb96e AT redhat DOT com>
 <CAPTiy3Ow6b6n7Nfd+DHpfnw-W7Y_ZAXS4+CqQaX8BzsV=hhkow AT mail DOT gmail DOT com>
In-Reply-To: <CAPTiy3Ow6b6n7Nfd+DHpfnw-W7Y_ZAXS4+CqQaX8BzsV=hhkow AT mail DOT gmail DOT com>


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

On 09/02/2016 06:52 AM, Gene Pavlovsky wrote:
> Dear Eric Blake,
>=20
> I understand there were issues with read handling of \r. But is the
> resulting solution/bugfix ideal?

Yes.  The recent change to 'read' was a bugfix, and as far as I'm
concerned, it is the ideal fix (you get binary behavior by default, and
text behavior if you use igncr; just as with every other aspect of the
shell controlled by igncr).

> Or does it introduce new problems?

No. The existing problem of igncr vs. PS1 was pre-existing, it was NOT
introduced by the recent change to 'read'.

>=20
> Basically, I don't want to set `igncr` as system-wide shell option
> (e.g. through SHELLOPTS).

Don't use it, then.  I highly recommend avoiding 'igncr', because it
exists only as a crutch.  The real solution is to fix your environment
to be binary-clean, at which point you no longer need igncr. But I also
understand that fixing an environment to be binary-clean can be
expensive, so 'igncr' remains as the crutch.

> So, how do I keep an existing bash script, that uses `read` piped from
> the output of a Windows console program that uses CRLF as newlines,
> working, without modifying the script? I don't see how it's possible
> with the current situation.

By piping the output of the Windows program through d2u before handing
it to 'read'.

>=20
> Personally I think that by default read should behave as it did for
> years.

Sorry, but I am NOT a fan of default behavior that corrupts my data.  I
am not going to maintain backwards bug compatibility to the broken read
behavior.

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


--gp6TwcgiGntOEdVRSmij0FjT6N2HfdkV1--

--MUsOPM1Fb3uxQMcIKtBFk4SHXRouWQEUB
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/

iQEcBAEBCAAGBQJXyX9tAAoJEKeha0olJ0NqXn8IAJ5QhshEj2UO4AiN3XIJu9jZ
2lqGhdQwXPy4EhgAquqQ1feOPrrOhHEvmneAAGoqr5aa9TnHUOMt/tyCUVxL0Oha
zXLPmX+aIVgv+JXadNvEf6IFn0zlBj4KmpZdCE9eq+aQE64Psf5Rxv+bT3w27NqW
Evn6ERSdbzUqJmeJ8iV+Fo77jgcNzoFazAwuxHY7D7pjPzNC4mIBDYSeOIRow+sV
bwZ/QhYLddGMTAmL8PTgCwIRWX7UGCjLlDHfIs3d4LH/ecFhF0ExIU/SLvB4G2vW
Vt/ZnnO6g/X50V8WW0nd55Hs3BGoUNgdhvB1WKUcK0Gx4lHnGZ84tlATZVieYQk=
=fAwb
-----END PGP SIGNATURE-----

--MUsOPM1Fb3uxQMcIKtBFk4SHXRouWQEUB--

- Raw text -


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