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: Sat May 07 21:05:00 +0000 2022
>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.
From: Roland Illig <roland.illig@gmx.de>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: toolchain/15163
Date: Sat, 7 May 2022 23:00:15 +0200
The suggested patch has been committed in parse.c 1.76 from 2002-01-24.
That patch didn't fix the problem though. As of 2022-05-07, '.include
<file>' still searches the current directory first. This is implemented
in Dir_FindFile, which calls DirFindDot before searching the path.
The behavior has been the same since 1997 at least.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.