[BACK]Return to FIXES CVS log [TXT][DIR] Up to [local] / src / usr.bin / awk

Annotation of src/usr.bin/awk/FIXES, Revision 1.4

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