xref: /illumos-gate/usr/src/test/util-tests/tests/awk/gnu/ofmtbig.awk (revision 3ee4fc2aa6b5136515cc3eed32d3c6ef33e37471)
1*3ee4fc2aSCody Peter Mello#
2*3ee4fc2aSCody Peter Mello#   [USEMAP]
3*3ee4fc2aSCody Peter Mello#
4*3ee4fc2aSCody Peter Mello#                            Problem Report gnu/7821
5*3ee4fc2aSCody Peter Mello#
6*3ee4fc2aSCody Peter Mello#   awk in free(): warning: chunk is already free.
7*3ee4fc2aSCody Peter Mello#
8*3ee4fc2aSCody Peter Mello#   Confidential
9*3ee4fc2aSCody Peter Mello#          no
10*3ee4fc2aSCody Peter Mello#
11*3ee4fc2aSCody Peter Mello#   Severity
12*3ee4fc2aSCody Peter Mello#          serious
13*3ee4fc2aSCody Peter Mello#
14*3ee4fc2aSCody Peter Mello#   Priority
15*3ee4fc2aSCody Peter Mello#          medium
16*3ee4fc2aSCody Peter Mello#
17*3ee4fc2aSCody Peter Mello#   Responsible
18*3ee4fc2aSCody Peter Mello#          freebsd-bugs@freebsd.org
19*3ee4fc2aSCody Peter Mello#
20*3ee4fc2aSCody Peter Mello#   State
21*3ee4fc2aSCody Peter Mello#          suspended
22*3ee4fc2aSCody Peter Mello#
23*3ee4fc2aSCody Peter Mello#   Class
24*3ee4fc2aSCody Peter Mello#          sw-bug
25*3ee4fc2aSCody Peter Mello#
26*3ee4fc2aSCody Peter Mello#   Submitter-Id
27*3ee4fc2aSCody Peter Mello#          current-users
28*3ee4fc2aSCody Peter Mello#
29*3ee4fc2aSCody Peter Mello#   Arrival-Date
30*3ee4fc2aSCody Peter Mello#          Thu Sep 3 10:30:00 PDT 1998
31*3ee4fc2aSCody Peter Mello#
32*3ee4fc2aSCody Peter Mello#   Last-Modified
33*3ee4fc2aSCody Peter Mello#          Thu Sep 17 02:04:26 PDT 1998
34*3ee4fc2aSCody Peter Mello#
35*3ee4fc2aSCody Peter Mello#   Originator
36*3ee4fc2aSCody Peter Mello#          Alexander Litvin archer@lucky.net
37*3ee4fc2aSCody Peter Mello#
38*3ee4fc2aSCody Peter Mello#   Organization
39*3ee4fc2aSCody Peter Mello#
40*3ee4fc2aSCody Peter Mello#
41*3ee4fc2aSCody Peter Mello#Lucky Net ltd.
42*3ee4fc2aSCody Peter Mello#
43*3ee4fc2aSCody Peter Mello#   Release
44*3ee4fc2aSCody Peter Mello#          FreeBSD 3.0-CURRENT i386
45*3ee4fc2aSCody Peter Mello#
46*3ee4fc2aSCody Peter Mello#   Environment
47*3ee4fc2aSCody Peter Mello#
48*3ee4fc2aSCody Peter Mello#
49*3ee4fc2aSCody Peter Mello#FreeBSD grape.carrier.kiev.ua 3.0-CURRENT FreeBSD 3.0-CURRENT #121: Thu Sep  3
50*3ee4fc2aSCody Peter Mello#1
51*3ee4fc2aSCody Peter Mello#1:21:44 EEST 1998     archer@grape.carrier.kiev.ua:/usr/src/sys/compile/GRAPE
52*3ee4fc2aSCody Peter Mello#i
53*3ee4fc2aSCody Peter Mello#386
54*3ee4fc2aSCody Peter Mello#
55*3ee4fc2aSCody Peter Mello#   Description
56*3ee4fc2aSCody Peter Mello#
57*3ee4fc2aSCody Peter Mello#
58*3ee4fc2aSCody Peter Mello#The problem first appeared when GNU awk in 3.0-CURRENT was apgraded to
59*3ee4fc2aSCody Peter Mello#3.0.3. I run C-News, which uses awk extensively. After awk apgrade C-News
60*3ee4fc2aSCody Peter Mello#expire stopped to work. It appeared that some GNU awk 3.0.3 programms when
61*3ee4fc2aSCody Peter Mello#given absolutely legitimate input fail, giving out a number of messages:
62*3ee4fc2aSCody Peter Mello#
63*3ee4fc2aSCody Peter Mello#awk in free(): warning: chunk is already free.
64*3ee4fc2aSCody Peter Mello#
65*3ee4fc2aSCody Peter Mello#   How-To-Repeat
66*3ee4fc2aSCody Peter Mello#
67*3ee4fc2aSCody Peter Mello#
68*3ee4fc2aSCody Peter Mello#Run the following awk program (it is cut out of C-News expire scripts).
69*3ee4fc2aSCody Peter Mello#I was not able to cut it down more -- omitting some portions of the
70*3ee4fc2aSCody Peter Mello#code (e.g. OFMT line), make error go away in this case, though it
71*3ee4fc2aSCody Peter Mello#certainly does not fix awk.
72*3ee4fc2aSCody Peter Mello#
73*3ee4fc2aSCody Peter Mello#----------------cut-here----------------
74*3ee4fc2aSCody Peter Mello#!/usr/bin/awk -f
75*3ee4fc2aSCody Peter MelloBEGIN {
76*3ee4fc2aSCody Peter Mello        OFMT = "%.12g"
77*3ee4fc2aSCody Peter Mello        big = 99999999999
78*3ee4fc2aSCody Peter Mello        lowest = big
79*3ee4fc2aSCody Peter Mello        small = 0
80*3ee4fc2aSCody Peter Mello        highest = small
81*3ee4fc2aSCody Peter Mello}
82*3ee4fc2aSCody Peter Mello
83*3ee4fc2aSCody Peter Mello$0 ~ /^[0-9]+$/ {
84*3ee4fc2aSCody Peter Mello        if ($1 < lowest)
85*3ee4fc2aSCody Peter Mello                lowest = $1
86*3ee4fc2aSCody Peter Mello        if ($1 > highest)
87*3ee4fc2aSCody Peter Mello                highest = $1
88*3ee4fc2aSCody Peter Mello        next
89*3ee4fc2aSCody Peter Mello}
90*3ee4fc2aSCody Peter Mello
91*3ee4fc2aSCody Peter Mello# $0 ~ /^[a-z]+/ {
92*3ee4fc2aSCody Peter Mello$0 ~ /^[[:lower:]]+/ {
93*3ee4fc2aSCody Peter Mello        print dir, highest, lowest
94*3ee4fc2aSCody Peter Mello        dir = $0
95*3ee4fc2aSCody Peter Mello        lowest = big
96*3ee4fc2aSCody Peter Mello        highest = small
97*3ee4fc2aSCody Peter Mello}
98*3ee4fc2aSCody Peter Mello#----------------cut-here----------------
99*3ee4fc2aSCody Peter Mello#
100*3ee4fc2aSCody Peter Mello#To get the error, just give this script the following input:
101*3ee4fc2aSCody Peter Mello#----------------cut-here----------------
102*3ee4fc2aSCody Peter Mello#a
103*3ee4fc2aSCody Peter Mello#1
104*3ee4fc2aSCody Peter Mello#b
105*3ee4fc2aSCody Peter Mello#----------------cut-here----------------
106*3ee4fc2aSCody Peter Mello#
107*3ee4fc2aSCody Peter Mello#   Fix
108*3ee4fc2aSCody Peter Mello#
109*3ee4fc2aSCody Peter Mello#
110*3ee4fc2aSCody Peter Mello#I was not able to track the error in awk sources. As a workaround,
111*3ee4fc2aSCody Peter Mello#I just reverted to GNU awk 2.15.5.
112*3ee4fc2aSCody Peter Mello#
113*3ee4fc2aSCody Peter Mello#   Audit-Trail
114*3ee4fc2aSCody Peter Mello#
115*3ee4fc2aSCody Peter Mello#
116*3ee4fc2aSCody Peter Mello#State-Changed-From-To: open-suspended
117*3ee4fc2aSCody Peter Mello#State-Changed-By: phk
118*3ee4fc2aSCody Peter Mello#State-Changed-When: Thu Sep 17 02:04:08 PDT 1998
119*3ee4fc2aSCody Peter Mello#State-Changed-Why:
120*3ee4fc2aSCody Peter Mello#reported to GNU maintainer.
121*3ee4fc2aSCody Peter Mello#
122*3ee4fc2aSCody Peter Mello#   Submit Followup
123*3ee4fc2aSCody Peter Mello#     _________________________________________________________________
124*3ee4fc2aSCody Peter Mello#
125*3ee4fc2aSCody Peter Mello#
126*3ee4fc2aSCody Peter Mello#    www@freebsd.org
127