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=qEzz BmHgPyjQ6NTP835QUY9VzniHsmEalRll6SyjVCBKkF0aoSPqBjQvSrfqX3FZOIEn XtcTuezVYYAherPdrkQVLkEq9MvEN9bgIugcUOfDTDuNK49YOBWtBssQRQsXFPSO F8NCLf+KG7rp7y9poMbCiJWZ/Egjib7+pTmNiOI= 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=keeOO9a9q5 7/4tU0shkSD/lpft0=; b=Wm62Lw0KO5sazMZT3WvAL95WFIZB1AkMwsMuTnMdXS tL+czhQMbV04aZuh2ObbcTbmsHCpDXGvj9JI4Y4frOHH1pvUUgKgQv0ylDaXlxeC brXRO89dKdE55mRMHuvW033drEVuaUPKUGgOC+68UnAfjWWo4b+3BafzFyLJ2HG7 c= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , 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=luck, H*MI:bk20d30-J, eaten, ate X-HELO: mx1.redhat.com Subject: Re: Script broken after updating bash to 4.3.46-7? To: cygwin AT cygwin DOT com References: From: Eric Blake Openpgp: url=http://people.redhat.com/eblake/eblake.gpg Message-ID: <93be816b-952c-20cd-575e-940cdf4fbbd1@redhat.com> Date: Mon, 29 Aug 2016 13:30:07 -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: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ebQmb85S3gNMLliOtbL4oxVdwHC41A14K" X-IsSubscribed: yes --ebQmb85S3gNMLliOtbL4oxVdwHC41A14K Content-Type: multipart/mixed; boundary="okKOLdjeeV63aIF3eoMFoiDdACB67fPMr" From: Eric Blake To: cygwin AT cygwin DOT com Message-ID: <93be816b-952c-20cd-575e-940cdf4fbbd1 AT redhat DOT com> Subject: Re: Script broken after updating bash to 4.3.46-7? References: In-Reply-To: --okKOLdjeeV63aIF3eoMFoiDdACB67fPMr Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 08/26/2016 06:49 PM, Gene Pavlovsky wrote: > After I updated Cygwin yesterday, a daily database backup bash script > (`automysqlbackup`) broke. > My previous bash was 4.3.42-4 (installed when I updated Cygwin on > 2016/07/23), current is 4.3.46-7. > Here's the code snippet: > ```bash > local i;i=3D0; > while read -r; do alldbnames[i++]=3D"$REPLY"; done < <(mysql > --user=3D"${CONFIG_mysql_dump_username}" > --password=3D"${CONFIG_mysql_dump_password}" > --host=3D"${CONFIG_mysql_dump_host}" "${mysql_opt[@]}" --batch > --skip-column-names -e "show databases") > ``` > This is supposed to get the list of all databases. Before it worked. By pure luck. The 'read' builtin was inconsistent on cygwin, in that it FORCED people to use text mode (and ate \r before \n), even when they wanted pure binary input, which was different than all other aspects of bash; and worse had a bug where \r before something else would cause the something else to be incorrectly eaten. > Now every item on the list ends with the CR character ($'\r'), causing > a bunch of issues with further script opreation. I'm using official > MariaDB Windows x64 binaries. Simplest fix: read ... < <(mysql ... | dos2unix) There. Now you aren't feeding \r to read in the first place. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --okKOLdjeeV63aIF3eoMFoiDdACB67fPMr-- --ebQmb85S3gNMLliOtbL4oxVdwHC41A14K 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/ iQEcBAEBCAAGBQJXxH8vAAoJEKeha0olJ0NqNi8H/2DEG3K6nP/3Cz4vPtpfd/e9 dnVTpdLTOiCUC1KOmodBB9EfXjizYWeH6hs4O6lEY8U5nV8wdRd+tGoKy05kWcFk uiyrUPyFUOzk/OULh0pwmqaTBVCNCmJCRJQdvujtSoznu6p4tM3zaEwDli26A9AL hfaUMzKK6xd78va6ZArr35pWGXQmqTrbvwW5P1qy/3qytdLcc7I1o8XmbXZzt/UW 7V+ttNQFLYg8hOQ9x6sFVBAV15hB7KqE3aZ6XAnGvWVAXnyyVH5zjZcq9ME0DrXm dNOTYtZfneey41WAXeh8OdIZQ5X7kWJ7sLcvUBAbTiYvKRD/nOLRghBWbKKCGAA= =yyHL -----END PGP SIGNATURE----- --ebQmb85S3gNMLliOtbL4oxVdwHC41A14K--