arnold-fixes/ 0000755 0001171 0001630 00000000000 13337775451 011560 5 ustar bwk fac arnold-fixes/unary-plus.bad 0000644 0001171 0001630 00000000027 13337522465 014341 0 ustar bwk fac q
43.12345678912345678
arnold-fixes/a-format.bad 0000644 0001171 0001630 00000000074 13337522465 013732 0 ustar bwk fac nawk: weird printf conversion %a
source line number 2
%a42
arnold-fixes/a-format.ok 0000644 0001171 0001630 00000000011 13337522465 013604 0 ustar bwk fac 0x1.5p+5
arnold-fixes/decr-NF.bad 0000644 0001171 0001630 00000000036 13337522465 013440 0 ustar bwk fac 6
a b c d e f
5
a b c d e f
6
arnold-fixes/string-conv.ok 0000644 0001171 0001630 00000000065 13337522465 014360 0 ustar bwk fac a = >>12.1234<<
1 -> 12.1234
2 -> 12.12
3 -> 12.1234
arnold-fixes/system-status.awk 0000644 0001171 0001630 00000001077 13337522465 015131 0 ustar bwk fac # Unmodified nawk prints the 16 bit exit status divided by 256, but
# does so using floating point arithmetic, yielding strange results.
#
# The fix is to use the various macros defined for wait(2) and to
# use the signal number + 256 for death by signal, or signal number + 512
# for death by signal with core dump.
BEGIN {
status = system("exit 42")
print "normal status", status
status = system("kill -HUP $$")
print "death by signal status", status
status = system("kill -ABRT $$")
print "death by signal with core dump status", status
system("rm -f core*")
}
arnold-fixes/decr-NF.ok 0000644 0001171 0001630 00000000033 13337522465 013320 0 ustar bwk fac 6
a:b:c:d:e
5
a:b:c:d:e:
6
arnold-fixes/system-status.ok 0000644 0001171 0001630 00000000126 13337522465 014752 0 ustar bwk fac normal status 42
death by signal status 257
death by signal with core dump status 518
arnold-fixes/string-conv.bad 0000644 0001171 0001630 00000000103 13337522465 014466 0 ustar bwk fac a = >>12.1234<<
1 -> >>12.1234<<
2 -> >>12.1234<<
3 -> >>12.1234<<
arnold-fixes/ofs-rebuild.awk 0000644 0001171 0001630 00000000721 13337522465 014472 0 ustar bwk fac # The bug here is that nawk should use the value of OFS that
# was current when $0 became invalid to rebuild the record.
BEGIN {
OFS = ":"
$0 = "a b c d e f g"
$3 = "3333"
# Conceptually, $0 should now be "a:b:3333:d:e:f:g"
# Change OFS after (conceptually) rebuilding the record
OFS = "<>"
# Unmodifed nawk prints "a<>b<>3333<>d<>e<>f<>g" because
# it delays rebuilding $0 until it's needed, and then it uses
# the current value of OFS. Oops.
print
}
arnold-fixes/unary-plus.ok 0000644 0001171 0001630 00000000012 13337522465 014216 0 ustar bwk fac 0
43.1235
arnold-fixes/string-conv.awk 0000644 0001171 0001630 00000000360 13337522465 014527 0 ustar bwk fac BEGIN {
OFMT = ">>%.6g<<"
a = 12.1234
print "a =", a
b = a ""
print "1 ->", b
CONVFMT = "%2.2f"
b = a ""
print "2 ->", b
CONVFMT = "%.12g"
b = a ""
print "3 ->", b
}
arnold-fixes/a-format.awk 0000644 0001171 0001630 00000000036 13337522465 013764 0 ustar bwk fac BEGIN {
printf("%a\n", 42)
}
arnold-fixes/system-status.bad 0000644 0001171 0001630 00000000142 13337522465 015065 0 ustar bwk fac normal status 42
death by signal status 0.00390625
death by signal with core dump status 0.523438
arnold-fixes/README 0000644 0001171 0001630 00000002026 13337522465 012433 0 ustar bwk fac 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.
arnold-fixes/ofs-rebuild.ok 0000644 0001171 0001630 00000000021 13337522465 014312 0 ustar bwk fac a:b:3333:d:e:f:g
arnold-fixes/space.awk 0000644 0001171 0001630 00000000570 13337522465 013354 0 ustar bwk fac BEGIN {
c[" "] = "\" \""
c["\a"] = "\\a"
c["\b"] = "\\b"
c["\f"] = "\\f"
c["\n"] = "\\n"
c["\r"] = "\\r"
c["\t"] = "\\t"
c["\v"] = "\\v"
sort = "LC_ALL=C sort"
for (i in c)
printf("%s %s [[:space:]]\n", c[i],
i ~ /[[:space:]]/ ? "~" : "!~") | sort
for (i in c)
printf("%s %s [[:blank:]]\n", c[i],
i ~ /[[:blank:]]/ ? "~" : "!~") | sort
close(sort)
}
arnold-fixes/ofs-rebuild.bad 0000644 0001171 0001630 00000000027 13337522465 014435 0 ustar bwk fac a<>b<>3333<>d<>e<>f<>g
arnold-fixes/space.ok 0000644 0001171 0001630 00000000432 13337522465 013200 0 ustar bwk fac " " ~ [[:blank:]]
" " ~ [[:space:]]
\a !~ [[:blank:]]
\a !~ [[:space:]]
\b !~ [[:blank:]]
\b !~ [[:space:]]
\f !~ [[:blank:]]
\f ~ [[:space:]]
\n !~ [[:blank:]]
\n ~ [[:space:]]
\r !~ [[:blank:]]
\r ~ [[:space:]]
\t ~ [[:blank:]]
\t ~ [[:space:]]
\v !~ [[:blank:]]
\v ~ [[:space:]]
arnold-fixes/space.bad 0000644 0001171 0001630 00000000426 13337522465 013320 0 ustar bwk fac " " ~ [[:blank:]]
" " ~ [[:space:]]
\a !~ [[:blank:]]
\a !~ [[:space:]]
\b !~ [[:blank:]]
\b !~ [[:space:]]
\f ~ [[:blank:]]
\f ~ [[:space:]]
\n ~ [[:blank:]]
\n ~ [[:space:]]
\r ~ [[:blank:]]
\r ~ [[:space:]]
\t ~ [[:blank:]]
\t ~ [[:space:]]
\v ~ [[:blank:]]
\v ~ [[:space:]]
arnold-fixes/unary-plus.awk 0000644 0001171 0001630 00000000070 13337522465 014373 0 ustar bwk fac BEGIN {
print +"q"
print +"43.12345678912345678"
}
arnold-fixes/decr-NF.awk 0000644 0001171 0001630 00000000147 13337522465 013477 0 ustar bwk fac BEGIN {
$0 = "a b c d e f"
print NF
OFS = ":"
NF--
print $0
print NF
NF++
print $0
print NF
}