*BSD News Article 3712


Return to BSD News archive

Newsgroups: comp.unix.bsd
Path: sserve!manuel!munnari.oz.au!mips!mips!darwin.sura.net!mojo.eng.umd.edu!pandora.pix.com!news
From: news@pix.com (The News Subsystem)
Subject: make(1) bug
Message-ID: <Bt3044.Fzp@pix.com>
Sender: news@pix.com (The News Subsystem)
Nntp-Posting-Host: pandora.pix.com
Organization: Pix -- The company with no adult supervision.
Date: Sun, 16 Aug 1992 14:55:15 GMT
Lines: 48

This article was posted to comp.bugs.4bsd many moons ago,
but is still relevant.  The bug is in the 386bsd make, might
be applicable to BSDI's system also.


From: jfw@eddie.mit.edu (John Woods)
Newsgroups: comp.bugs.4bsd
Subject: Bug in make (4.3Reno/NET2)
Message-ID: <1992Mar17.052343.7513@eddie.mit.edu>
Date: 17 Mar 92 05:23:43 GMT
Sender: news@eddie.mit.edu (Usenet News)
Reply-To: jfw@eddie.mit.edu (John Woods)
Organization: MIT EECS/ECF Facility, Cambridge Mass
Lines: 32


There is a bug in the new make from 4.3Reno and also present in the Net2
release (as found on uunet).  A command line argument consisting of a lone
dash (-) causes an infinite loop ("make - make" was an excellent test case).

I believe the following patch fixes the bug; it still represents what I
would call unwarranted chumminess with the library.  The fix is to keep
getopt() from being asked to re-examine the - argument, which it will
again call an error and not advance optind past...

*** main.c.orig	Mon Mar 16 20:19:13 1992
--- main.c	Mon Mar 16 20:20:52 1992
***************
*** 280,286 ****
  			if (!**argv)
  				Punt("illegal (null) argument.");
  			if (**argv == '-') {
! 				optind = 0;
  				goto rearg;
  			}
  			(void)Lst_AtEnd(create, (ClientData)*argv);
--- 280,289 ----
  			if (!**argv)
  				Punt("illegal (null) argument.");
  			if (**argv == '-') {
! 				if ((*argv)[1])
! 					optind = 0;	/* -flag... */
! 				else
! 					optind = 1;	/* - */
  				goto rearg;
  			}
  			(void)Lst_AtEnd(create, (ClientData)*argv);