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