Annotation of src/usr.bin/awk/FIXES, Revision 1.2
1.1 tholo 1: /****************************************************************
2: Copyright (C) AT&T and Lucent Technologies 1996
3: All Rights Reserved
4:
5: Permission to use, copy, modify, and distribute this software and
6: its documentation for any purpose and without fee is hereby
7: granted, provided that the above copyright notice appear in all
8: copies and that both that the copyright notice and this
9: permission notice and warranty disclaimer appear in supporting
10: documentation, and that the names of AT&T or Lucent Technologies
11: or any of their entities not be used in advertising or publicity
12: pertaining to distribution of the software without specific,
13: written prior permission.
14:
15: AT&T AND LUCENT DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
16: SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
17: FITNESS. IN NO EVENT SHALL AT&T OR LUCENT OR ANY OF THEIR
18: ENTITIES BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
19: DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
20: DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
21: OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
22: USE OR PERFORMANCE OF THIS SOFTWARE.
23: ****************************************************************/
24:
25: This file lists all bug fixes, changes, etc., made since the AWK book
26: was sent to the printers in August, 1987.
27:
28: Sep 12, 1987:
29: Very long printf strings caused core dump;
30: fixed aprintf, asprintf, format to catch them.
31: Can still get a core dump in printf itself.
32:
33: Sep 17, 1987:
34: Error-message printer had printf(s) instead of
35: printf("%s",s); got core dumps when the message
36: included a %.
37:
38: Oct xx, 1987:
39: Reluctantly added toupper and tolower functions.
40: Subject to rescinding without notice.
41:
42: Dec 2, 1987:
43: Newer C compilers apply a strict scope rule to extern
44: declarations within functions. Two extern declarations in
45: lib.c and tran.c have been moved to obviate this problem.
46:
47: Mar 25, 1988:
48: main.c fixed to recognize -- as terminator of command-
49: line options. Illegal options flagged.
50: Error reporting slightly cleaned up.
51:
52: May 10, 1988:
53: Fixed lib.c to permit _ in commandline variable names.
54:
55: May 22, 1988:
56: Removed limit on depth of function calls.
57:
58: May 28, 1988:
59: srand returns seed value it's using.
60: see 1/18/90
61:
62: June 1, 1988:
63: check error status on close
64:
65: July 2, 1988:
66: performance bug in b.c/cgoto(): not freeing some sets of states.
67: partial fix only right now, and the number of states increased
68: to make it less obvious.
69:
70: July 2, 1988:
71: flush stdout before opening file or pipe
72:
73: July 24, 1988:
74: fixed egregious error in toupper/tolower functions.
75: still subject to rescinding, however.
76:
77: Aug 23, 1988:
78: setting FILENAME in BEGIN caused core dump, apparently
79: because it was freeing space not allocated by malloc.
80:
81: Sep 30, 1988:
82: Now guarantees to evaluate all arguments of built-in
83: functions, as in C; the appearance is that arguments
84: are evaluated before the function is called. Places
85: affected are sub (gsub was ok), substr, printf, and
86: all the built-in arithmetic functions in bltin().
87: A warning is generated if a bltin() is called with
88: the wrong number of arguments.
89:
90: This requires changing makeprof on p167 of the book.
91:
92: Oct 12, 1988:
93: Fixed bug in call() that freed local arrays twice.
94:
95: Fixed to handle deletion of non-existent array right;
96: complains about attempt to delete non-array element.
97:
98: Oct 20, 1988:
99: Fixed %c: if expr is numeric, use numeric value;
100: otherwise print 1st char of string value. still
101: doesn't work if the value is 0 -- won't print \0.
102:
103: Added a few more checks for running out of malloc.
104:
105: Oct 30, 1988:
106: Fixed bug in call() that failed to recover storage.
107:
108: A warning is now generated if there are more arguments
109: in the call than in the definition (in lieu of fixing
110: another storage leak).
111:
112: Nov 27, 1988:
113: With fear and trembling, modified the grammar to permit
114: multiple pattern-action statements on one line without
115: an explicit separator. By definition, this capitulation
116: to the ghost of ancient implementations remains undefined
117: and thus subject to change without notice or apology.
118: DO NOT COUNT ON IT.
119:
120: Dec 7, 1988:
121: Added a bit of code to error printing to avoid printing nulls.
122: (Not clear that it actually would.)
123:
124: Dec 17, 1988:
125: Catches some more commandline errors in main.
126: Removed redundant decl of modf in run.c (confuses some compilers).
127: Warning: there's no single declaration of malloc, etc., in awk.h
128: that seems to satisfy all compilers.
129:
130: Jan 9, 1989:
131: Fixed bug that caused tempcell list to contain a duplicate.
132: The fix is kludgy.
133:
134: Apr 9, 1989:
135: Changed grammar to prohibit constants as 3rd arg of sub and gsub;
136: prevents class of overwriting-a-constant errors. (Last one?)
137: This invalidates the "banana" example on page 43 of the book.
138:
139: Added \a ("alert"), \v (vertical tab), \xhhh (hexadecimal),
140: as in ANSI, for strings. Rescinded the sloppiness that permitted
141: non-octal digits in \ooo. Warning: not all compilers and libraries
142: will be able to deal with \x correctly.
143:
144: Apr 26, 1989:
145: Debugging output now includes a version date,
146: if one compiles it into the source each time.
147:
148: Apr 27, 1989:
149: Line number now accumulated correctly for comment lines.
150:
151: Jun 4, 1989:
152: ENVIRON array contains environment: if shell variable V=thing,
153: ENVIRON["V"] is "thing"
154:
155: multiple -f arguments permitted. error reporting is naive.
156: (they were permitted before, but only the last was used.)
157:
158: fixed a really stupid botch in the debugging macro dprintf
159:
160: fixed order of evaluation of commandline assignments to match
161: what the book claims: an argument of the form x=e is evaluated
162: at the time it would have been opened if it were a filename (p 63).
163: this invalidates the suggested answer to ex 4-1 (p 195).
164:
165: removed some code that permitted -F (space) fieldseparator,
166: since it didn't quite work right anyway. (restored aug 2)
167:
168: Jun 14, 1989:
169: added some missing ansi printf conversion letters: %i %X %E %G.
170: no sensible meaning for h or L, so they may not do what one expects.
171:
172: made %* conversions work.
173:
174: changed x^y so that if n is a positive integer, it's done
175: by explicit multiplication, thus achieving maximum accuracy.
176: (this should be done by pow() but it seems not to be locally.)
177: done to x ^= y as well.
178:
179: Jun 23, 1989:
180: add newline to usage message.
181:
182: Jul 10, 1989:
183: fixed ref-thru-zero bug in environment code in tran.c
184:
185: Jul 30, 1989:
186: added -v x=1 y=2 ... for immediate commandline variable assignment;
187: done before the BEGIN block for sure. they have to precede the
188: program if the program is on the commandline.
189: Modified Aug 2 to require a separate -v for each assignment.
190:
191: Aug 2, 1989:
192: restored -F (space) separator
193:
194: Aug 11, 1989:
195: fixed bug: commandline variable assignment has to look like
196: var=something. (consider the man page for =, in file =.1)
197:
198: changed number of arguments to functions to static arrays
199: to avoid repeated malloc calls.
200:
201: Aug 24, 1989:
202: removed redundant relational tests against nullnode if parse
203: tree already had a relational at that point.
204:
205: Oct 11, 1989:
206: FILENAME is now defined in the BEGIN block -- too many old
207: programs broke.
208:
209: "-" means stdin in getline as well as on the commandline.
210:
211: added a bunch of casts to the code to tell the truth about
212: char * vs. unsigned char *, a right royal pain. added a
213: setlocale call to the front of main, though probably no one
214: has it usefully implemented yet.
215:
216: Oct 18, 1989:
217: another try to get the max number of open files set with
218: relatively machine-independent code.
219:
220: small fix to input() in case of multiple reads after EOF.
221:
222: Jan 5, 1990:
223: fix potential problem in tran.c -- something was freed,
224: then used in freesymtab.
225:
226: Jan 18, 1990:
227: srand now returns previous seed value (0 to start).
228:
229: Feb 9, 1990:
230: fixed null pointer dereference bug in main.c: -F[nothing]. sigh.
231:
232: restored srand behavior: it returns the current seed.
233:
234: May 6, 1990:
235: AVA fixed the grammar so that ! is uniformly of the same precedence as
236: unary + and -. This renders illegal some constructs like !x=y, which
237: now has to be parenthesized as !(x=y), and makes others work properly:
238: !x+y is (!x)+y, and x!y is x !y, not two pattern-action statements.
239: (These problems were pointed out by Bob Lenk of Posix.)
240:
241: Added \x to regular expressions (already in strings).
242: Limited octal to octal digits; \8 and \9 are not octal.
243: Centralized the code for parsing escapes in regular expressions.
244: Added a bunch of tests to T.re and T.sub to verify some of this.
245:
246: Jun 26, 1990:
247: changed struct rrow (awk.h) to use long instead of int for lval,
248: since cfoll() stores a pointer in it. now works better when int's
249: are smaller than pointers!
250:
251: Aug 24, 1990:
252: changed NCHARS to 256 to handle 8-bit characters in strings
253: presented to match(), etc.
254:
255: Oct 8, 1990:
256: fixed horrible bug: types and values were not preserved in
257: some kinds of self-assignment. (in assign().)
258:
259: Oct 14, 1990:
260: fixed the bug on p. 198 in which it couldn't deduce that an
261: argument was an array in some contexts. replaced the error
262: message in intest() by code that damn well makes it an array.
263:
264: Oct 29, 1990:
265: fixed sleazy buggy code in lib.c that looked (incorrectly) for
266: too long input lines.
267:
268: Nov 2, 1990:
269: fixed sleazy test for integrality in getsval; use modf.
270:
271: Jan 11, 1991:
272: failed to set numeric state on $0 in cmd|getline context in run.c.
273:
274: Jan 28, 1991:
275: awk -f - reads the program from stdin.
276:
277: Feb 10, 1991:
278: check error status on all writes, to avoid banging on full disks.
279:
280: May 6, 1991:
281: fixed silly bug in hex parsing in hexstr().
282: removed an apparently unnecessary test in isnumber().
283: warn about weird printf conversions.
284: fixed unchecked array overwrite in relex().
285:
286: changed for (i in array) to access elements in sorted order.
287: then unchanged it -- it really does run slower in too many cases.
288: left the code in place, commented out.
289:
290: May 13, 1991:
291: removed extra arg on gettemp, tempfree. minor error message rewording.
292:
293: Jun 2, 1991:
294: better defense against very long printf strings.
295: made break and continue illegal outside of loops.
296:
297: Jun 30, 1991:
298: better test for detecting too-long output record.
299:
300: Jul 21, 1991:
301: fixed so that in self-assignment like $1=$1, side effects
302: like recomputing $0 take place. (this is getting subtle.)
303:
304: Jul 27, 1991:
305: allow newline after ; in for statements.
306:
307: Aug 18, 1991:
308: enforce variable name syntax for commandline variables: has to
309: start with letter or _.
310:
311: Sep 24, 1991:
312: increased buffer in gsub. a very crude fix to a general problem.
313: and again on Sep 26.
314:
315: Nov 12, 1991:
316: cranked up some fixed-size arrays in b.c, and added a test for
317: overflow in penter. thanks to mark larsen.
318:
319: Nov 19, 1991:
320: use RAND_MAX instead of literal in builtin().
321:
322: Nov 30, 1991:
323: fixed storage leak in freefa, failing to recover [N]CCL.
324: thanks to Bill Jones (jones@skorpio.usask.ca)
325:
326: Dec 2, 1991:
327: die-casting time: converted to ansi C, installed that.
328:
329: Feb 20, 1992:
330: recompile after abortive changes; should be unchanged.
331:
332: Apr 12, 1992:
333: added explicit check for /dev/std(in,out,err) in redirection.
334: unlike gawk, no /dev/fd/n yet.
335:
336: added (file/pipe) builtin. hard to test satisfactorily.
337: not posix.
338:
339: Apr 24, 1992:
340: remove redundant close of stdin when using -f -.
341:
342: got rid of core dump with -d; awk -d just prints date.
343:
344: May 31, 1992:
345: added -mr N and -mf N options: more record and fields.
346: these really ought to adjust automatically.
347:
348: cleaned up some error messages; "out of space" now means
349: malloc returned NULL in all cases.
350:
351: changed rehash so that if it runs out, it just returns;
352: things will continue to run slow, but maybe a bit longer.
353:
354: Nov 28, 1992:
355: deleted yyunput and yyoutput from proto.h;
356: different versions of lex give these different declarations.
357:
358: Jul 23, 1993:
359: cosmetic changes: increased sizes of some arrays,
360: reworded some error messages.
361:
362: added CONVFMT as in posix (just replaced OFMT in getsval)
363:
364: FILENAME is now "" until the first thing that causes a file
365: to be opened.
366:
367: Feb 2, 1994:
368: changed error() to print line number as %d, not %g.
369:
370: Apr 22, 1994:
371: fixed yet another subtle self-assignment problem:
372: $1 = $2; $1 = $1 clobbered $1.
373:
374: Regression tests now use private echo, to avoid quoting problems.
375:
376: May 11, 1994:
377: trivial fix to printf to limit string size in sub().
378:
379: Aug 24, 1994:
380: detect duplicate arguments in function definitions (mdm).
381:
382: Jul 17, 1995:
383: added dynamically growing strings to awk.lx.l and b.c
384: to permit regular expressions to be much bigger.
385: the state arrays can still overflow.
386:
387: Aug 15, 1995:
388: initialized Cells in setsymtab more carefully; some fields
389: were not set. (thanks to purify, all of whose complaints i
390: think i now understand.)
391:
392: fixed at least one error in gsub that looked at -1-th element
393: of an array when substituting for a null match (e.g., $).
394:
395: delete arrayname is now legal; it clears the elements but leaves
396: the array, which may not be the right behavior.
397:
398: modified makefile: my current make can't cope with the test used
399: to avoid unnecessary yacc invocations.
400:
401: Apr 29, 1996:
402: replaced uchar by uschar everwhere; apparently some compilers
403: usurp this name and this causes conflicts.
404:
405: fixed call to time in run.c (bltin); arg is time_t *.
406:
407: replaced horrible pointer/long punning in b.c by a legitimate
408: union. should be safer on 64-bit machines and cleaner everywhere.
409: (thanks to nelson beebe for pointing out some of these problems.)
410:
411: replaced nested comments by #if 0...#endif in run.c, lib.c.
412:
413: removed getsval, setsval, execute macros from run.c and lib.c.
414: machines are 100x faster than they were when these macros were
415: first used.
416:
417: revised filenames: awk.g.y => awkgram.y, awk.lx.l => awklex.l,
418: y.tab.[ch] => ytab.[ch], lex.yy.c => lexyy.c, all in the aid of
419: portability to nameless systems.
420:
421: "make bundle" now includes yacc and lex output files for recipients
422: who don't have yacc or lex.
423:
424: May 2, 1996:
425: removed all register declarations.
426:
427: enhanced split(), as in gawk, etc: split(s, a, "") splits s into
428: a[1]...a[length(s)] with each character a single element.
429:
430: made the same changes for field-splitting if FS is "".
431:
432: added nextfile, as in gawk: causes immediate advance to next
433: input file. (thanks to arnold robbins for inspiration and code).
434:
435: small fixes to regexpr code: can now handle []], [[], and
436: variants; [] is now a syntax error, rather than matching
437: everything; [z-a] is now empty, not z. far from complete
438: or correct, however. (thanks to jeffrey friedl for pointing out
439: some awful behaviors.)
440:
441: May 26, 1996:
442: an attempt to rationalize the (unsigned) char issue. almost all
443: instances of unsigned char have been removed; the handful of places
444: in b.c where chars are used as table indices have been hand-crafted.
445: added some latin-1 tests to the regression, but i'm not confident;
446: none of my compilers seem to care much. thanks to nelson beebe for
447: pointing out some others that do care.
448:
449: May 27, 1996:
450: cleaned up some declarations so gcc -Wall is now almost silent.
451:
452: makefile now includes backup copies of ytab.c and lexyy.c in case
453: one makes before looking; it also avoids recreating lexyy.c unless
454: really needed.
455:
456: s/aprintf/awkprint, s/asprintf/awksprintf/ to avoid some name clashes
457: with unwisely-written header files.
458:
459: thanks to jeffrey friedl for several of these.
460:
1.2 ! millert 461: May 28, 1996:
! 462: fixed appalling but apparently unimportant bug in parsing octal
! 463: numbers in reg exprs.
! 464:
! 465: explicit hex in reg exprs now limited to 2 chars: \xa, \xaa.
! 466:
! 467: Jun 28, 1996:
! 468: changed field-splitting to conform to posix definition: fields are
! 469: split using the value of FS at the time of input; it used to be
! 470: the value when the field or NF was first referred to, a much less
! 471: predictable definition. thanks to arnold robbins for encouragement
! 472: to do the right thing.
! 473:
! 474: Jun 29, 1996:
! 475: fixed awful bug in new field splitting; didn't get all the places
! 476: where input was done.
! 477: