forked from freebsd/freebsd-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
awk: Merge 20210729 from One True Awk upstream (0592de4a)
July 27, 2021: As per IEEE Std 1003.1-2008, -F "str" is now consistent with -v FS="str" when str is null. Thanks to Warner Losh. July 24, 2021: Fix readrec's definition of a record. This fixes an issue with NetBSD's RS regular expression support that can cause an infinite read loop. Thanks to Miguel Pineiro Jr. Fix regular expression RS ^-anchoring. RS ^-anchoring needs to know if it is reading the first record of a file. This change restores a missing line that was overlooked when porting NetBSD's RS regex functionality. Thanks to Miguel Pineiro Jr. Fix size computation in replace_repeat() for special case REPEAT_WITH_Q. Thanks to Todd C. Miller. Also, included the tests from upstream, though they aren't yet connected to the tree. Sponsored by: Netflix
- Loading branch information
Showing
330 changed files
with
71,810 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Wed Jan 22 02:10:35 MST 2020 | ||
============================ | ||
|
||
Here are some things that it'd be nice to have volunteer | ||
help on. | ||
|
||
1. Rework the test suite so that it's easier to maintain | ||
and see exactly which tests fail: | ||
A. Extract beebe.tar into separate file and update scripts | ||
B. Split apart multiple tests into separate tests with input | ||
and "ok" files for comparisons. | ||
|
||
2. Pull in more of the tests from gawk that only test standard features. | ||
The beebe.tar file appears to be from sometime in the 1990s. | ||
|
||
3. Make the One True Awk valgrind clean. In particular add a | ||
a test suite target that runs valgrind on all the tests and | ||
reports if there are any definite losses or any invalid reads | ||
or writes (similar to gawk's test of this nature). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#! /bin/bash | ||
|
||
if [ ! -f ../a.out ] | ||
then | ||
echo Making executable | ||
(cd .. ; make) || exit 0 | ||
fi | ||
|
||
for i in *.awk | ||
do | ||
echo === $i | ||
OUT=${i%.awk}.OUT | ||
OK=${i%.awk}.ok | ||
IN=${i%.awk}.in | ||
input= | ||
if [ -f $IN ] | ||
then | ||
input=$IN | ||
fi | ||
|
||
../a.out -f $i $input > $OUT 2>&1 | ||
if cmp -s $OK $OUT | ||
then | ||
rm -f $OUT | ||
else | ||
echo ++++ $i failed! | ||
fi | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
foo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
for (i = 1; i <= NF; i++) | ||
print i, $i, $i + 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
-inf -inform inform -nan -nancy nancy -123 0 123 +123 nancy +nancy +nan inform +inform +inf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
1 -inf -inf | ||
2 -inform 0 | ||
3 inform 0 | ||
4 -nan -nan | ||
5 -nancy 0 | ||
6 nancy 0 | ||
7 -123 -123 | ||
8 0 0 | ||
9 123 123 | ||
10 +123 123 | ||
11 nancy 0 | ||
12 +nancy 0 | ||
13 +nan +nan | ||
14 inform 0 | ||
15 +inform 0 | ||
16 +inf +inf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
\ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
../a.out: syntax error at source line 1 source file pfile-overflow.awk | ||
context is | ||
>>> <<< | ||
../a.out: bailing out at source line 1 source file pfile-overflow.awk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
BEGIN { RS="zx" } { print $1 } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
� |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
� |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
oldawk=${oldawk-awk} | ||
awk=${awk-../a.out} | ||
|
||
echo oldawk=$oldawk, awk=$awk | ||
|
||
for i in T.* | ||
do | ||
$i | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# an arbitrary collection of input data | ||
|
||
cat td.1 td.1 >foo.td | ||
sed 's/^........................//' td.1 >>foo.td | ||
pr -m td.1 td.1 td.1 >>foo.td | ||
pr -2 td.1 >>foo.td | ||
wc foo.td | ||
|
||
td=foo.td | ||
>footot | ||
|
||
for i in $* | ||
do | ||
echo $i >/dev/tty | ||
echo $i '<<<' | ||
cd .. | ||
echo testdir/$i: | ||
ind <testdir/$i | ||
a.out -f testdir/$i >drek.c | ||
cat drek.c | ||
make drek || ( echo $i ' ' bad compile; echo $i ' ' bad compile >/dev/tty; continue ) | ||
cd testdir | ||
|
||
time /usr/bin/awk -f $i $td >foo2 2>foo2t | ||
cat foo2t | ||
time ../drek $td >foo1 2>foo1t | ||
cat foo1t | ||
cmp foo1 foo2 || ( echo $i ' ' bad; echo $i ' ' bad >/dev/tty; diff foo1 foo2 | sed 20q ) | ||
echo '>>>' $i | ||
echo | ||
echo $i: >>footot | ||
cat foo1t foo2t >>footot | ||
done | ||
|
||
ctimes footot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
oldawk=${oldawk-awk} | ||
awk=${awk-../a.out} | ||
|
||
echo oldawk=$oldawk, awk=$awk | ||
|
||
for i | ||
do | ||
echo "$i:" | ||
$oldawk -f $i test.countries test.countries >foo1 | ||
$awk -f $i test.countries test.countries >foo2 | ||
if cmp -s foo1 foo2 | ||
then true | ||
else echo -n "$i: BAD ..." | ||
fi | ||
diff -b foo1 foo2 | sed -e 's/^/ /' -e 10q | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
oldawk=${oldawk-myawk} | ||
awk=${awk-../a.out} | ||
|
||
echo oldawk=$oldawk, awk=$awk | ||
|
||
for i | ||
do | ||
echo "$i:" | ||
$oldawk -f $i test.data >foo1 | ||
$awk -f $i test.data >foo2 | ||
if cmp -s foo1 foo2 | ||
then true | ||
else echo -n "$i: BAD ..." | ||
fi | ||
diff -b foo1 foo2 | sed -e 's/^/ /' -e 10q | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/bin/sh | ||
|
||
oldawk=${oldawk-awk} | ||
awk=${awk-../a.out} | ||
|
||
echo compiling time.c | ||
gcc time.c -o time | ||
time=./time | ||
|
||
echo time command = $time | ||
|
||
#case `uname` in | ||
#SunOS) | ||
# time=/usr/bin/time ;; | ||
#Linux) | ||
# time=/usr/bin/time ;; | ||
#*) | ||
# time=time ;; | ||
#esac | ||
|
||
echo oldawk = $oldawk, awk = $awk, time command = $time | ||
|
||
|
||
# an arbitrary collection of input data | ||
|
||
cat td.1 td.1 >foo.td | ||
sed 's/^........................//' td.1 >>foo.td | ||
pr -m td.1 td.1 td.1 >>foo.td | ||
pr -2 td.1 >>foo.td | ||
cat bib >>foo.td | ||
wc foo.td | ||
|
||
td=foo.td | ||
>footot | ||
|
||
for i in $* | ||
do | ||
echo $i "($oldawk vs $awk)": | ||
# ind <$i | ||
$time $oldawk -f $i $td >foo2 2>foo2t | ||
cat foo2t | ||
$time $awk -f $i $td >foo1 2>foo1t | ||
cat foo1t | ||
cmp foo1 foo2 | ||
echo $i: >>footot | ||
cat foo1t foo2t >>footot | ||
done | ||
|
||
ctimes footot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Need some tests for octal, hex, various string escapes. | ||
|
||
Need to complete the sub and gsub tests. | ||
|
||
more on printf, especially weird formats | ||
|
||
more on operators | ||
|
||
|
||
never throw away a test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
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 Language. 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. | ||
|
Oops, something went wrong.