1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-10-19 02:29:40 +00:00
freebsd/contrib/one-true-awk/bugs-fixed
Warner Losh 666abb0888 one-true-awk: import 20210221 (1e4bc42c53a1) which fixes a number of bugs
Import the latest bsd-features branch of the one-true-awk upstream:

o Move to bison for $YACC
o Set close-on-exec flag for file and pipe redirects that aren't std*
o lots of little fixes to modernize ocde base
o free sval member before setting it
o fix a bug where a{0,3} could match aaaa
o pull in systime and strftime from NetBSD awk
o pull in fixes from {Net,Free,Open}BSD (normalized our code with them)
o add BSD extensions and, or, xor, compl, lsheift, rshift (mostly a nop)

Also revert a few of the trivial FreeBSD changes that were done slightly
differently in the upstreaming process. Also, our PR database may have
been mined by upstream for these fixes, and Mikolaj Golub may deserve
credit for some of the fixes in this update.

Suggested by:		Mikolaj Golub <to.my.trociny@gmail.com>
PR:			143363, 143365, 143368, 143369, 143373, 143375, 214783
Sponsored by:		Netflix

(cherry picked from commit f39dd6a978)
2021-07-10 11:07:26 -06:00
..
a-format.awk
a-format.bad
a-format.ok
concat-assign-same.awk
concat-assign-same.bad
concat-assign-same.ok
decr-NF.awk
decr-NF.bad
decr-NF.ok
fmt-overflow.awk
fmt-overflow.ok
fs-overflow.awk
getline-numeric.awk
getline-numeric.bad
getline-numeric.in
getline-numeric.ok
missing-precision.awk
missing-precision.ok
negative-nf.awk
negative-nf.ok
nf-self-assign.awk
nf-self-assign.bad
nf-self-assign.ok
numeric-fs.awk
numeric-fs.ok
numeric-output-seps.awk
numeric-output-seps.bad
numeric-output-seps.ok
numeric-rs.awk
numeric-rs.bad
numeric-rs.ok
numeric-subsep.awk
numeric-subsep.bad
numeric-subsep.ok
ofs-rebuild.awk
ofs-rebuild.bad
ofs-rebuild.ok
README
space.awk
space.bad
space.ok
split-fs-from-array.awk
split-fs-from-array.ok
string-conv.awk
string-conv.bad
string-conv.ok
subsep-overflow.awk
subsep-overflow.ok
system-status.awk
system-status.bad
system-status.ok
unary-plus.awk
unary-plus.bad
unary-plus.ok

List of bugs fixed.

1. ofs-rebuild: OFS value used to rebuild the record was incorrect.
Fixed August 19, 2014. Revised fix August 2018.

2. system-status: Instead of a floating-point division by 256, use
the wait(2) macros to create a reasonable exit status. Fixed March 12, 2016.

3. space: Use provided xisblank() function instead of ispace() for
matching [[:blank:]].

4. a-format: Add POSIX standard %a and %A to supported formats. Check
at runtime that this format is available.

5. decr-NF: Decrementing NF did not change $0. This is a decades-old
bug. There are interactions with the old and new value of OFS as well.
Most of the fix came from the NetBSD awk.

6. string-conv: String conversions of scalars were sticky.  Once a
conversion to string happened, even with OFMT, that value was used until
a new numeric value was assigned, even if OFMT differed from CONVFMT,
and also if CONVFMT changed.

7. unary-plus: Unary plus on a string constant returned the string.
Instead, it should convert the value to numeric and give that value.

8. concat-assign-same: Concatenation previously evaluated both sides of the
expression before doing its work, which, since assign() evaluates to the cell
being assigned to, meant that expressions like "print (a = 1) (a = 2)" would
print "22" rather than "12".

9. missing-precision: When using the format string "%*s", the precision
argument was used without checking if it was present first.

10. missing-precision: When using the format string "%*s", the precision
argument was used without checking if it was present first.

11. fmt-overflow: The buffer used for OFMT/CONVFMT conversions was written
to with sprintf(), which meant that some conversions could write past the
end.

12. numeric-subsep, numeric-fs, numeric-output-seps, numerics-rs: If SUBSEP,
FS, RS, OFS, or ORS were set to a numeric value, then their string values
wouldn't always be generated before being needed.

13. subsep-overflow: The length of SUBSEP needs to be rechecked after
calling execute(), in case SUBSEP itself has been changed.

14. split-fs-from-array: If the third argument to split() comes from the
array passed as the second argument, then split() would previously read
from the freed memory and possibly produce incorrect results (depending
on the system's malloc()/free() behaviour.)

15. getline-numeric: The `getline xx < file' syntax did not check if
values were numeric, in discordance from POSIX. Test case adapted from
one posted by Ben Bacarisse <ben.usenet@bsb.me.uk> in comp.lang.awk,
January 2019.