XBR4D75G%DDATHD21.BITNET@cunyvm.cuny.edu (03/26/90)
During my upgrade process to 1.5.5, I found the following bugs in the official version of programs "unshar.c" and "ast.c". "unshar.c" contained a simple spelling error, two characters must be interchanged. *** unshar.old Tue Mar 20 13:50:00 1990 --- unshar.c Tue Mar 20 13:51:06 1990 *************** *** 104,110 **** case '\"': case '\'': buf++; ! inquotes != inquotes; /* Toggle inquotes */ break; case 0: case '\n': /* Stop on <, >, NULL */ --- 104,110 ---- case '\"': case '\'': buf++; ! inquotes = !inquotes; /* Toggle inquotes */ break; case 0: case '\n': /* Stop on <, >, NULL */ The problem with program "ast.c" is more serious, because I only have a method to circumvent the error but not to correct the real problem. During execution of "ast" the o_file is opened by two different routines ( fopen() and open() ) and the file-descriptors are position to different places: if ((o_fd = fopen(o_file, "a")) == (FILE *) NULL) { ......... } fseek(o_fd, A_SYMPOS(header), SEEK_SET); ........ if ((fd = open(o_file, O_RDONLY)) < 0) { ........ } if (read(fd, &header, sizeof(struct exec)) != sizeof(struct exec)) { ......... } ......... close(fd); ......... if (fwrite(symbol, sizeof(struct nlist), 1, fd) != 1) { ......... } ......... fclose(o_fd); The official version 1.5.5 of "ast" writes the symbol-table at the beginning of o_file instead to append it. Here is a posible fix to this: *** ast.old Tue Mar 20 12:08:22 1990 --- ast.c Tue Mar 20 13:40:52 1990 *************** *** 83,89 **** fprintf(stderr, "can't open %s\n", o_file); exit(-1); } - fseek(o_fd, A_SYMPOS(header), SEEK_SET); if (s_file == (char *) NULL) s_file = SYMBOL_FILE; if ((s_fd = fopen(s_file, "r")) == (FILE *) NULL) { fprintf(stderr, "can't open %s\n", s_file); --- 83,88 ---- *************** *** 91,96 **** --- 90,96 ---- } nr_symbols = 0; do_header(); + fseek(o_fd, A_SYMPOS(header), SEEK_SET); ast(); fclose(o_fd); redo_header(); Hans-Juergen Knobloch, (T.H. Darmstadt, West Germany)