1*3ee4fc2aSCody Peter Mello# From jose@monkey.org  Thu Jun  5 11:48:35 2003
2*3ee4fc2aSCody Peter Mello# Return-Path: <jose@monkey.org>
3*3ee4fc2aSCody Peter Mello# Received: from localhost (skeeve [127.0.0.1])
4*3ee4fc2aSCody Peter Mello# 	by skeeve.com (8.12.5/8.12.5) with ESMTP id h558eVvA012655
5*3ee4fc2aSCody Peter Mello# 	for <arnold@localhost>; Thu, 5 Jun 2003 11:48:35 +0300
6*3ee4fc2aSCody Peter Mello# Received: from actcom.co.il [192.114.47.1]
7*3ee4fc2aSCody Peter Mello# 	by localhost with POP3 (fetchmail-5.9.0)
8*3ee4fc2aSCody Peter Mello# 	for arnold@localhost (single-drop); Thu, 05 Jun 2003 11:48:35 +0300 (IDT)
9*3ee4fc2aSCody Peter Mello# Received: by actcom.co.il (mbox arobbins)
10*3ee4fc2aSCody Peter Mello#  (with Cubic Circle's cucipop (v1.31 1998/05/13) Thu Jun  5 11:47:59 2003)
11*3ee4fc2aSCody Peter Mello# X-From_: jose@monkey.org Thu Jun  5 07:14:45 2003
12*3ee4fc2aSCody Peter Mello# Received: from smtp1.actcom.net.il by actcom.co.il  with ESMTP
13*3ee4fc2aSCody Peter Mello# 	(8.11.6/actcom-0.2) id h554EdY08108 for <arobbins@actcom.co.il>;
14*3ee4fc2aSCody Peter Mello# 	Thu, 5 Jun 2003 07:14:41 +0300 (EET DST)
15*3ee4fc2aSCody Peter Mello# 	(rfc931-sender: smtp.actcom.co.il [192.114.47.13])
16*3ee4fc2aSCody Peter Mello# Received: from f7.net (consort.superb.net [209.61.216.22])
17*3ee4fc2aSCody Peter Mello# 	by smtp1.actcom.net.il (8.12.8/8.12.8) with ESMTP id h554G3To008304
18*3ee4fc2aSCody Peter Mello# 	for <arobbins@actcom.co.il>; Thu, 5 Jun 2003 07:16:05 +0300
19*3ee4fc2aSCody Peter Mello# Received: from fencepost.gnu.org (fencepost.gnu.org [199.232.76.164])
20*3ee4fc2aSCody Peter Mello# 	by f7.net (8.11.7/8.11.6) with ESMTP id h554Ean08172
21*3ee4fc2aSCody Peter Mello# 	for <arnold@skeeve.com>; Thu, 5 Jun 2003 00:14:36 -0400
22*3ee4fc2aSCody Peter Mello# Received: from monty-python.gnu.org ([199.232.76.173])
23*3ee4fc2aSCody Peter Mello# 	by fencepost.gnu.org with esmtp (Exim 4.20)
24*3ee4fc2aSCody Peter Mello# 	id 19Nm96-0001xE-1i
25*3ee4fc2aSCody Peter Mello# 	for arnold@gnu.ai.mit.edu; Thu, 05 Jun 2003 00:14:36 -0400
26*3ee4fc2aSCody Peter Mello# Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.20)
27*3ee4fc2aSCody Peter Mello# 	id 19Nm8x-0005ge-Dz
28*3ee4fc2aSCody Peter Mello# 	for arnold@gnu.ai.mit.edu; Thu, 05 Jun 2003 00:14:28 -0400
29*3ee4fc2aSCody Peter Mello# Received: from naughty.monkey.org ([66.93.9.164])
30*3ee4fc2aSCody Peter Mello# 	by monty-python.gnu.org with esmtp (Exim 4.20)
31*3ee4fc2aSCody Peter Mello# 	id 19Nm8w-0005VM-Ko
32*3ee4fc2aSCody Peter Mello# 	for arnold@gnu.ai.mit.edu; Thu, 05 Jun 2003 00:14:26 -0400
33*3ee4fc2aSCody Peter Mello# Received: by naughty.monkey.org (Postfix, from userid 1203)
34*3ee4fc2aSCody Peter Mello# 	id C15511BA97B; Thu,  5 Jun 2003 00:14:19 -0400 (EDT)
35*3ee4fc2aSCody Peter Mello# Received: from localhost (localhost [127.0.0.1])
36*3ee4fc2aSCody Peter Mello# 	by naughty.monkey.org (Postfix) with ESMTP
37*3ee4fc2aSCody Peter Mello# 	id BF9821BA969; Thu,  5 Jun 2003 00:14:19 -0400 (EDT)
38*3ee4fc2aSCody Peter Mello# Date: Thu, 5 Jun 2003 00:14:19 -0400 (EDT)
39*3ee4fc2aSCody Peter Mello# From: Jose Nazario <jose@monkey.org>
40*3ee4fc2aSCody Peter Mello# To: bug-gnu-utils@prep.ai.mit.edu, arnold@gnu.ai.mit.edu,
41*3ee4fc2aSCody Peter Mello#    netbsd-bugs@netbsd.org
42*3ee4fc2aSCody Peter Mello# Subject: bug in gawk/gsub() (not present in nawk)
43*3ee4fc2aSCody Peter Mello# Message-ID: <Pine.BSO.4.51.0306050007160.31577@naughty.monkey.org>
44*3ee4fc2aSCody Peter Mello# MIME-Version: 1.0
45*3ee4fc2aSCody Peter Mello# Content-Type: TEXT/PLAIN; charset=US-ASCII
46*3ee4fc2aSCody Peter Mello# X-Spam-Status: No, hits=-1.2 required=5.0
47*3ee4fc2aSCody Peter Mello# 	tests=SPAM_PHRASE_00_01,USER_AGENT_PINE
48*3ee4fc2aSCody Peter Mello# 	version=2.41
49*3ee4fc2aSCody Peter Mello# X-Spam-Level:
50*3ee4fc2aSCody Peter Mello# X-SpamBouncer: 1.4 (10/07/01)
51*3ee4fc2aSCody Peter Mello# X-SBClass: OK
52*3ee4fc2aSCody Peter Mello# Status: R
53*3ee4fc2aSCody Peter Mello#
54*3ee4fc2aSCody Peter Mello# while playing with some tools in data massaging, i had to migrate from an
55*3ee4fc2aSCody Peter Mello# openbsd/nawk system to a netbsd/gawk system. i found the folllowing
56*3ee4fc2aSCody Peter Mello# behavior, which seems to be a bug.
57*3ee4fc2aSCody Peter Mello#
58*3ee4fc2aSCody Peter Mello# the following gsub() pattern has a strange effect under gawk which is not
59*3ee4fc2aSCody Peter Mello# visible in nawk (at least as compiled on openbsd). the intention is to
60*3ee4fc2aSCody Peter Mello# take a string like "This Is a Title: My Title?" and turn it into a
61*3ee4fc2aSCody Peter Mello# normalized string: "ThisIsaTitleMyTitle". to do this, i wrote the
62*3ee4fc2aSCody Peter Mello# following gross gsub line in an awk script:
63*3ee4fc2aSCody Peter Mello#
64*3ee4fc2aSCody Peter Mello# 	gsub(/[\ \"-\/\\:;\[\]\@\?\.\,\$]/, "", $2)
65*3ee4fc2aSCody Peter Mello# 	print $2
66*3ee4fc2aSCody Peter Mello#
67*3ee4fc2aSCody Peter Mello# in gawk, as found in netbsd-macppc/1.5.2, this will drop the first letter
68*3ee4fc2aSCody Peter Mello# of every word. the resulting string will be "hissitleyitle", while in nawk
69*3ee4fc2aSCody Peter Mello# as built on openbsd-3.3 this will get it correct.
70*3ee4fc2aSCody Peter Mello#
71*3ee4fc2aSCody Peter Mello# any insights? the inconsistency with this relatively naive pattern seems a
72*3ee4fc2aSCody Peter Mello# bit odd. (i would up installing nawk built from openbsd sources.)
73*3ee4fc2aSCody Peter Mello#
74*3ee4fc2aSCody Peter Mello# thanks. sorry i didn't send a better bug report, netbsd folks, i'm not
75*3ee4fc2aSCody Peter Mello# much of a netbsd user, and i dont have send-pr set up. yes, this is a
76*3ee4fc2aSCody Peter Mello# slightly older version of netbsd and gawk:
77*3ee4fc2aSCody Peter Mello#
78*3ee4fc2aSCody Peter Mello# $ uname -a
79*3ee4fc2aSCody Peter Mello# NetBSD entropy 1.5.2 NetBSD 1.5.2 (GENERIC) #0: Sun Feb 10 02:00:04 EST
80*3ee4fc2aSCody Peter Mello# 2002     jose@entropy:/usr/src/sys/arch/macppc/compile/GENERIC macppc
81*3ee4fc2aSCody Peter Mello# $ awk --version
82*3ee4fc2aSCody Peter Mello# GNU Awk 3.0.3
83*3ee4fc2aSCody Peter Mello# Copyright (C) 1989, 1991-1997 Free Software Foundation.
84*3ee4fc2aSCody Peter Mello#
85*3ee4fc2aSCody Peter Mello#
86*3ee4fc2aSCody Peter Mello#
87*3ee4fc2aSCody Peter Mello# thanks.
88*3ee4fc2aSCody Peter Mello#
89*3ee4fc2aSCody Peter Mello# ___________________________
90*3ee4fc2aSCody Peter Mello# jose nazario, ph.d.			jose@monkey.org
91*3ee4fc2aSCody Peter Mello# 					http://monkey.org/~jose/
92*3ee4fc2aSCody Peter Mello#
93*3ee4fc2aSCody Peter Mello#
94*3ee4fc2aSCody Peter Mello{
95*3ee4fc2aSCody Peter Mello	gsub(/[\ \"-\/\\:;\[\]\@\?\.\,\$]/, "")
96*3ee4fc2aSCody Peter Mello 	print
97*3ee4fc2aSCody Peter Mello}
98