source: trunk/essentials/sys-apps/gawk/test/clobber.awk

Last change on this file was 3076, checked in by bird, 18 years ago

gawk 3.1.5

File size: 3.8 KB
Line 
1BEGIN {
2 print "000800" > "seq"
3 close("seq")
4 ARGV[1] = "seq"
5 ARGC = 2
6}
7
8{ printf "%06d", $1 + 1 >"seq";
9 printf "%06d", $1 + 1 }
10# Date: Mon, 20 Jan 1997 15:14:06 -0600 (CST)
11# From: Dave Bodenstab <emory!synet.net!imdave>
12# To: bug-gnu-utils@prep.ai.mit.edu
13# Subject: GNU awk 3.0.2 core dump
14# Cc: arnold@gnu.ai.mit.edu
15#
16# The following program produces a core file on my FreeBSD system:
17#
18# bash$ echo 000800 >/tmp/seq
19# bash$ gawk '{ printf "%06d", $1 + 1 >"/tmp/seq";
20# printf "%06d", $1 + 1 }' /tmp/seq
21#
22# This fragment comes from mgetty+sendfax.
23#
24# Here is the trace:
25#
26# Script started on Mon Jan 20 15:09:04 1997
27# bash$ gawk --version
28# GNU Awk 3.0.2
29# Copyright (C) 1989, 1991-1996 Free Software Foundation.
30#
31# This program is free software; you can redistribute it and/or modify
32# it under the terms of the GNU General Public License as published by
33# the Free Software Foundation; either version 2 of the License, or
34# (at your option) any later version.
35#
36# This program is distributed in the hope that it will be useful,
37# but WITHOUT ANY WARRANTY; without even the implied warranty of
38# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
39# GNU General Public License for more details.
40#
41# You should have received a copy of the GNU General Public License
42# along with this program; if not, write to the Free Software
43# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
44# bash$ gdb gawk
45# GDB is free software and you are welcome to distribute copies of it
46# under certain conditions; type "show copying" to see the conditions.
47# There is absolutely no warranty for GDB; type "show warranty" for details.
48# GDB 4.13 (i386-unknown-freebsd),
49# Copyright 1994 Free Software Foundation, Inc...
50# (gdb) shell echo 000800 >/tmp/seq
51# (gdb) r '{ printf "%06d", $1 + 1 >"/tmp/seq"; printf "%06d", $1 + 1 }(gdb) r '{ printf "%06d", $1 + 1 >"/tmp/seq"; printf "%06d", $1 + 1 }' /tmp/seq
52# Starting program: /scratch/archive/src/cmd/gnuawk-3.0.2/gawk '{ printf "%06d", $1 + 1 >"/tmp/seq"; printf "%06d", $1 + 1 }' /tmp/seq
53#
54# Program received signal SIGBUS, Bus error.
55# 0xd86f in def_parse_field (up_to=1, buf=0x37704, len=6, fs=0x3b240, rp=0x0,
56# set=0xce6c <set_field>, n=0x0) at field.c:391
57# 391 sav = *end;
58# (gdb) bt
59# #0 0xd86f in def_parse_field (up_to=1, buf=0x37704, len=6, fs=0x3b240,
60# rp=0x0, set=0xce6c <set_field>, n=0x0) at field.c:391
61# #1 0xddb1 in get_field (requested=1, assign=0x0) at field.c:669
62# #2 0xc25d in r_get_lhs (ptr=0x3b9b4, assign=0x0) at eval.c:1339
63# #3 0x9ab0 in r_tree_eval (tree=0x3b9b4, iscond=0) at eval.c:604
64# #4 0xa5f1 in r_tree_eval (tree=0x3b9fc, iscond=0) at eval.c:745
65# #5 0x4661 in format_tree (fmt_string=0x3e040 "%06d", n0=0, carg=0x3ba20)
66# at builtin.c:620
67# #6 0x5beb in do_sprintf (tree=0x3b96c) at builtin.c:809
68# #7 0x5cd5 in do_printf (tree=0x3ba8c) at builtin.c:844
69# #8 0x9271 in interpret (tree=0x3ba8c) at eval.c:465
70# #9 0x8ca3 in interpret (tree=0x3bbd0) at eval.c:308
71# #10 0x8c34 in interpret (tree=0x3bc18) at eval.c:292
72# #11 0xf069 in do_input () at io.c:312
73# #12 0x12ba9 in main (argc=3, argv=0xefbfd538) at main.c:393
74# (gdb) l
75# 386 *buf += len;
76# 387 return nf;
77# 388 }
78# 389
79# 390 /* before doing anything save the char at *end */
80# 391 sav = *end;
81# 392 /* because it will be destroyed now: */
82# 393
83# 394 *end = ' '; /* sentinel character */
84# 395 for (; nf < up_to; scan++) {
85# (gdb) print end
86# $1 = 0x804d006 <Error reading address 0x804d006: No such file or directory>
87# (gdb) print buf
88# $2 = (char **) 0x37704
89# (gdb) print *buf
90# $3 = 0x804d000 <Error reading address 0x804d000: No such file or directory>
91# (gdb) q
92# The program is running. Quit anyway (and kill it)? (y or n) y
93# bash$ exit
94#
95# Script done on Mon Jan 20 15:11:07 1997
96#
97# Dave Bodenstab
98# imdave@synet.net
Note: See TracBrowser for help on using the repository browser.