[net.bugs.4bsd] 4.?bsd

ado@elsie.UUCP (Arthur David Olson) (09/25/84)

Bugged:	/usr/bin/lint

Bugs:	lint sometimes wrongly believes you've used a "-n" or "-p" option;
	it gives a dumb error message if you use "-O";
	it mishandles cases where "-p" is used with "-l".

Repeat by:
	First bug:
		cat << EOF > file.c
		#include <stdio.h>

		main()
		{
			printf("%s\n", "Hello");
			printf("Goodbye\n");
		}
		EOF
		lint -DNONSENSE file.c
		lint -Dnonsense file.c

		...and note that the two lint runs give different results.

	Second bug:
		echo 'main(){}' > file.c
		lint -O file.c

		...and note the spurious diagnostic.

	Third bug:
		cat << EOF > file.c
		#include <stdio.h>
		#include <curses.h>

		main()
		{
			werase(stdscr);
		}
		EOF
		lint file.c -lcurses
		lint -p file.c -lcurses

		...and note the spurious complaint about argument use
		   from the second lint run.

Analysis:
	First bug:
		The "/usr/bin/lint" script mistakes any argument of the form
		"-*n*", even something like "-Dnonsense", for "-n".

	Second bug:
		The "/usr/bin/lint" script passes any "-O" argument to
		"/lib/cpp", which has no idea what to do with it.

	Third bug:
		While two "pre-compiled" versions of "lint library files"
		are maintained for "stdio" functions--one version to be used
		when you say "lint -p", the other to be used when you leave
		off the "-p"--there's only one version of such files for things
		like the "curses" library.

Fix:		I recommend copying "/usr/bin/lint" to "/usr/local/lint"
		(or whatever your "local" directory is), then applying these
		edits.  The trade secret status of "/usr/bin/lint" precludes
		posting things in a clearer way.

		ed - lint << EOF
		/-\*n\*/i
			-[IDU]*) ;;
			-l*)	;;
		.
		/IDOU/s//IDU/
		/-l.*cat/c
			-l*)	case \$P in
				port)	( /lib/cpp \$O \$LL/llib\$A |
					\${L}1 -v\$X >> \$T ) 2>&1 ;;
				*)	cat \$LL/llib\$A.ln >> \$T ;;
				esac ;;
		.
		/\*\.ln)/m/-\*)/
		w
		q
		EOF
--
UNIX and Bugs are AT&T Bell Laboratories and Warner Brothers trademarks.
--
	...decvax!seismo!umcp-cs!elsie!ado	(301) 496-5688
	DEC, VAX and Elsie are Digital Equipment Corp. and Borden's trademarks.

ado@elsie.UUCP (Arthur David Olson) (12/01/85)

Index:		man/man1/awk.1

Description:
		Some (but not all) backslash escapes recognized by the
		C compiler in strings are recognized by awk; documentation
		as to which are (and aren't) is missing.  (I don't know if
		awk's behavior is documented in System V.)

Repeat-By:
		awk 'BEGIN { print "\"\\\b\t\f\r\n\007" ; exit }'
		man awk
		cat /usr/doc/awk
--
Bugs is a Warner Brothers trademarks.
--
	UUCP: ..decvax!seismo!elsie!ado    ARPA: elsie!ado@seismo.ARPA
	DEC, VAX and Elsie are Digital Equipment and Borden trademarks

liberte@uiucdcsb.CS.UIUC.EDU (12/11/85)

I posted a fix for this in April of '84.  Write for a copy.

Daniel LaLiberte   217-333-8740
University of Illinois, Urbana-Champaign
Department of Computer Science
1304 W Springfield
Urbana, IL  61801

liberte@uiucdcs.Uiuc.ARPA
ihnp4!uiucdcs!liberte