1*e6d6c189SCody Peter Mello#From hankedr@manatee.dms.auburn.edu Tue Oct 13 22:15:59 1998 2*e6d6c189SCody Peter Mello#Return-Path: <hankedr@manatee.dms.auburn.edu> 3*e6d6c189SCody Peter Mello#Received: from cssun.mathcs.emory.edu (cssun.mathcs.emory.edu [170.140.150.1]) 4*e6d6c189SCody Peter Mello# by dmx.netvision.net.il (8.9.0.Beta5/8.8.6) with ESMTP id PAA03924 5*e6d6c189SCody Peter Mello# for <arobbins@netvision.net.il>; Tue, 13 Oct 1998 15:32:13 +0200 (IST) 6*e6d6c189SCody Peter Mello#Received: from mescaline.gnu.org (we-refuse-to-spy-on-our-users@mescaline.gnu.org [158.121.106.21]) by cssun.mathcs.emory.edu (8.7.5/8.6.9-940818.01cssun) with ESMTP id KAA11644 for <arnold@mathcs.emory.edu>; Tue, 13 Oct 1998 10:22:32 -0400 (EDT) 7*e6d6c189SCody Peter Mello#Received: from manatee.dms.auburn.edu (manatee.dms.auburn.edu [131.204.53.104]) 8*e6d6c189SCody Peter Mello# by mescaline.gnu.org (8.9.1a/8.9.1) with ESMTP id KAA03250 9*e6d6c189SCody Peter Mello# for <arnold@gnu.org>; Tue, 13 Oct 1998 10:25:32 -0400 10*e6d6c189SCody Peter Mello#Received: (from hankedr@localhost) 11*e6d6c189SCody Peter Mello# by manatee.dms.auburn.edu (8.9.1a/8.9.1) id JAA13348; 12*e6d6c189SCody Peter Mello# Tue, 13 Oct 1998 09:22:29 -0500 (CDT) 13*e6d6c189SCody Peter Mello#Date: Tue, 13 Oct 1998 09:22:29 -0500 (CDT) 14*e6d6c189SCody Peter Mello#Message-Id: <199810131422.JAA13348@manatee.dms.auburn.edu> 15*e6d6c189SCody Peter Mello#From: Darrel Hankerson <hankedr@dms.auburn.edu> 16*e6d6c189SCody Peter Mello#To: arnold@gnu.org 17*e6d6c189SCody Peter Mello#In-reply-to: <199810131313.QAA31784@alpha.netvision.net.il> (message from 18*e6d6c189SCody Peter Mello# Aharon Robbins on Tue, 13 Oct 1998 16:10:36 +0200) 19*e6d6c189SCody Peter Mello#Subject: Re: full text of bug report? 20*e6d6c189SCody Peter Mello#Mime-Version: 1.0 21*e6d6c189SCody Peter Mello#Content-Type: text/plain; charset=US-ASCII 22*e6d6c189SCody Peter Mello#X-UIDL: bf3fce492dad4ab030c561e7b2f27d0a 23*e6d6c189SCody Peter Mello#Status: RO 24*e6d6c189SCody Peter Mello# 25*e6d6c189SCody Peter Mello# Do you have the full text of the a = a "\n" f() bug report? 26*e6d6c189SCody Peter Mello# I can't find it.... I'm not sure there really is a bug. 27*e6d6c189SCody Peter Mello# 28*e6d6c189SCody Peter Mello#Yes, see below. 29*e6d6c189SCody Peter Mello# 30*e6d6c189SCody Peter Mello#His example has unnecessary fragments (in particular, the use of 31*e6d6c189SCody Peter Mello#gensub is irrelevant). As I wrote to you earlier, the interesting 32*e6d6c189SCody Peter Mello#question for me is: 33*e6d6c189SCody Peter Mello# 34*e6d6c189SCody Peter Mello# Is the concatenation result undefined? If the result is defined or 35*e6d6c189SCody Peter Mello# implementation-dependent, then gawk has a bug. 36*e6d6c189SCody Peter Mello# 37*e6d6c189SCody Peter Mello# 38*e6d6c189SCody Peter Mello#=== Original report ===================================================== 39*e6d6c189SCody Peter Mello#From: Attila Torcsvari <arcdev@mail.matav.hu> 40*e6d6c189SCody Peter Mello#To: "'bug-gnu-utils@prep.ai.mit.edu'" <bug-gnu-utils@gnu.org> 41*e6d6c189SCody Peter Mello#Subject: gawk 3.0.3 bug 42*e6d6c189SCody Peter Mello#Date: Thu, 17 Sep 1998 18:12:13 +0200 43*e6d6c189SCody Peter Mello#MIME-Version: 1.0 44*e6d6c189SCody Peter Mello#Content-Transfer-Encoding: 7bit 45*e6d6c189SCody Peter Mello#Resent-From: bug-gnu-utils@gnu.org 46*e6d6c189SCody Peter Mello#X-Mailing-List: <bug-gnu-utils@gnu.org> archive/latest/3396 47*e6d6c189SCody Peter Mello#X-Loop: bug-gnu-utils@gnu.org 48*e6d6c189SCody Peter Mello#Precedence: list 49*e6d6c189SCody Peter Mello#Resent-Sender: bug-gnu-utils-request@gnu.org 50*e6d6c189SCody Peter Mello#Content-Transfer-Encoding: 7bit 51*e6d6c189SCody Peter Mello#Content-Type: text/plain; charset="us-ascii" 52*e6d6c189SCody Peter Mello#Content-Length: 618 53*e6d6c189SCody Peter Mello# 54*e6d6c189SCody Peter Mello#Bug-gnuers, 55*e6d6c189SCody Peter Mello#please pass it to the responsible. 56*e6d6c189SCody Peter Mello# 57*e6d6c189SCody Peter Mello#The following generates something interesting: 58*e6d6c189SCody Peter Mello# 59*e6d6c189SCody Peter MelloBEGIN{ 60*e6d6c189SCody Peter Melloa="aaaaa" 61*e6d6c189SCody Peter Melloa=a a #10 62*e6d6c189SCody Peter Melloa=a a #20 63*e6d6c189SCody Peter Melloa=a a #40 64*e6d6c189SCody Peter Melloa=a a #80 65*e6d6c189SCody Peter Melloa=a a #160 66*e6d6c189SCody Peter Melloa=a a # i.e. a is long enough 67*e6d6c189SCody Peter Mello 68*e6d6c189SCody Peter Melloa=a"\n"f() # this causes the trouble 69*e6d6c189SCody Peter Melloprint a # guess the result 70*e6d6c189SCody Peter Mello} 71*e6d6c189SCody Peter Mello 72*e6d6c189SCody Peter Mellofunction f() 73*e6d6c189SCody Peter Mello{ 74*e6d6c189SCody Peter Mello#print "a before: ", a 75*e6d6c189SCody Peter Mello#a=gensub("a","123,","g",a) # 'a' will be just a bit longer (4 times, but still should fit: 4*160=640) 76*e6d6c189SCody Peter Mellogsub(/a/, "123", a) 77*e6d6c189SCody Peter Mello#print "a after: ", a 78*e6d6c189SCody Peter Melloreturn "X" 79*e6d6c189SCody Peter Mello} 80*e6d6c189SCody Peter Mello# 81*e6d6c189SCody Peter Mello#Possible reason: 82*e6d6c189SCody Peter Mello#during f the a is modified, 83*e6d6c189SCody Peter Mello#it can be even freed, because gensub modifies its size 84*e6d6c189SCody Peter Mello#the printout contains trash. 85*e6d6c189SCody Peter Mello# 86*e6d6c189SCody Peter Mello#Used version: VC compiled WinNT 32 bit Intel. 87*e6d6c189SCody Peter Mello# 88*e6d6c189SCody Peter Mello#Regards, 89*e6d6c189SCody Peter Mello# 90*e6d6c189SCody Peter Mello#Attila Torcsvari 91*e6d6c189SCody Peter Mello#Arcanum Development 92*e6d6c189SCody Peter Mello# 93