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=ymqM | |
cdS0pdENNXmbRUnb0ptD+40L/EOLEpk/7PXHjVuj/eJQSsb5HAIGU1G3ZryyQRGO | |
9WWdeCoRPaDNcxoD89JkQMoXMpSNfyBU+tiV5boXq8qrj3iFoe3vgXsjObl5pwal | |
CMXtgVGefNj4CWYRSVke8slVe8GYbjETFXApC58= | |
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=lF5hGbSuNq | |
Aa/mAOJ4AE1wv2FOM=; b=vb6PtPTJ9ih4E8IERK2E3Q+wgUm0kCIaLTSujI6Rjc | |
a/tlHoRfUmeLxBMA80dmeUor3zWEz6Dvvy62Ll6E3XV2JWNZY99cYzpDfg7+o81u | |
U5HKPQPAdJ5DXAM0KIsZbSnMHbETARr1WfLrMoKaqWpNMV5XDQ7EWx5cYSRpcmeJ | |
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=-3.4 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=d2u, corrupted, flushed, H*f:sk:e49f601 |
X-HELO: | mx1.redhat.com |
Subject: | Re: Script broken after updating bash to 4.3.46-7? |
To: | cygwin AT cygwin DOT com |
References: | <CAPTiy3PW0+bk20d30-J=sLr=PPnFOeU0Fb495hh1bBVtbtPrzw AT mail DOT gmail DOT com> <93be816b-952c-20cd-575e-940cdf4fbbd1 AT redhat DOT com> <e49f6018-a054-85c1-7856-cd81e4f54fa2 AT gmail DOT com> |
From: | Eric Blake <eblake AT redhat DOT com> |
Openpgp: | url=http://people.redhat.com/eblake/eblake.gpg |
Message-ID: | <1de2efdc-b26c-4914-580c-1a640d0a46fd@redhat.com> |
Date: | Tue, 30 Aug 2016 12:38:08 -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: | <e49f6018-a054-85c1-7856-cd81e4f54fa2@gmail.com> |
X-IsSubscribed: | yes |
--Gh3N4QWieQMFj6Lb598IewT2T24Hsws4F Content-Type: multipart/mixed; boundary="GJkWiwm1E214AaHcG0H9xmhnBaUHA6Dam" From: Eric Blake <eblake AT redhat DOT com> To: cygwin AT cygwin DOT com Message-ID: <1de2efdc-b26c-4914-580c-1a640d0a46fd AT redhat DOT com> Subject: Re: Script broken after updating bash to 4.3.46-7? References: <CAPTiy3PW0+bk20d30-J=sLr=PPnFOeU0Fb495hh1bBVtbtPrzw AT mail DOT gmail DOT com> <93be816b-952c-20cd-575e-940cdf4fbbd1 AT redhat DOT com> <e49f6018-a054-85c1-7856-cd81e4f54fa2 AT gmail DOT com> In-Reply-To: <e49f6018-a054-85c1-7856-cd81e4f54fa2 AT gmail DOT com> --GJkWiwm1E214AaHcG0H9xmhnBaUHA6Dam Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 08/30/2016 12:04 PM, cyg Simple wrote: > On 8/29/2016 2:30 PM, Eric Blake wrote: >> >> Simplest fix: >> >> read ... < <(mysql ... | dos2unix) >> >=20 > This will break when the data returned by mysql is supposed to contain \r. >=20 >> There. Now you aren't feeding \r to read in the first place. >> >=20 > But you might want to feed \r to read. It isn't a fix, it is a > potential work around dependent on the data set results. If a read that > is supposed to be reading binary data doesn't pass all of the data to > the routine then it is broken. Now we're talking past each other. That's what the recent bash fixed. 'read' in bash 3.2.42-4 was broken - it corrupted binary data, with no recourse, by eating \r (and worse, by sometimes eating the byte after \r). 'read' in bash 3.2.46-7 is fixed - by default it is strictly binary (all bytes are read as-is, including \r), but can also be switched to text mode (using 'igncr', all \r are ignored). If you want to preserve mid-line \r but treat line endings of \r\n as a single byte, then leave binary mode on and strip the line endings via a separate tool like d2u (note, however, that it is very rare to have data where mid-line \r is important but line-ending \r\n should be treated as plain \n). I strongly think that using igncr is a crutch, and you normally shouldn't use it; particularly not if you want to be portable to other platforms. Instead, massaging your data through d2u is a great way to be portable. But sometimes the ease of ignoring ALL \r is easier than worrying about portability, so I keep the 'igncr' code in Cygwin. And it is only because the OP tried using 'igncr' in the first place (whether or not it was actually needed) that we have now flushed out the existence of a latent bug in the 'igncr' implementation that interacts weirdly with $()\n in PS1. On that front, I'm still hoping to find time to debug and/or for someone to post a patch. But whether PS1 behaves weirdly under 'igncr' is orthogonal to my suggestion above - using 'mysql|d2u' is a great way to avoid the need to worry about 'igncr'. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --GJkWiwm1E214AaHcG0H9xmhnBaUHA6Dam-- --Gh3N4QWieQMFj6Lb598IewT2T24Hsws4F 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/ iQEcBAEBCAAGBQJXxcSAAAoJEKeha0olJ0NqsYkIAJ+r4jooKRKp1U/2pPInQGnZ yl+aVI4H37fckBFqsmdjjG+ZBvgH+CuffWQIy9OYLuE8dSrzy+rMWRg/ipZ1xQdb 2ivAqlRAae4kgvnkcpVD32zYE+iSmmZzjiK/Kdxr0Ibe8sPvdwTmkM877stCw7q0 zgJLzpGnFLNL6c4E9KtIJ9gHs/hEDi/hJnWSx9qSF8V7AEz33ZYSTEaMPxUtA2CN uyWMr2CKa93jIO1RqeNZF0C5bvPn4xXoZjoEi2BtKxASxSuirXXvCh2HYSG/g2jL ad1HgRVQJoUgMc9D+YD6iVjr+akM3yDr7A7Uv7rGerbaIRiIVOQyIP7AHRcjfeU= =tRHL -----END PGP SIGNATURE----- --Gh3N4QWieQMFj6Lb598IewT2T24Hsws4F--
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |