NetBSD Problem Report #15163

Received: (qmail 20040 invoked from network); 7 Jan 2002 12:01:57 -0000
Message-Id: <200201071201.g07C1AX09139@sam.few.eur.nl>
Date: Mon, 7 Jan 2002 13:01:10 +0100 (MET)
From: Paul Kranenburg <pk@cs.few.eur.nl>
Reply-To: pk@cs.few.eur.nl
To: gnats-bugs@gnats.netbsd.org
Subject: make(1) looks for angle-bracket include files in unsuspected places
X-Send-Pr-Version: 3.95

>Number:         15163
>Category:       toolchain
>Synopsis:       make(1) looks for angle-bracket include files in unsuspected places
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    toolchain-manager
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon Jan 07 12:02:00 +0000 2002
>Closed-Date:    
>Last-Modified:  Tue Feb 12 08:58:09 +0000 2002
>Originator:     Paul Kranenburg
>Release:        NetBSD-current Jan 6, 2002
>Organization:

>Environment:

>Description:
	The make(1) manual suggests files pulled in by the angle-bracket
	form of the `include' statement should be read from the built-in
	and `-m' specified directories. Yet make will happily read those
	files from .CURDIR and .OBJDIR too.
>How-To-Repeat:
	Put e.g. a file called `bsd.own.mk' in an object build directory
>Fix:
>Release-Note:
>Audit-Trail:

From: Reinoud Zandijk <reinoud@netbsd.org>
To: gnats-bugs@gnats.netbsd.org
Cc:  
Subject: toolchain/15163
Date: Wed, 23 Jan 2002 00:19:36 +0100

 Dear all,

 i've investigated the problem and came with the following patch that solves 
 this PR a bit ... it includes a small change in parse.c to improve search logic 
 since it will try to find the file in the wrong place by default allready. 
 The patch also gives a (small?) speed increase since the system files are 
 now directly found instead of after a few misguided searches.

 Cheers,
 Reinoud

 Index: parse.c
 ===================================================================
 RCS file: /cvsroot/basesrc/usr.bin/make/parse.c,v
 retrieving revision 1.75
 diff -u -r1.75 parse.c
 --- parse.c	2001/10/31 03:59:42	1.75
 +++ parse.c	2002/01/22 23:05:23
 @@ -1771,6 +1771,8 @@
       * find the durn thing. A return of NULL indicates the file don't
       * exist.
       */
 +    fullname = (char *)NULL;
 +
      if (!isSystem) {
  	/*
  	 * Include files contained in double-quotes are first searched for
 @@ -1803,27 +1805,24 @@
  	    fullname = (char *)NULL;
  	}
  	free (Fname);
 -    } else {
 -	fullname = (char *)NULL;
 -    }
 -
 -    if (fullname == (char *)NULL) {
 -	/*
 -	 * System makefile or makefile wasn't found in same directory as
 -	 * included makefile. Search for it first on the -I search path,
 -	 * then on the .PATH search path, if not found in a -I directory.
 -	 * XXX: Suffix specific?
 -	 */
 -	fullname = Dir_FindFile (file, parseIncPath);
 -	if (fullname == (char *)NULL) {
 -	    fullname = Dir_FindFile(file, dirSearchPath);
 -	}
 -    }
 +        if (fullname == (char *)NULL) {
 +	    /*
 +    	     * Makefile wasn't found in same directory as included makefile.
 +	     * Search for it first on the -I search path,
 +	     * then on the .PATH search path, if not found in a -I directory.
 +	     * XXX: Suffix specific?
 +	     */
 +	    fullname = Dir_FindFile (file, parseIncPath);
 +	    if (fullname == (char *)NULL) {
 +	        fullname = Dir_FindFile(file, dirSearchPath);
 +	    }
 +        }
 +    };

 +    /* system path or file still not found : */
      if (fullname == (char *)NULL) {
  	/*
 -	 * Still haven't found the makefile. Look for it on the system
 -	 * path as a last resort.
 +	 * Look for it on the system path
  	 */
  	fullname = Dir_FindFile(file, Lst_IsEmpty(sysIncPath) ? defIncPath : sysIncPath);
      }
Responsible-Changed-From-To: bin-bug-people->toolchain-manager 
Responsible-Changed-By: gnats 
Responsible-Changed-When: Tue Feb 12 00:58:07 PST 2002 
Responsible-Changed-Why:  
There is now a "toolchain-manager" which is the proper default role 
account for handling problem reports in the toolchain category. 

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.