From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30274 invoked by alias); 29 Aug 2016 18:30:32 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 25081 invoked by uid 89); 29 Aug 2016 18:30:20 -0000 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 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 29 Aug 2016 18:30:09 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6AEA23455A8 for ; Mon, 29 Aug 2016 18:30:08 +0000 (UTC) Received: from [10.3.116.77] (ovpn-116-77.phx2.redhat.com [10.3.116.77]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u7TIU7pM009339 for ; Mon, 29 Aug 2016 14:30:08 -0400 Subject: Re: Script broken after updating bash to 4.3.46-7? To: cygwin@cygwin.com References: From: Eric Blake Openpgp: url=http://people.redhat.com/eblake/eblake.gpg Message-ID: <93be816b-952c-20cd-575e-940cdf4fbbd1@redhat.com> Date: Tue, 30 Aug 2016 03:21:00 -0000 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 X-SW-Source: 2016-08/txt/msg00590.txt.bz2 --ebQmb85S3gNMLliOtbL4oxVdwHC41A14K Content-Type: multipart/mixed; boundary="okKOLdjeeV63aIF3eoMFoiDdACB67fPMr" From: Eric Blake To: cygwin@cygwin.com Message-ID: <93be816b-952c-20cd-575e-940cdf4fbbd1@redhat.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 Content-length: 1373 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" Content-length: 604 -----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--