From 0f4e1ba922ccd45f7bd47701e923d98566ceb7c5 Mon Sep 17 00:00:00 2001 From: Brian Kernighan Date: Fri, 24 Aug 2018 09:09:59 -0400 Subject: [PATCH] added Arnold's fixes, updates to awktest.tar --- FIXES | 31 +++++++++++++++++++++++++++++++ TODO | 20 -------------------- awktest.tar | Bin 6819840 -> 6850560 bytes main.c | 2 +- makefile | 10 ++++++---- 5 files changed, 38 insertions(+), 25 deletions(-) delete mode 100644 TODO diff --git a/FIXES b/FIXES index 5c33dd9..c697f34 100644 --- a/FIXES +++ b/FIXES @@ -25,6 +25,37 @@ THIS SOFTWARE. This file lists all bug fixes, changes, etc., made since the AWK book was sent to the printers in August, 1987. +Aug 23, 2018: + A long list of fixes courtesy of Arnold Robbins, + to whom profound thanks. + + 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. + + Also added Arnold's tests for these to awktest.tar as T.arnold. + Aug 15, 2018: fixed mangled awktest.tar (thanks, Arnold), posted all current (very minor) fixes to github / onetrueawk diff --git a/TODO b/TODO deleted file mode 100644 index 5099569..0000000 --- a/TODO +++ /dev/null @@ -1,20 +0,0 @@ -Fri Aug 10 11:11:11 IDT 2018 -============================ - -A semi-random list of things to look into. - -1. DONE. Make sure the FIXES file has everything after the date order -was reversed. - -2. DONE. Look into the problem that NF-- doesn't throw away the last field. -This a long-standing issue. - -3. DONE. Add suport for %a and %A printf formats. - -4. DONE. Look into the problem that string conversions are sticky; once -done they never change, even if OFMT or CONVFMT do. Similarly, a -conversion from OFMT becomes the permanent string value, which is -incorrect. - -5. MAYBE: Improve the test suite enough so that it can be cleaned up after -it was run, and old results can be saved for comparison. diff --git a/awktest.tar b/awktest.tar index 959b452cfa4543af5512417e034f895abcac4d9b..31c6ad900d68ae5a1e3030fd0960deaa93316227 100644 GIT binary patch delta 7947 zcmcgxO>i7n5zg99u!j6t`Hw6+t+kX$(e8MDcjZOeApaz`alvXpF znOVt7LNEZW(^wY!d^9(=45A!4Ze*OUe20zM&xWvE7ALI}5hxsG?7$4@3 z^2hk&{0aUfe~LfNpW!3?I3MLF_(}dO2R_EL{1hMO6Z|>;JfGxK`~^PEb3D&wewr&> z$y!A)M^MLxsN@Dl$PpXGDB%wOc+=JWh4KgZAW3w(jU#9!tY`78W8{1U&+7x@yu z!e8afe1%`-*Z6h*8h@RCmw%7n;H!L%f1kg>-{g!}c$Hh+=Cz-#fA!H%r2CogdiA~G z<*}8$|2%Z!0kdeD_bG~^szp`&FX#&W7e5BlR9)AL#iCg(B3;$Af^r`ydt=uRSwqbr zWIn)smA&D&N1r`hV^yO6@z!70hg!IZRf5nCLZ~@6?Eq@Nw*~XGxCP5zrQ)~&%$!zd za!~Vp*x7KZ8?eRPT?jXryBSE5zXf@}20~veFN8?6-py{Bj5Migb@NFrwzD}m{to`l z%kpXbWwO@{e;`S;m;;UrFUUA3S)K&ovMqaVe6qpxdV_Z1JpyYEJVvS;Vdm*A=#?FlBu#HsAw@WqpV_~_8l zW1V}YeSJ85>DI$1j+h0*xWgG04Lqp!8PRzus$MkJv@?3BbE(rGe^z--EOa+#=voL@ zK$kJe8O*yn!${XcO_%w*`9{4N$Q4FT_)5zDa8a!o?a$OSqkz7u8oH6XzbD_43|&?= z-7pKqnKQ}5?crY@|6AtiE}d8&ePWA+u|{bYM~#X`k4Ab?*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XlYYe(Ad6HjW*y?l~5r(H)^59Se}!}IINCU znbWEz)Y$fP{faW|2UGMt>bwATUH~19CHmv0$Xn0@?6B!mEk>q`HYZE*)yYv*k8_sD z3ZY<&HWzv)+Iu0L)}8Ixk;J%6J(n+gLTm>x3|O!qOcr$v{V8yJtT(fwaQ~0Yqh07I zE*b^;30KHy1_s0CCOLOP2u=kNw8lozBQuIcv zSm{PdM-2mL0Qif@6QS7Jnuw>>8_rq|xrQ8g4^DTCo`x48`(74GkR5w3I|c8Od^a3G zeu8ZMdFz>`q+d1?oE5SWDIeIEA! zkK4=QA7Jr&S;C%8t;U4?b+(0&8 zlAe>TwYse!t;Y6Gu2-9|Z_C*H`yBt%dBlo5g((kaFMW^W%RAPBh|UAlf(Ovqz{Y&q z9l14{d1PWb`&LxXL>1I@w(rLSHZ%GOHpue*8)T?sdV@?gdfT|Vft}rydyEm}#(_=) zqI;z6;zGOVrU*-CtwamSKYBUuA zaP&D#!H&9ZQlh%be@@&?wad$k)a9!h8PY ac^(fl=6?Y#hy@}5 delta 280 zcmbWn#ZdzR006*Af@^Sh_h7+8aCdiyHtw+nFhc`33_Z{m1@NE;_OZeHXDkTASRf)Q zCPSty*>dE{ldnLbBE{lLlqyrMLZvFzYSgMzuR)_G&04f-)2>6OF5PeFw)pdksv zMvNLWE@{G~Dbr@mnv*gwZNZ`?%T}yfvu?wtE!%eN+OzM#p(DpmoH}#v!lf(MZrr+a Z@4=%d&tANKz5Ra2Q_-Ku|NclM!#_y#WM%*W diff --git a/main.c b/main.c index d292ad3..60d7c48 100644 --- a/main.c +++ b/main.c @@ -22,7 +22,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ****************************************************************/ -const char *version = "version 20130105 + fixes by arnold@skeeve.com 20180822"; +const char *version = "version 20180823"; #define DEBUG #include diff --git a/makefile b/makefile index 8f5906f..3e29e66 100644 --- a/makefile +++ b/makefile @@ -23,17 +23,19 @@ # ****************************************************************/ CFLAGS = -g -CFLAGS = -O2 CFLAGS = +CFLAGS = -O2 +# compiler options #CC = gcc -Wall -g -Wwrite-strings -CC = gcc -g -Wall -pedantic #CC = gcc -O4 -Wall -pedantic -fno-strict-aliasing #CC = gcc -fprofile-arcs -ftest-coverage # then gcov f1.c; cat f1.c.gcov +CC = gcc -g -Wall -pedantic -YACC = bison -d -y -# YACC = yacc -d +# yacc options. pick one; this varies a lot by system. #YFLAGS = -d -S +#YACC = bison -d -y +YACC = yacc -d # -S uses sprintf in yacc parser instead of sprint OFILES = b.o main.o parse.o proctab.o tran.o lib.o run.o lex.o