userland: add archive tools and pinned GoAWK, esbuild, and QuickJS

This commit is contained in:
2026-11-07 10:56:29 +00:00
parent 7e7e49bfa2
commit d79b2bc2e1
1798 changed files with 562969 additions and 1 deletions
+46
View File
@@ -0,0 +1,46 @@
Original README.TESTS from one-true-awk regdir tests directory:
---------------------------------------------------------------
The archive of test files contains
- A shell file called REGRESS that controls the testing process.
- Several shell files called Compare* that control sub-parts
of the testing.
- About 160 small tests called t.* that constitute a random
sampling of awk constructions collected over the years.
Not organized, but they touch almost everything.
- About 60 small tests called p.* that come from the first
two chapters of The AWK Programming Environment. This is
basic stuff -- they have to work.
These two sets are intended as regression tests, to be sure
that a new version produces the same results as a previous one.
There are a couple of standard data files used with them,
test.data and test.countries, but others would work too.
- About 20 files called T.* that are self-contained and
more systematic tests of specific language features.
For example, T.clv tests command-line variable handling.
These tests are not regressions -- they compute the right
answer by separate means, then compare the awk output.
A specific test for each new bug found shows up in at least
one of these, most often T.misc. There are about 220 tests
total in these files.
- Two of these files, T.re and T.sub, are systematic tests
of the regular expression and substitution code. They express
tests in a small language, then generate awk programs that
verify behavior.
- About 20 files called tt.* that are used as timing tests;
they use the most common awk constructions in straightforward
ways, against a large input file constructed by Compare.tt.
There is undoubtedly more stuff in the archive; it's been
collecting for years and may need pruning. Suggestions for
improvement, additional tests (especially systematic ones),
and the like are all welcome.
+17
View File
@@ -0,0 +1,17 @@
BEGIN {
for (i = 1; i < ARGC; i++) {
if (ARGV[i] == "--") {
delete ARGV[i++]
break
}
else if (ARGV[i] !~ /^-./) break
else if (ARGV[i] == "-c") c = 1
else if (ARGV[i] == "-w") w = 1
else if (ARGV[i] == "-l") l = 1
else printf "awc: unknown option: %s\n", ARGV[i] >"/dev/stderr"
delete ARGV[i]
}
if (!c && !w && !l) c = w = l = 1
}
{ cs += length(); ws += NF; ls++ }
END { printf "%s%s%s\n", l?ls" ":"", w?ws" ":"", c?cs" ":"" }
+11
View File
@@ -0,0 +1,11 @@
BEGIN {
print "hello"
callF()
callF()
callF()
exit 0 # this will call END
}
function callF(){
print "world"
}
END{ print "END" }
@@ -0,0 +1,33 @@
BEGIN {
__COVER[1]++
print "hello"
callF()
callF()
callF()
exit 0
}
BEGIN {
__COVER[3]++
if (1) {
__COVER[2]++
print "hello"
print "world"
}
__COVER[5]++
print "end"
for (i = 0; i < 7; i++) {
__COVER[4]++
print i
}
}
END {
__COVER[6]++
print "END"
}
function callF() {
__COVER[7]++
print "world"
}
@@ -0,0 +1,3 @@
1 a1.awk 2:3-6:30 5
2 a1.awk 11:6-11:18 1
3 a1.awk 9:3-9:16 1
@@ -0,0 +1,18 @@
BEGIN {
__COVER[1] = 1
print "hello"
callF()
callF()
callF()
exit 0
}
END {
__COVER[2] = 1
print "END"
}
function callF() {
__COVER[3] = 1
print "world"
}
+8
View File
@@ -0,0 +1,8 @@
BEGIN {
if (1) {
print "hello"
print "world"
}
print "end"
for (i=0; i<7; i++) print i
}
@@ -0,0 +1,4 @@
1 a2.awk 3:5-4:18 2
2 a2.awk 2:3-2:10 1
3 a2.awk 7:23-7:30 1
4 a2.awk 6:3-7:23 2
@@ -0,0 +1,14 @@
BEGIN {
__COVER[2]++
if (1) {
__COVER[1]++
print "hello"
print "world"
}
__COVER[4]++
print "end"
for (i = 0; i < 7; i++) {
__COVER[3]++
print i
}
}
+22
View File
@@ -0,0 +1,22 @@
BEGIN {
if (1) {
for (i=0; i<10; i++) {
print i
while (1) {
do {
for (j in A) {
print j
if (2) {
print 2
{
if (3) print 3
}
} else {
continue
}
}
} while(1)
}
}
}
}
@@ -0,0 +1,10 @@
1 a3.awk 12:24-12:31 1
2 a3.awk 12:17-12:24 1
3 a3.awk 10:15-13:16 2
4 a3.awk 15:15-15:23 1
5 a3.awk 8:13-9:20 2
6 a3.awk 7:11-7:24 1
7 a3.awk 6:9-18:19 1
8 a3.awk 4:7-5:17 2
9 a3.awk 3:5-3:26 1
10 a3.awk 2:3-2:10 1
@@ -0,0 +1,34 @@
BEGIN {
__COVER[10] = 1
if (1) {
__COVER[9] = 1
for (i = 0; i < 10; i++) {
__COVER[8] = 1
print i
while (1) {
__COVER[7] = 1
do {
__COVER[6] = 1
for (j in A) {
__COVER[5] = 1
print j
if (2) {
__COVER[3] = 1
print 2
{
__COVER[2] = 1
if (3) {
__COVER[1] = 1
print 3
}
}
} else {
__COVER[4] = 1
continue
}
}
} while (1)
}
}
}
}
@@ -0,0 +1,7 @@
mode: set
a1.awk:2.3,6.30 5 1
a1.awk:11.6,11.18 1 1
a1.awk:9.3,9.16 1 1
a1.awk:2.3,6.30 5 1
a1.awk:11.6,11.18 1 1
a1.awk:9.3,9.16 1 1
@@ -0,0 +1,4 @@
mode: set
a1.awk:2.3,6.30 5 1
a1.awk:11.6,11.18 1 1
a1.awk:9.3,9.16 1 1
@@ -0,0 +1,15 @@
mode: count
a2.awk:3.5,4.18 2 1
a2.awk:2.3,2.10 1 1
a2.awk:7.23,7.30 1 7
a2.awk:6.3,7.23 2 1
a1.awk:2.3,6.30 5 1
a1.awk:11.6,11.18 1 1
a1.awk:9.3,9.16 1 3
a2.awk:3.5,4.18 2 1
a2.awk:2.3,2.10 1 1
a2.awk:7.23,7.30 1 7
a2.awk:6.3,7.23 2 1
a1.awk:2.3,6.30 5 1
a1.awk:11.6,11.18 1 1
a1.awk:9.3,9.16 1 3
@@ -0,0 +1,8 @@
mode: count
a2.awk:3.5,4.18 2 1
a2.awk:2.3,2.10 1 1
a2.awk:7.23,7.30 1 7
a2.awk:6.3,7.23 2 1
a1.awk:2.3,6.30 5 1
a1.awk:11.6,11.18 1 1
a1.awk:9.3,9.16 1 3
@@ -0,0 +1,8 @@
mode: count
a2.awk:3.5,4.18 2 1
a2.awk:2.3,2.10 1 1
a2.awk:7.23,7.30 1 7
a2.awk:6.3,7.23 2 1
a1.awk:2.3,6.30 5 1
a1.awk:11.6,11.18 1 1
a1.awk:9.3,9.16 1 3
@@ -0,0 +1,8 @@
mode: set
a2.awk:3.5,4.18 2 1
a2.awk:2.3,2.10 1 1
a2.awk:7.23,7.30 1 1
a2.awk:6.3,7.23 2 1
a1.awk:2.3,6.30 5 1
a1.awk:11.6,11.18 1 1
a1.awk:9.3,9.16 1 1
+4
View File
@@ -0,0 +1,4 @@
mode: count
a1.awk:2.3,6.30 5 1
a1.awk:11.6,11.18 1 1
a1.awk:9.3,9.16 1 3
+4
View File
@@ -0,0 +1,4 @@
mode: set
a1.awk:2.3,6.30 5 1
a1.awk:11.6,11.18 1 1
a1.awk:9.3,9.16 1 1
+3
View File
@@ -0,0 +1,3 @@
name,age
Bob,42
Jill,37
1 name age
2 Bob 42
3 Jill 37
+2
View File
@@ -0,0 +1,2 @@
age,email,name
25,sarah@example.com,Sarah
1 age email name
2 25 sarah@example.com Sarah
+2
View File
@@ -0,0 +1,2 @@
name,address_1,address_2,address_3,address_4,address_5
Bob Smith,123 Way St,Apt 2B,Township,Cityville,United Plates
1 name address_1 address_2 address_3 address_4 address_5
2 Bob Smith 123 Way St Apt 2B Township Cityville United Plates
+2
View File
@@ -0,0 +1,2 @@
id,name,email
1,Bob,b@bob.com
1 id name email
2 1 Bob b@bob.com
File diff suppressed because it is too large Load Diff
+52
View File
@@ -0,0 +1,52 @@
"State","Abbreviation"
"Alabama","AL"
"Alaska","AK"
"Arizona","AZ"
"Arkansas","AR"
"California","CA"
"Colorado","CO"
"Connecticut","CT"
"Delaware","DE"
"District of Columbia","DC"
"Florida","FL"
"Georgia","GA"
"Hawaii","HI"
"Idaho","ID"
"Illinois","IL"
"Indiana","IN"
"Iowa","IA"
"Kansas","KS"
"Kentucky","KY"
"Louisiana","LA"
"Maine","ME"
"Montana","MT"
"Nebraska","NE"
"Nevada","NV"
"New Hampshire","NH"
"New Jersey","NJ"
"New Mexico","NM"
"New York","NY"
"North Carolina","NC"
"North Dakota","ND"
"Ohio","OH"
"Oklahoma","OK"
"Oregon","OR"
"Maryland","MD"
"Massachusetts","MA"
"Michigan","MI"
"Minnesota","MN"
"Mississippi","MS"
"Missouri","MO"
"Pennsylvania","PA"
"Rhode Island","RI"
"South Carolina","SC"
"South Dakota","SD"
"Tennessee","TN"
"Texas","TX"
"Utah","UT"
"Vermont","VT"
"Virginia","VA"
"Washington","WA"
"West Virginia","WV"
"Wisconsin","WI"
"Wyoming","WY"
1 State Abbreviation
2 Alabama AL
3 Alaska AK
4 Arizona AZ
5 Arkansas AR
6 California CA
7 Colorado CO
8 Connecticut CT
9 Delaware DE
10 District of Columbia DC
11 Florida FL
12 Georgia GA
13 Hawaii HI
14 Idaho ID
15 Illinois IL
16 Indiana IN
17 Iowa IA
18 Kansas KS
19 Kentucky KY
20 Louisiana LA
21 Maine ME
22 Montana MT
23 Nebraska NE
24 Nevada NV
25 New Hampshire NH
26 New Jersey NJ
27 New Mexico NM
28 New York NY
29 North Carolina NC
30 North Dakota ND
31 Ohio OH
32 Oklahoma OK
33 Oregon OR
34 Maryland MD
35 Massachusetts MA
36 Michigan MI
37 Minnesota MN
38 Mississippi MS
39 Missouri MO
40 Pennsylvania PA
41 Rhode Island RI
42 South Carolina SC
43 South Dakota SD
44 Tennessee TN
45 Texas TX
46 Utah UT
47 Vermont VT
48 Virginia VA
49 Washington WA
50 West Virginia WV
51 Wisconsin WI
52 Wyoming WY
+53
View File
@@ -0,0 +1,53 @@
# comment
State|Abbreviation
Alabama|AL
Alaska|AK
Arizona|AZ
Arkansas|AR
California|CA
Colorado|CO
Connecticut|CT
Delaware|DE
District of Columbia|DC
Florida|FL
Georgia|GA
Hawaii|HI
Idaho|ID
Illinois|IL
Indiana|IN
Iowa|IA
Kansas|KS
Kentucky|KY
Louisiana|LA
Maine|ME
Montana|MT
Nebraska|NE
Nevada|NV
New Hampshire|NH
New Jersey|NJ
New Mexico|NM
New York|NY
North Carolina|NC
North Dakota|ND
Ohio|OH
Oklahoma|OK
Oregon|OR
Maryland|MD
Massachusetts|MA
Michigan|MI
Minnesota|MN
Mississippi|MS
Missouri|MO
Pennsylvania|PA
Rhode Island|RI
South Carolina|SC
South Dakota|SD
Tennessee|TN
Texas|TX
Utah|UT
Vermont|VT
Virginia|VA
Washington|WA
West Virginia|WV
Wisconsin|WI
Wyoming|WY
+1
View File
@@ -0,0 +1 @@
foo
+1
View File
@@ -0,0 +1 @@
bar
File diff suppressed because it is too large Load Diff
+1
View File
@@ -0,0 +1 @@
ONE
+1
View File
@@ -0,0 +1 @@
TWO
+10
View File
@@ -0,0 +1,10 @@
BEGIN {
printf "A=%d, B=%d\n", A, B
for (i = 1; i < ARGC; i++) {
printf "\tARGV[%d] = %s\n", i, ARGV[i]
}
}
END {
printf "A=%d, B=%d\n", A, B
}
+2
View File
@@ -0,0 +1,2 @@
FOUR a
FOUR b
+4
View File
@@ -0,0 +1,4 @@
one
two 2
3
Four
+3
View File
@@ -0,0 +1,3 @@
Uno
Duo
Tri
+15
View File
@@ -0,0 +1,15 @@
# addcomma - put commas in numbers
# input: a number per line
# output: the input number followed by
# the number with commas and two decimal places
{ printf("%-12s %20s\n", $0, addcomma($0)) }
function addcomma(x, num) {
if (x < 0)
return "-" addcomma(-x)
num = sprintf("%.2f", x) # num is dddddd.dd
while (num ~ /[0-9][0-9][0-9][0-9]/)
sub(/[0-9][0-9][0-9][,.]/, ",&", num)
return num
}
+7
View File
@@ -0,0 +1,7 @@
0
-1
-12.34
12345
-1234567.89
-123.
-123456
+7
View File
@@ -0,0 +1,7 @@
0 0.00
-1 -1.00
-12.34 -12.34
12345 12,345.00
-1234567.89 -1,234,567.89
-123. -123.00
-123456 -123,456.00
+1
View File
@@ -0,0 +1 @@
{ gsub(/^[ ]*/, "", $0) ; print }
+1
View File
@@ -0,0 +1 @@
This is a test, this is only a test.
+1
View File
@@ -0,0 +1 @@
This is a test, this is only a test.
+33
View File
@@ -0,0 +1,33 @@
BEGIN { RS = "" }
{
if (/^A/)
print "ok"
else
print "not ok"
if (/B$/)
print "not ok"
else
print "ok"
if (/^C/)
print "not ok"
else
print "ok"
if (/D$/)
print "not ok"
else
print "ok"
if (/^E/)
print "not ok"
else
print "ok"
if (/F$/)
print "ok"
else
print "not ok"
}
+3
View File
@@ -0,0 +1,3 @@
A line1 B
C line2 D
E line3 F
+6
View File
@@ -0,0 +1,6 @@
ok
ok
ok
ok
ok
ok
+14
View File
@@ -0,0 +1,14 @@
BEGIN {
argn = " argument" (ARGC > 1 ? "s" : "")
are = ARGC > 1 ? "are" : "is"
print "here we have " ARGC argn
print "which " are
for (x = 0; x < ARGC; x++)
print "\t", ARGV[x]
print "Environment variable TEST=" ENVIRON["TEST"]
print "and the current input file is called \"" FILENAME "\""
}
FNR == 1 {
print "in main loop, this input file is known as \"" FILENAME "\""
}
+1
View File
@@ -0,0 +1 @@
this is a simple test file
+6
View File
@@ -0,0 +1,6 @@
here we have 1 argument
which is
Environment variable TEST=
and the current input file is called ""
in main loop, this input file is known as "-"
+19
View File
@@ -0,0 +1,19 @@
BEGIN {
# initialize cint arrays
pos[0] = 0
posout[0] = 0
split("00000779770060", f) # f[1] is a strnum
pos[f[1]] = 1 # subscripts must be strings!
for (x in pos) {
# if x is a strnum, then the
# x != 0 test may convert it to an integral NUMBER,
# and we might lose the unusual string representation
# if the cint code is not careful to recognize that this is
# actually a string
if (x != 0)
posout[x] = pos[x]
}
# which array element is populated?
print posout[779770060]
print posout["00000779770060"]
}
+2
View File
@@ -0,0 +1,2 @@
1
+21
View File
@@ -0,0 +1,21 @@
#
# Test program from:
#
# Date: Tue, 21 Feb 95 16:09:29 EST
# From: emory!blackhawk.com!aaron (Aaron Sosnick)
#
BEGIN {
foo[1]=1;
foo[2]=2;
bug1(foo);
}
function bug1(i) {
for (i in foo) {
bug2(i);
delete foo[i];
print i,1,bot[1];
}
}
function bug2(arg) {
bot[arg]=arg;
}
+1
View File
@@ -0,0 +1 @@
parse error at 10:10: can't pass array "foo" as scalar param
+67
View File
@@ -0,0 +1,67 @@
# From spcecdt@armory.com Wed Apr 30 11:08:48 2003
# Return-Path: <spcecdt@armory.com>
# Received: from localhost (skeeve [127.0.0.1])
# by skeeve.com (8.12.5/8.12.5) with ESMTP id h3U7uZWr015489
# for <arnold@localhost>; Wed, 30 Apr 2003 11:08:48 +0300
# Received: from actcom.co.il [192.114.47.1]
# by localhost with POP3 (fetchmail-5.9.0)
# for arnold@localhost (single-drop); Wed, 30 Apr 2003 11:08:48 +0300 (IDT)
# Received: by actcom.co.il (mbox arobbins)
# (with Cubic Circle's cucipop (v1.31 1998/05/13) Wed Apr 30 11:05:01 2003)
# X-From_: spcecdt@armory.com Wed Apr 30 04:06:46 2003
# Received: from smtp1.actcom.net.il by actcom.co.il with ESMTP
# (8.11.6/actcom-0.2) id h3U16iv04111 for <arobbins@actcom.co.il>;
# Wed, 30 Apr 2003 04:06:45 +0300 (EET DST)
# (rfc931-sender: mail.actcom.co.il [192.114.47.13])
# Received: from f7.net (consort.superb.net [209.61.216.22])
# by smtp1.actcom.net.il (8.12.8/8.12.8) with ESMTP id h3U16nEv009589
# for <arobbins@actcom.co.il>; Wed, 30 Apr 2003 04:06:50 +0300
# Received: from fencepost.gnu.org (fencepost.gnu.org [199.232.76.164])
# by f7.net (8.11.7/8.11.6) with ESMTP id h3U16gj29182
# for <arnold@skeeve.com>; Tue, 29 Apr 2003 21:06:42 -0400
# Received: from monty-python.gnu.org ([199.232.76.173])
# by fencepost.gnu.org with esmtp (Exim 4.10)
# id 19Ag3W-00029w-00
# for bug-gawk@gnu.org; Tue, 29 Apr 2003 21:06:42 -0400
# Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13)
# id 19Ag1V-0001AN-00
# for bug-gawk@gnu.org; Tue, 29 Apr 2003 21:04:39 -0400
# Received: from deepthought.armory.com ([192.122.209.42] helo=armory.com)
# by monty-python.gnu.org with smtp (Exim 4.10.13)
# id 19Ag1V-0001A3-00
# for bug-gawk@gnu.org; Tue, 29 Apr 2003 21:04:37 -0400
# Date: Tue, 29 Apr 2003 18:04:35 -0700
# From: "John H. DuBois III" <spcecdt@armory.com>
# To: bug-gawk@gnu.org
# Subject: gawk 3.1.2a bug
# Message-ID: <20030430010434.GA4278@armory.com>
# Mime-Version: 1.0
# Content-Type: text/plain; charset=us-ascii
# Content-Disposition: inline
# User-Agent: Mutt/1.3.28i
# X-Www: http://www.armory.com./~spcecdt/
# Sender: spcecdt@armory.com
# X-Spam-Status: No, hits=-7.2 required=5.0
# tests=SIGNATURE_SHORT_DENSE,SPAM_PHRASE_00_01,USER_AGENT,
# USER_AGENT_MUTT
# version=2.41
# X-Spam-Level:
# X-SpamBouncer: 1.4 (10/07/01)
# X-SBClass: OK
# Status: RO
#
# gawk-3.1.2a 'BEGIN {foo(bar)};function foo(baz){split("x",baz)}'
# gawk-3.1.2a: cmd. line:1: fatal: split: second argument is not an array
#
# John
# --
# John DuBois spcecdt@armory.com KC6QKZ/AE http://www.armory.com/~spcecdt/
#
BEGIN {
foo(bar)
}
function foo(baz)
{
split("x", baz)
}
View File
+56
View File
@@ -0,0 +1,56 @@
# From spcecdt@armory.com Fri May 2 13:24:46 2003
# Return-Path: <spcecdt@armory.com>
# Received: from localhost (skeeve [127.0.0.1])
# by skeeve.com (8.12.5/8.12.5) with ESMTP id h42AChum021950
# for <arnold@localhost>; Fri, 2 May 2003 13:24:46 +0300
# Received: from actcom.co.il [192.114.47.1]
# by localhost with POP3 (fetchmail-5.9.0)
# for arnold@localhost (single-drop); Fri, 02 May 2003 13:24:46 +0300 (IDT)
# Received: by actcom.co.il (mbox arobbins)
# (with Cubic Circle's cucipop (v1.31 1998/05/13) Fri May 2 13:23:37 2003)
# X-From_: spcecdt@armory.com Fri May 2 00:43:51 2003
# Received: from smtp1.actcom.net.il by actcom.co.il with ESMTP
# (8.11.6/actcom-0.2) id h41Lhm500217 for <arobbins@actcom.co.il>;
# Fri, 2 May 2003 00:43:49 +0300 (EET DST)
# (rfc931-sender: lmail.actcom.co.il [192.114.47.13])
# Received: from f7.net (consort.superb.net [209.61.216.22])
# by smtp1.actcom.net.il (8.12.8/8.12.8) with ESMTP id h41LiGcO022817
# for <arobbins@actcom.co.il>; Fri, 2 May 2003 00:44:18 +0300
# Received: from armory.com (deepthought.armory.com [192.122.209.42])
# by f7.net (8.11.7/8.11.6) with SMTP id h41Lhj106516
# for <arnold@skeeve.com>; Thu, 1 May 2003 17:43:46 -0400
# Date: Thu, 1 May 2003 14:43:45 -0700
# From: "John H. DuBois III" <spcecdt@armory.com>
# To: Aharon Robbins <arnold@skeeve.com>
# Subject: Re: gawk 3.1.2a bug
# Message-ID: <20030501214345.GA24615@armory.com>
# References: <200305011738.h41Hcg76017565@localhost.localdomain>
# Mime-Version: 1.0
# Content-Type: text/plain; charset=us-ascii
# Content-Disposition: inline
# In-Reply-To: <200305011738.h41Hcg76017565@localhost.localdomain>
# User-Agent: Mutt/1.3.28i
# X-Www: http://www.armory.com./~spcecdt/
# Sender: spcecdt@armory.com
# X-SpamBouncer: 1.4 (10/07/01)
# X-SBClass: OK
# Status: RO
#
# On Thu, May 01, 2003 at 08:38:42PM +0300, Aharon Robbins wrote:
# > > That worked, thanks.
# >
# > Great. Your report motivated me to find everywhere such additional
# > code ought to be needed. I think I did so. --Arnold
#
# Here's another one (perhaps fixed by your additional work):
#
BEGIN { foo(a) }
function foo(a) { bar(a); print "" in a }
function bar(a) { a[""]; }
#
# Prints 1 with gawk-3.1.1; 0 with 3.1.2a.
#
# John
# --
# John DuBois spcecdt@armory.com KC6QKZ/AE http://www.armory.com/~spcecdt/
#
+1
View File
@@ -0,0 +1 @@
1
+13
View File
@@ -0,0 +1,13 @@
BEGIN { # foo[10] = 0 # put this line in and it will work
test(foo); print foo[1]
test2(foo2); print foo2[1]
}
function test(foo)
{
test2(foo)
}
function test2(bar)
{
bar[1] = 1
}
+2
View File
@@ -0,0 +1,2 @@
1
1
+81
View File
@@ -0,0 +1,81 @@
# From spcecdt@armory.com Thu Jun 14 13:24:32 2001
# Received: from mail.actcom.co.il [192.114.47.13]
# by localhost with POP3 (fetchmail-5.5.0)
# for arnold@localhost (single-drop); Thu, 14 Jun 2001 13:24:32 +0300 (IDT)
# Received: by actcom.co.il (mbox arobbins)
# (with Cubic Circle's cucipop (v1.31 1998/05/13) Thu Jun 14 13:25:13 2001)
# X-From_: spcecdt@armory.com Thu Jun 14 06:34:47 2001
# Received: from lmail.actcom.co.il by actcom.co.il with ESMTP
# (8.9.1a/actcom-0.2) id GAA29661 for <arobbins@actcom.co.il>;
# Thu, 14 Jun 2001 06:34:46 +0300 (EET DST)
# (rfc931-sender: lmail.actcom.co.il [192.114.47.13])
# Received: from billohost.com (www.billohost.com [209.196.35.10])
# by lmail.actcom.co.il (8.11.2/8.11.2) with ESMTP id f5E3YiO27337
# for <arobbins@actcom.co.il>; Thu, 14 Jun 2001 06:34:45 +0300
# Received: from fencepost.gnu.org (we-refuse-to-spy-on-our-users@fencepost.gnu.org [199.232.76.164])
# by billohost.com (8.9.3/8.9.3) with ESMTP id XAA02681
# for <arnold@skeeve.com>; Wed, 13 Jun 2001 23:33:57 -0400
# Received: from deepthought.armory.com ([192.122.209.42])
# by fencepost.gnu.org with smtp (Exim 3.16 #1 (Debian))
# id 15ANu2-00005C-00
# for <bug-gawk@gnu.org>; Wed, 13 Jun 2001 23:34:38 -0400
# Date: Wed, 13 Jun 2001 20:32:42 -0700
# From: "John H. DuBois III" <spcecdt@armory.com>
# To: bug-gawk@gnu.org
# Subject: gawk 3.1.0 bug
# Message-ID: <20010613203242.A29975@armory.com>
# Mime-Version: 1.0
# Content-Type: text/plain; charset=us-ascii
# X-Mailer: Mutt 1.0.1i
# X-Www: http://www.armory.com./~spcecdt/
# Sender: spcecdt@armory.com
# Status: RO
#
# Under SCO OpenServer 5.0.6a using gawk 3.1.0 compiled with gcc 2.95.2, this
# program:
BEGIN {
f1(Procs,b)
print "test"
}
function f1(Procs,a) {
# a[""]
a[""] = "a" # ADR: Give it a value so can trace it
f2()
}
function f2() {
# b[""]
b[""] = "b" # ADR: Give it a value so can trace it
}
# ADR: 1/28/2003: Added this:
BEGIN { for (i in b) printf("b[\"%s\"] = \"%s\"\n", i, b[i]) }
# END ADR added.
# gives:
#
# gawk: ./gtest:5: fatal error: internal error
#
# and dumps core.
#
# gdb gives me this stack backtrace:
#
# #0 0x80019943 in kill () from /usr/lib/libc.so.1
# #1 0x8003e754 in abort () from /usr/lib/libc.so.1
# #2 0x8062a87 in catchsig (sig=0, code=0) at main.c:947
# #3 0x80053a0c in _sigreturn () from /usr/lib/libc.so.1
# #4 0x80023d36 in cleanfree () from /usr/lib/libc.so.1
# #5 0x80023156 in _real_malloc () from /usr/lib/libc.so.1
# #6 0x80023019 in malloc () from /usr/lib/libc.so.1
# #7 0x8053b95 in do_print (tree=0x0) at builtin.c:1336
# #8 0x806b47c in interpret (tree=0x8084ee4) at eval.c:606
# #9 0x806ad8d in interpret (tree=0x8084f0c) at eval.c:384
# #10 0x806ad21 in interpret (tree=0x8084f5c) at eval.c:367
# #11 0x8061d5b in main (argc=4, argv=0x80478ac) at main.c:506
#
# John
# --
# John DuBois spcecdt@armory.com. KC6QKZ/AE http://www.armory.com./~spcecdt/
#
+2
View File
@@ -0,0 +1,2 @@
test
b[""] = "b"
+18
View File
@@ -0,0 +1,18 @@
BEGIN {
foo(a)
for (i in a)
print i, a[i]
}
function foo(b)
{
bar(b)
b[2] = "local"
}
function bar(c)
{
a[3] = "global"
c[1] = "local2"
}
+3
View File
@@ -0,0 +1,3 @@
1 local2
2 local
3 global
+18
View File
@@ -0,0 +1,18 @@
BEGIN {
foo(a)
for (i in a)
print i, a[i]
}
function foo(b)
{
a[1] = "global"
b[2] = "local"
bar(b)
}
function bar(c)
{
c = 12
}
+1
View File
@@ -0,0 +1 @@
parse error at 12:6: can't pass array "b" as scalar param
+17
View File
@@ -0,0 +1,17 @@
BEGIN {
foo(a)
print a
}
function foo(b)
{
a = "global"
b[2] = "local"
# bar(b)
}
function bar(c)
{
c = 12
}
+1
View File
@@ -0,0 +1 @@
parse error at 2:6: can't pass scalar "a" as array param
+17
View File
@@ -0,0 +1,17 @@
BEGIN {
foo(a)
print a
}
function foo(b)
{
b[2] = "local"
a = "global"
# bar(b)
}
function bar(c)
{
c = 12
}
+1
View File
@@ -0,0 +1 @@
parse error at 2:6: can't pass scalar "a" as array param
+16
View File
@@ -0,0 +1,16 @@
BEGIN {
a = 12.153
#print "-- stroring test[a]" > "/dev/stderr" ; fflush("/dev/stderr")
test[a] = "hi"
#print "-- setting CONVFMT" > "/dev/stderr" ; fflush("/dev/stderr")
CONVFMT = "%.0f"
#print "-- setting a" > "/dev/stderr" ; fflush("/dev/stderr")
a = 5
#stopme()
#print "-- starting loop" > "/dev/stderr" ; fflush("/dev/stderr")
for (i in test) {
#print("-- i =", i) > "/dev/stderr" ; fflush("/dev/stderr");
#printf("-- i = <%s>\n", i) > "/dev/stderr" ; fflush("/dev/stderr");
printf ("test[%s] = %s\n", i, test[i])
}
}
+1
View File
@@ -0,0 +1 @@
test[12.153] = hi
+9
View File
@@ -0,0 +1,9 @@
function f(a) {
if (3 in a)
print 7
a = 5
}
BEGIN {
f(arr)
}
+1
View File
@@ -0,0 +1 @@
parse error at 4:2: can't use array "a" as scalar
+10
View File
@@ -0,0 +1,10 @@
function f(a, i) {
for (i in a)
delete a[i]
if (a == 0)
print 7
}
BEGIN {
f(arr)
}
+1
View File
@@ -0,0 +1 @@
parse error at 4:6: can't use array "a" as scalar
+7
View File
@@ -0,0 +1,7 @@
function f(x){
x = 1
}
BEGIN {
f(a)
a[1]
}
+1
View File
@@ -0,0 +1 @@
parse error at 6:2: can't use scalar "a" as array
+6
View File
@@ -0,0 +1,6 @@
function f(x){
x[1] = x
}
BEGIN {
f(a)
}
+1
View File
@@ -0,0 +1 @@
parse error at 2:9: can't use array "x" as scalar
+7
View File
@@ -0,0 +1,7 @@
function f(x){
a
x[1] = 3
}
BEGIN {
f(a)
}
+1
View File
@@ -0,0 +1 @@
parse error at 6:4: can't pass scalar "a" as array param
+6
View File
@@ -0,0 +1,6 @@
function f(x, y){
y[1] = x
}
BEGIN {
f(a, a)
}
+1
View File
@@ -0,0 +1 @@
parse error at 5:7: can't pass scalar "a" as array param
+22
View File
@@ -0,0 +1,22 @@
BEGIN {
f(0, a) # nothing
f(1, a)
}
function f(i, a) {
if (i == 0) return
g(a, a)
pr(a)
}
function g(x, y) {
h(y, x, y)
}
function h(b, c, d) {
b[1] = 1
c[1] = 2 # rewrite
print b[1], d[1]
c[2] = 1
b[2] = 2 # should rewrite
}
function pr(x) {
print x[1], x[2]
}
+2
View File
@@ -0,0 +1,2 @@
2 2
2 2
+16
View File
@@ -0,0 +1,16 @@
#!/usr/bin/gawk -f
BEGIN {
for (i = 0; i < 100; i++)
func_exec()
}
function func_exec(opaque)
{
func_a(1, opaque) #set additional argument, not expected by fname
}
function func_a(a, b, loc1, loc2)
{
b = 0 #unref Nnull_string
}
View File
+1
View File
@@ -0,0 +1 @@
BEGIN { n = 11 ; foo[n] = n; print (2 <= n) }
+1
View File
@@ -0,0 +1 @@
1
+17
View File
@@ -0,0 +1,17 @@
BEGIN {
a[i] = "null" # i is initially undefined
for (i in a) { # i is null string
print length(i), a[i] # , typeof(i) # 0 null
print (i==0), (i=="") # 1 1 should be 0 1
}
print a[""] # null
print a[0] #
b[$2] = "null also" # $2 is also undefined
for (j in b) {
print length(j), a[j] # , typeof(i) # 0 null
print (j==0), (j=="") # 1 1 should be 0 1
}
print b[""] # null
print b[0] #
}
+8
View File
@@ -0,0 +1,8 @@
0 null
0 1
null
0 null
0 1
null also
+1
View File
@@ -0,0 +1 @@
{ print $3; $4 = "a"; print }
+3
View File
@@ -0,0 +1,3 @@
1 2 3
1
1 2 3 4
+6
View File
@@ -0,0 +1,6 @@
3
1 2 3 a
1 a
3
1 2 3 a
@@ -0,0 +1 @@
{$0 = ++i} 1
+5
View File
@@ -0,0 +1,5 @@
a b c
a b c
a b c
a b c
a b c
+5
View File
@@ -0,0 +1,5 @@
1
2
3
4
5
+1
View File
@@ -0,0 +1 @@
/a\8b/
+1
View File
@@ -0,0 +1 @@
parse error at 1:1: error parsing regexp: invalid escape sequence: `\8`
+4
View File
@@ -0,0 +1,4 @@
{
gsub( "\\\\", "\\\\")
print
}
+1
View File
@@ -0,0 +1 @@
\x\y\z

Some files were not shown because too many files have changed in this diff Show More