X-Recipient: archive-cygwin@delorie.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:from:to:subject:date:message-id:content-type
	:content-transfer-encoding:mime-version; q=dns; s=default; b=a7K
	lJ5aR2tae6f2r2gqBMyw/FSBnakwSc2Qil/MaJ3y0S7muwpV1ohPbPo3Wrn8kJn8
	UCxrdikmpbM+vTasChvg1aYy2f87J8hbSsZpR7/Ua/9qYg2p4h1dn/S0PY4QrAnK
	iMItCIN6UEGi1T3o0V+aLGkyE3P01m91L42xcc48=
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:from:to:subject:date:message-id:content-type
	:content-transfer-encoding:mime-version; s=default; bh=ByA6w77Yl
	oUYS29G6iUlwqUwQyU=; b=l+Ragm8f/YVBCu819+iq/6H8TT0ma0yAVx3O/gb0F
	qCUCuAgxRm8euTbYWzMPwige8F8NW8dp0g6NDUwx1xT56fg2FMvJh6WDTo/N3aP/
	n3V5VAFfJJcyjFCjCKziLpMlC0iK87FCcql+y3sGN4w18Y9sx6eRjxuLtVV1fF1L
	ao=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=0.1 required=5.0 tests=AWL,BAYES_20,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-spam-relays-external:sk:mail1.b, H*RU:sk:mail1.b, HX-HELO:sk:mail1.b, our
X-HELO: mail1.bemta5.messagelabs.com
X-Env-Sender: christer.lundberg@scania.com
X-Msg-Ref: server-4.tower-49.messagelabs.com!1484223990!32747573!6
X-StarScan-Received:
X-StarScan-Version: 9.1.1; banners=-,-,-
X-VirusChecked: Checked
From: Lundberg Christer <christer.lundberg@scania.com>
To: "cygwin@cygwin.com" <cygwin@cygwin.com>
Subject: Awk print statement alters the argument variable's content
Date: Thu, 12 Jan 2017 12:26:36 +0000
Message-ID: <2241d4bbc7904b6aaf52d33fa820eab2@SESOEX0018.global.scd.scania.com>
x-ms-exchange-transport-fromentityheader: Hosted
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id v0CCRwi7022393

This program run with GNU awk 4.1.4 (currently installed with Cygwin):

  awk '
    BEGIN { OFMT="%.8g"
            buf = 1+0.1
            buf = buf "a"
            print "Length before print:", length(buf)
            print buf " "
            print buf
            print buf " "
            print "Length after print:", length(buf)
          }
  '

produces the following output on our system:

Length before print: 4
1.1a 
1.1
1.1 
Length after print: 3

so it appears that the "print buf" statement unexpectedly alters the content of buf.
With awk 4.1.3, we got the expected output

Length before print: 4
1.1a 
1.1a
1.1a 
Length after print: 4


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


