xref: /illumos-gate/usr/src/test/util-tests/tests/awk/gnu/manglprm.awk (revision 4e5ef1cee66fbfbbd2b3e56b81e2bb5700f4a59e)
1# From beebe@sunshine.math.utah.edu  Thu Jul 10 00:36:16 2003
2# Date: Wed, 9 Jul 2003 06:42:54 -0600 (MDT)
3# From: "Nelson H. F. Beebe" <beebe@math.utah.edu>
4# To: "Arnold Robbins" <arnold@skeeve.com>
5# Cc: beebe@math.utah.edu
6# X-US-Mail: "Center for Scientific Computing, Department of Mathematics, 110
7#         LCB, University of Utah, 155 S 1400 E RM 233, Salt Lake City, UT
8#         84112-0090, USA"
9# X-Telephone: +1 801 581 5254
10# X-FAX: +1 801 585 1640, +1 801 581 4148
11# X-URL: http://www.math.utah.edu/~beebe
12# Subject: gawk-3.1.3 (and earlier): reproducible core dump
13# X-SpamBouncer: 1.4 (10/07/01)
14# X-SBClass: OK
15#
16# I have a reproducible core dump in gawk-3.1.3, and recent gawk
17# versions.
18#
19# Consider the following test program,  reduced from a much larger one:
20#
21#         % cat gawk-dump.awk
22
23				{ process($0) }
24
25	function out_debug(s)
26	{
27	     print s
28	}
29
30	function process(s,   n,parts)
31	{
32	    out_debug("Buffer = [" protect(Buffer) "]")
33	    Buffer = Buffer s
34	    n = split(Buffer,parts,"\n")
35	}
36
37	function protect(s)
38	{
39	    gsub("\n", "\\n", s)
40	    return (s)
41	}
42