delorie.com/archives/browse.cgi | search |
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=epNO | |
m3rMbXSVo9BDGfga3dD8R25J7vRYk/Zfq8qvvVOzhjwcRtKKbjrJzDtBW4bIOUk7 | |
INZOJnr7S7l7wbL9QWjzjerppsl1EeAlTkWV5DWK6qidPhWxelwKxaY6OBk5EEXq | |
9HPAkRVhV6gqp8yMJ9RP7b2Zonfk4KYP7BgRpjY= | |
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=mZAPr1W2WF | |
D9FxHfUpSfX4W5pIg=; b=r5rRZzIY6gkZwgtzyp5PhOzqlzHpAQpNfb45hlhB60 | |
seIvRBLEkKuIaMU7lX1IRx4FdIDMMUWfKL219Y3152HmIQD5yiqXfvyg/S2/YHYA | |
wL2LwW0uoQp4ulr52cGM3fxaNp7fj2i6utTBC2Fx75wIN+sciVEsbOqnSGd6zTrH | |
o= | |
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.1 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=eats, chet, Chet, 4.5 |
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> |
From: | Eric Blake <eblake AT redhat DOT com> |
Openpgp: | url=http://people.redhat.com/eblake/eblake.gpg |
Message-ID: | <8980687a-967e-88d8-2a94-f485731fafe9@redhat.com> |
Date: | Mon, 29 Aug 2016 12:43:19 -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: | <CAPTiy3N-n5krtWcZuK8-pBQE_efzroS6rizknHqU2tE+BYaMQQ@mail.gmail.com> |
X-IsSubscribed: | yes |
--xbg2hxt8BVLMQRDNT96mspe3KNlgdP59p Content-Type: multipart/mixed; boundary="GCc1WD5A7oqKvwNBdsT6fk8RohO8an4Mx" From: Eric Blake <eblake AT redhat DOT com> To: cygwin AT cygwin DOT com Message-ID: <8980687a-967e-88d8-2a94-f485731fafe9 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> In-Reply-To: <CAPTiy3N-n5krtWcZuK8-pBQE_efzroS6rizknHqU2tE+BYaMQQ AT mail DOT gmail DOT com> --GCc1WD5A7oqKvwNBdsT6fk8RohO8an4Mx Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 08/28/2016 03:20 PM, Gene Pavlovsky wrote: > Re-posting a reply I got from Henri (aka Houder) houder AT xs4all DOT nl > His letter follows: >=20 > Hi Gene, >=20 > Reread your entry to the mailing list ... >=20 >> Apparently the latest bash in Cygwin modified the read builtin to use >> Cygwin-specific shell option igncr to control ignoring \r characters >> in the input (still not clear if that ignores \r\n sequences, or \r >> followed by anything else will be also ignored). >=20 If the igncr shell option (currently Cygwin-specific, but Chet says that he is amenable to reviewing it for upstream inclusion in 4.5 once 4.4 is released any day now) is enabled, then it eats ALL \r, regardless of context. In other words, it ignores all carriage returns, as per the name. >> I considered enabling the `igncr` option everywhere, by declaring a >> SHELLOPTS=3Digncr Windows environment variable, however immediately it >> created an issue with my two-line PS1 prompt, which contains \n. >> >> # PS1=3D'\e[1;30m\D{%T}\e[m$(test \j -ne 0 && echo " >> \e[1;37mj:\j\e[m")${STY:+ \e[1;32m${STY%%.*}\e[m} \e[1;33m\w\e[m\n# ' >> 14:32:22 /usr/local/bin >> # set -o igncr >> bash: command substitution: line 1: syntax error near unexpected token `= )' >> bash: command substitution: line 1: `test 0 -ne 0 && echo " j:0")' >> 14:32:24{STY:+ } /usr/local/bin >> # set +o igncr >> 14:32:26 /usr/local/bin >> # >> >> What's wrong with this? It works fine on a Linux box. >> I'm considering rolling back bash until I can figure this out. Eating \n is NOT supposed to happen, so it may be that some other bug is still present in the code. At least you have given me a test case, so I can try and reproduce it, and upload a version of bash that does not have the problem if I can find where the bug actually lives. But it seems like \n handling in PS1 is independent of any change in handing in the 'read' builtin. As evidence, I ran the following test using the older bash-4.3.42-4 build: $ bash-4.3.42-4 $ set -o igncr $ PS1=3D'$(date)\n# ' bash: command substitution: line 1: syntax error near unexpected token ')' bash: command substitution: line 1: `date)' $ exit So you have uncovered a latent problem, unrelated to the recent igncr fixes, but which is indeed tied to the overall igncr patches, and which you had no reason to trip over until the igncr change to 'read' changed your desire to use igncr. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --GCc1WD5A7oqKvwNBdsT6fk8RohO8an4Mx-- --xbg2hxt8BVLMQRDNT96mspe3KNlgdP59p 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/ iQEcBAEBCAAGBQJXxHQ3AAoJEKeha0olJ0NqcQIH/RfMyiIAtpyuqgjMyZkovdPn eKDYJRhw6ruzw4XXM17N+qinUGM+6OOFQ7PHpCjOb0a4E6d/rWvAwB599RvmB8wV qUTK4+ZHm/BGVbAL+nHgTc4knvSIk7uemKRqewS2gfqcLd/W2iHIfPsmaAPFtfvp ilEsUdbEhOhGxd+3izPhscabYrCp5LlHhJO/NX2kjcU6VOJHU3ASUPmjS/C1oBZi 8Zi4TgOnCvRtY0iY/Bm1oy2bsnz1h22eNdztmxByfpbXMLb94Cxon4g5Ru7MZg6q WtL4kgGaEtTG1IMKEoU+VQN4LvuV4VpryxIPbSJnrn83BOTnInY+Rr7xmRQOKmw= =v33n -----END PGP SIGNATURE----- --xbg2hxt8BVLMQRDNT96mspe3KNlgdP59p--
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |