Thread View: comp.bugs.sys5
1 messages
1 total messages
Started by wescott
Thu, 28 May 1987 18:24
bugs in make (SysVr3 and earlier) with fixes
Author: wescott
Date: Thu, 28 May 1987 18:24
Date: Thu, 28 May 1987 18:24
383 lines
8643 bytes
8643 bytes
I should be surprised that these bugs are as old as they are, but make is
difficult enough to get right that most users have figured it was their own
fault when things didn't work. I know that I did.
These bugs all involve make's handling of automatic get's of SCCS files. Auto
get's happen for description files on the command line (-f option), for
included files, and for dependencies and targets if the (undocumented) -g
option is invoked.
Problem 1:
Make trys to get the wrong file:
make -f ../xxx
where s.xxx (and not xxx) exists in .. causes make to
cd ..; get ../s.xxx
which won't usually work, and if it does is most certainly wrong.
Problem 2:
Make will remove an s. file:
make -f ./xxx
where . contains s.xxx will work ok until make finishes at which
time it removes s.xxx rather than ./xxx
Problem 3:
If s.xxx is a description file and s.s.xxx its SCCS file. Then
make -f s.xxx
will cause make to do a get on s.xxx rather than on s.s.xxx
Problem 4:
Using the -g option (do an automatic get) causes a get to be done
in the cwd rather than creating the intended target.
Problem 5:
make closes stdin when stdin is a description file:
make -f - < Makefile
will cause all command invoked by make to be exec'd without an open
stdin. This can screw up filename expansion on some older /bin/sh's.
Patch with this -- your line numbers are probably different.
-Mike Wescott
ncrcae!wescott
wescott@ncrcae.Columbia.NCR.COM
*** doname.c.orig Wed May 27 17:26:04 1987
--- doname.c Wed May 27 17:26:14 1987
***************
*** 353,359
}
}
else if(IS_OFF(GET) ||
! !get(p->namep, NOCD, 0) )
{
fatal1(" Don't know how to make %s", p->namep);
}
--- 353,359 -----
}
}
else if(IS_OFF(GET) ||
! !get(p->namep, CD, 0) )
{
fatal1(" Don't know how to make %s", p->namep);
}
*** main.c.orig Thu May 28 11:24:21 1987
--- main.c Wed May 27 13:12:34 1987
***************
*** 342,348
if( yyparse() )
fatal("Description file error");
! if(fin != NULL)
fclose(fin);
return(0);
--- 342,348 -----
if( yyparse() )
fatal("Description file error");
! if(fin != NULL && fin != stdin)
fclose(fin);
return(0);
*** misc.c.orig Wed May 27 17:26:42 1987
--- misc.c Thu May 28 12:57:13 1987
***************
*** 1081,1086
{
register CHARSTAR pr;
register CHARSTAR pr1;
char gbuf[128];
char sfile[128];
int retval;
--- 1081,1087 -----
{
register CHARSTAR pr;
register CHARSTAR pr1;
+ register CHARSTAR pr2;
char gbuf[128];
char sfile[128];
int retval;
***************
*** 1084,1089
char gbuf[128];
char sfile[128];
int retval;
GOTF gf;
copstr(sfile, ssfile);
--- 1085,1091 -----
char gbuf[128];
char sfile[128];
int retval;
+ int retryflg = 0;
GOTF gf;
#ifdef MKDEBUG
***************
*** 1086,1091
int retval;
GOTF gf;
copstr(sfile, ssfile);
if(!sdot(sfile))
trysccs(sfile);
--- 1088,1096 -----
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);
***************
*** 1089,1094
copstr(sfile, ssfile);
if(!sdot(sfile))
trysccs(sfile);
if(access(sfile, 4) != 0 && IS_OFF(GET))
return(NO);
--- 1094,1102 -----
copstr(sfile, ssfile);
if(!sdot(sfile))
trysccs(sfile);
+ else
+ retryflg++;
+ retry:
if(access(sfile, 4) != 0 && IS_OFF(GET))
if (retryflg) {
retryflg = 0;
***************
*** 1090,1096
if(!sdot(sfile))
trysccs(sfile);
if(access(sfile, 4) != 0 && IS_OFF(GET))
! return(NO);
pr = gbuf;
if(IS_OFF(SIL))
--- 1098,1111 -----
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))
***************
*** 1096,1102
if(IS_OFF(SIL))
pr = copstr(pr, "set -x;\n");
! if(cdflag == CD)
if(any(sfile, SLASH))
{
pr = copstr(pr, "cd ");
--- 1111,1117 -----
if(IS_OFF(SIL))
pr = copstr(pr, "set -x;\n");
! pr1 = sfile;
if(any(sfile, SLASH))
{
for(; *pr1; pr1++);
***************
*** 1099,1106
if(cdflag == CD)
if(any(sfile, SLASH))
{
! pr = copstr(pr, "cd ");
! for(pr1 = sfile; *pr1; pr1++);
while(*pr1 != SLASH)
pr1--;
*pr1 = CNULL;
--- 1114,1120 -----
pr1 = sfile;
if(any(sfile, SLASH))
{
! for(; *pr1; pr1++);
while(*pr1 != SLASH)
pr1--;
*pr1 = CNULL;
***************
*** 1104,1112
while(*pr1 != SLASH)
pr1--;
*pr1 = CNULL;
! pr = copstr(pr, sfile);
! pr = copstr(pr, ";\n");
! *pr1 = SLASH;
}
pr = copstr(pr, varptr("GET")->varval);
--- 1118,1129 -----
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,1121
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");
--- 1131,1138 -----
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");
***************
*** 1117,1123
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, " ");
--- 1134,1140 -----
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, " ");
***************
*** 1119,1125
{
if(pr1[0] != MINUS) /* RELEASE doesn't have '-r' */
pr = copstr(pr, "-r");
! pr = copstr(pr, pr1);
pr = copstr(pr, " ");
}
--- 1136,1142 -----
{
if(pr2[0] != MINUS) /* RELEASE doesn't have '-r' */
pr = copstr(pr, "-r");
! pr = copstr(pr, pr2);
pr = copstr(pr, " ");
}
***************
*** 1123,1129
pr = copstr(pr, " ");
}
! pr = copstr(pr, sfile);
/*
* exit codes are opposite of error codes so do the following:
*/
--- 1140,1146 -----
pr = copstr(pr, " ");
}
! pr = copstr(pr, pr1);
/*
* exit codes are opposite of error codes so do the following:
*/
***************
*** 1144,1150
gf = gf->gnextp;
gf->gnextp = 0;
}
! gf->gnamep = copys(sfile+2); /* `+2' skips `s.' */
gotfiles->endp = gf;
}
return(retval);
--- 1161,1172 -----
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) {
***************
*** 1147,1152
gf->gnamep = copys(sfile+2); /* `+2' skips `s.' */
gotfiles->endp = gf;
}
return(retval);
}
--- 1169,1181 -----
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
wescott@ncrcae.Columbia.NCR.COM
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads