Article View: comp.bugs.sys5
Article #969bugs in make (with fixes)
From: Mike Wescott
Date: Thu, 02 Feb 1989 19:03
Date: Thu, 02 Feb 1989 19:03
317 lines
7190 bytes
7190 bytes
These patches are against SysVr3v2 sources. Your line numbers will
vary.
Bugs:
1. macro substitution doesn't work recursively (misc.c)
(with suffix replacement and $(@F) type macros)
2. automatic gets in other directories don't alway
get or remove properly (doname.c, misc.c)
3. older bourne shells have bug when stdin is closed
before the shell is exec'd (main.c)
diff -cr src.V.3.2/doname.c src.1.02/doname.c
*** src.V.3.2/doname.c Tue Jan 24 15:56:50 1989
--- src.1.02/doname.c Tue Jan 24 15:57:09 1989
***************
*** 70,79 ****
explcom = 0;
ptime = exists(p);
#ifdef MKDEBUG
! if(reclevel == 0 && if (IS_ON(DBUG))
{
! blprt(reclevel);
! printf("TIME(%s)=%ld\n", p->namep, ptime);
}
#endif
--- 73,82 ----
explcom = 0;
ptime = exists(p);
#ifdef MKDEBUG
! if(reclevel == 0 && (IS_ON(DBUG)))
{
! blprt(reclevel);
! printf("TIME(%s)=%ld\n", p->namep, ptime);
}
#endif
***************
*** 353,359 ****
}
}
else if(IS_OFF(GET) ||
! !get(p->namep, NOCD, 0) )
{
fatal1(" Don't know how to make %s", p->namep);
}
--- 356,362 ----
}
}
else if(IS_OFF(GET) ||
! !get(p->namep, CD, 0) )
{
fatal1(" Don't know how to make %s", p->namep);
}
diff -cr src.V.3.2/main.c src.1.02/main.c
*** src.V.3.2/main.c Tue Jan 24 15:56:53 1989
--- src.1.02/main.c Tue Jan 24 15:57:14 1989
***************
*** 342,348 ****
if( yyparse() )
fatal("Description file error");
! if(fin != NULL)
fclose(fin);
return(0);
--- 345,351 ----
if( yyparse() )
fatal("Description file error");
! if(fin != NULL && fin != stdin)
fclose(fin);
return(0);
diff -cr src.V.3.2/misc.c src.1.02/misc.c
*** src.V.3.2/misc.c Tue Jan 24 15:56:53 1989
--- src.1.02/misc.c Tue Jan 24 15:57:16 1989
***************
*** 312,331 ****
if((vbp = srchvar(vname)) == NULL)
return(b);
p = vbp->varval;
if(dftype)
! {
! if((q = calloc(strlen(p)+2, 1)) == NULL)
! fatal("Cannot alloc mem");
! do_df(q, p, vname[1]); /* D/F trans gets smaller */
! p = q;
! }
if(p && *p)
b = do_colon(b, p, pcolon+1);
*pcolon = KOLON;
if(dftype)
vname[1] = dftype;
! if(q)
! cfree(q);
return(b);
}
/*
--- 315,333 ----
if((vbp = srchvar(vname)) == NULL)
return(b);
p = vbp->varval;
+ if((q = calloc(OUTMAX, 1)) == NULL)
+ fatal("Cannot alloc mem");
if(dftype)
! do_df(q, p, dftype); /* D/F trans gets smaller */
! else
! subst(p, q);
! p = q;
if(p && *p)
b = do_colon(b, p, pcolon+1);
*pcolon = KOLON;
if(dftype)
vname[1] = dftype;
! cfree(q);
return(b);
}
/*
***************
*** 458,464 ****
{
if(buf[0] == BLANK || buf[0] == TAB)
{
! b = copstr(b, buf);
continue;
}
p = lastslash(buf);
--- 460,466 ----
{
if(buf[0] == BLANK || buf[0] == TAB)
{
! b = subst(buf, b);
continue;
}
p = lastslash(buf);
***************
*** 465,475 ****
if(p)
{
*p = CNULL;
! b = copstr(b, type=='D'?(buf[0]==CNULL?"/":buf):p+1);
*p = SLASH;
}
else
! b = copstr(b, type=='D'?".":buf);
}
return(b);
}
--- 467,477 ----
if(p)
{
*p = CNULL;
! b = subst(type=='D'?(buf[0]==CNULL?"/":buf):p+1, b);
*p = SLASH;
}
else
! b = subst(type=='D'?".":buf, b);
}
return(b);
}
***************
*** 1081,1112 ****
{
register CHARSTAR pr;
register CHARSTAR pr1;
char gbuf[128];
char sfile[128];
int retval;
GOTF gf;
copstr(sfile, ssfile);
if(!sdot(sfile))
trysccs(sfile);
if(access(sfile, 4) != 0 && IS_OFF(GET))
! return(NO);
pr = gbuf;
if(IS_OFF(SIL))
pr = copstr(pr, "set -x;\n");
! if(cdflag == CD)
if(any(sfile, SLASH))
{
! pr = copstr(pr, "cd ");
! for(pr1 = sfile; *pr1; pr1++);
while(*pr1 != SLASH)
pr1--;
*pr1 = CNULL;
! pr = copstr(pr, sfile);
! pr = copstr(pr, ";\n");
! *pr1 = SLASH;
}
pr = copstr(pr, varptr("GET")->varval);
--- 1083,1131 ----
{
register CHARSTAR pr;
register CHARSTAR pr1;
+ register CHARSTAR pr2;
char gbuf[128];
char sfile[128];
int retval;
+ int retryflg = 0;
GOTF gf;
+ #ifdef MKDEBUG
+ if(IS_ON(DBUG))printf("get: %s\n", ssfile);
+ #endif
copstr(sfile, ssfile);
if(!sdot(sfile))
trysccs(sfile);
+ else
+ retryflg++;
+ retry:
if(access(sfile, 4) != 0 && IS_OFF(GET))
! if (retryflg) {
! retryflg = 0;
! copstr(sfile, ssfile);
! trysccs(sfile);
! goto retry;
! }
! else
! return(NO);
pr = gbuf;
if(IS_OFF(SIL))
pr = copstr(pr, "set -x;\n");
! pr1 = sfile;
if(any(sfile, SLASH))
{
! for(; *pr1; pr1++);
while(*pr1 != SLASH)
pr1--;
*pr1 = CNULL;
! if(cdflag == CD) {
! pr = copstr(pr, "cd ");
! pr = copstr(pr, sfile);
! pr = copstr(pr, ";\n");
! }
! *pr1++ = SLASH;
}
pr = copstr(pr, varptr("GET")->varval);
***************
*** 1114,1129 ****
pr = copstr(pr, varptr("GFLAGS")->varval);
pr = copstr(pr, " ");
! pr1 = rlse;
! if(pr1 != NULL && pr1[0] != CNULL)
{
! if(pr1[0] != MINUS) /* RELEASE doesn't have '-r' */
pr = copstr(pr, "-r");
! pr = copstr(pr, pr1);
pr = copstr(pr, " ");
}
! pr = copstr(pr, sfile);
/*
* exit codes are opposite of error codes so do the following:
*/
--- 1133,1148 ----
pr = copstr(pr, varptr("GFLAGS")->varval);
pr = copstr(pr, " ");
! pr2 = rlse;
! if(pr2 != NULL && pr2[0] != CNULL)
{
! if(pr2[0] != MINUS) /* RELEASE doesn't have '-r' */
pr = copstr(pr, "-r");
! pr = copstr(pr, pr2);
pr = copstr(pr, " ");
}
! pr = copstr(pr, pr1);
/*
* exit codes are opposite of error codes so do the following:
*/
***************
*** 1144,1152 ****
gf = gf->gnextp;
gf->gnextp = 0;
}
! gf->gnamep = copys(sfile+2); /* `+2' skips `s.' */
gotfiles->endp = gf;
}
return(retval);
}
--- 1163,1183 ----
gf = gf->gnextp;
gf->gnextp = 0;
}
! if (cdflag == CD) {
! while(*pr1 = *(pr1+2)) pr1++; /* `+2' skips `s.' */
! gf->gnamep = copys(sfile);
! }
! else
! gf->gnamep = copys(pr1 + 2); /* GET put it in cwd */
gotfiles->endp = gf;
}
+ else if (retryflg) {
+ retryflg = 0;
+ copstr(sfile, ssfile);
+ trysccs(sfile);
+ goto retry;
+ }
+
return(retval);
}
--
-Mike Wescott
mike.wescott@ncrcae.Columbia.NCR.COM
Technical Details
Message-ID:
<1530@sauron.Columbia.NCR.COM>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uflorida!gatech!hubcap!ncrcae!sauron!wescottShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uflorida!gatech!hubcap!ncrcae!sauron!wescott From: wescott@sauron.Columbia.NCR.COM (Mike Wescott) Newsgroups: comp.bugs.sys5 Subject: bugs in make (with fixes) Message-ID: <1530@sauron.Columbia.NCR.COM> Date: 2 Feb 89 19:03:56 GMT Reply-To: wescott@sauron.Columbia.NCR.COM (Mike Wescott) Organization: Entry Level Systems Development, NCR Corp., Columbia, SC Lines: 317