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:date:from:to:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; q=dns; s= default; b=QN1u2UkkT8JWGV9yO1tk5nepxp6pHEh8YDyEdG2QLcR0ZAUcRj1xC O1jEZ1lTqvGauHaEiivKIOS4AVhGIl6demwRyOAqcXGhtnOQvFhCfFvrtcSQI+p1 Pbr2uPOzLya6KAc1ACPJL2+cfZEp2Gwnuf+Ujd2Ukl4id9/agWdB7o= 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:date:from:to:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; s=default; bh=BXgHlBuQANcm54rNDxoPJVKb3gw=; b=JTrpysiSfk0YVYq+qP2rYdJiN19K AfYvm/ZbIRy2NVAdduDQtQuzt9mre7gwSK4Kf+VN+lf5XQxWhPB02I23oQ5Vz3qq w4jHn7VEECcMLul5bALrdFEgQ/6SkGmECH7yXkJRtsRSJm2zYnP6wXRdPb8/nyo0 GGWtP7isa2egWo8= 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=-101.6 required=5.0 tests=AWL,BAYES_00,GOOD_FROM_CORINNA_CYGWIN,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=H*i:sk:779832c, H*f:sk:779832c, H*MI:sk:779832c, our X-HELO: drew.franken.de Date: Fri, 13 Jan 2017 10:48:58 +0100 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: Awk print statement alters the argument variable's content Message-ID: <20170113094858.GG23119@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <2241d4bbc7904b6aaf52d33fa820eab2 AT SESOEX0018 DOT global DOT scd DOT scania DOT com> <779832c0-e4dd-4528-aba2-ead6cae681b2 AT SystematicSw DOT ab DOT ca> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="4eRLI4hEmsdu6Npr" Content-Disposition: inline In-Reply-To: <779832c0-e4dd-4528-aba2-ead6cae681b2@SystematicSw.ab.ca> User-Agent: Mutt/1.7.1 (2016-10-04) --4eRLI4hEmsdu6Npr Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Jan 13 01:31, Brian Inglis wrote: > On 2017-01-12 05:26, Lundberg Christer wrote: > > This program run with GNU awk 4.1.4 (currently installed with > > Cygwin): > >=20 > > awk ' > > BEGIN { OFMT=3D"%.8g" > > buf =3D 1+0.1 > > buf =3D buf "a" > > print "Length before print:", length(buf) > > print buf " " > > print buf > > print buf " " > > print "Length after print:", length(buf) > > } > > ' > >=20 > > produces the following output on our system: > >=20 > > Length before print: 4 > > 1.1a=20 > > 1.1 > > 1.1=20 > > Length after print: 3 > >=20 > > so it appears that the "print buf" statement unexpectedly alters the > > content of buf. > > With awk 4.1.3, we got the expected output > >=20 > > Length before print: 4 > > 1.1a=20 > > 1.1a > > 1.1a=20 > > Length after print: 4 >=20 > Confirmed problem with any OFMT except default or %.6g, also goes=20 > away if you change awk line 3 to: buf =3D "" buf "a": It's an upstream bug. I asked on the gawk ML. Thanks, Corinna --=20 Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat --4eRLI4hEmsdu6Npr Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJYeKKKAAoJEPU2Bp2uRE+g8JkP/RGv7CdEQUqbqbJr6ugwtkcj 0ituSs5jA0VKUu72U6x3Ahx8vZoq+OA/Y2jd44zBjkfF+nJ2LbYrB+9l8j/RE3g+ HyCMNs9rQucVS6D+iiTGEUmFS2EzPMVbCAm042COaqiw4TOq91MrOSKZvCDLo2vg veSsZuVPFAE61vVqfppzC5/MzbrWapHYptPOuEl/RhE+sL2mFt5vb28y8d2pj4Km 8mNTsv8TfMLeDY866oSk60UqKximbbE49NDx4rr8eHWq7dSCmkhQDRIuIXg8nCrw SkyLyoC2eZ2OsMmi+tSfqAwmtMkR2jU/gQiwyvgpqMmc2RlUr5LPkaGTHGJQNuid gAYHH7mF/txamSebTiIPXqVYaDsR54NMGeQeLOcaroJOhzadgrnfQAvuy6CVvooQ sOphYV/TvObkWH8eyk7bavrPKeRZCzz3Ol+nb5Y+V2g2RUcuwrKvLAbia5qnlF15 36b0UlI0HKYMlmpIVtR03N1EVxxIv7WkRhlM8RQawrzyD4nWXX+ugyQUSpGRTpxv Pvh+puv7V1FmpO35Z06OWbVpOK5/aj4DIuMU5ktyF7G3/VcHTvWwT19qCr4YysCQ LpJekVRL/a1wbK9fiZapIUSzBOgz8IHN4Cql04FmqoTNf55RHoAK8pkCy4FAMSpt +IjxKzx0qIlMlShNk/kE =nsgR -----END PGP SIGNATURE----- --4eRLI4hEmsdu6Npr--