From owner-freebsd-bugs Sat Jan 19 11: 0:17 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 3E5F237B419 for ; Sat, 19 Jan 2002 11:00:01 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g0JJ01j31619; Sat, 19 Jan 2002 11:00:01 -0800 (PST) (envelope-from gnats) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 0C5AF37B404 for ; Sat, 19 Jan 2002 10:55:30 -0800 (PST) Received: (from nobody@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g0JItUh29643; Sat, 19 Jan 2002 10:55:30 -0800 (PST) (envelope-from nobody) Message-Id: <200201191855.g0JItUh29643@freefall.freebsd.org> Date: Sat, 19 Jan 2002 10:55:30 -0800 (PST) From: Kevin Walsh To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-1.0 Subject: misc/34062: bsd.kmod.mk fails due to bug in make with .PATH and exists() function Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 34062 >Category: misc >Synopsis: bsd.kmod.mk fails due to bug in make with .PATH and exists() function >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Jan 19 11:00:01 PST 2002 >Closed-Date: >Last-Modified: >Originator: Kevin Walsh >Release: 4.3-RELEASE >Organization: Duke University >Environment: FreeBSD rack27.cs.duke.edu 4.4-RELEASE FreeBSD 4.4-RELEASE #0: Fri Nov 2 16:21:54 EST 2001 priya@rack26.cs.duke.edu:/usr/research/playground/priya/fbsd/4.4-RELEASE/compile/DUMMY i386 >Description: When attempting to compile the 4.4-RELEASE kernel modules ('make modules' from the compile/DUMMY directory) make fails with the error: ===> libmchain "/usr/share/mk/bsd.kmod.mk", line 10: "can't find kernel source tree" *** Error code 1 A tour of libmchain/Makefile and the bsd.kmod.mk file reveals the following bug. If a path (in this case /blah/blah/../../kern) is specified in the .PATH (as it is in libmchain/Makefile), then the .exists() function will fail when searching for the exact same path if a trailing '/' is left on (in this case, bsd.kmod.mk searches for /blah/blah/../../kern/). This bug is too obvious and problematic to be real. I ran into it on my very first FreeBSD compile ever (and in multiple places, too!) >How-To-Repeat: Do 'make modules'. Or run 'make' in a directory with the following Makefile: # Makefile -- this will break the FreeBSD make (pmake???) and # illustrates what is wrong with the kernel makefiles _FOO=/usr/local/bin/ # this one works fine .if exists(${_FOO}) .else .error "first try -- _FOO does not exist: ${_FOO}" .endif # this also works fine .PATH: /usr/local .if exists(${_FOO}) .else .error "second try -- _FOO does not exist: ${_FOO}" .endif # this one fails .PATH: /usr/local/bin .if exists(${_FOO}) .else .error "third try -- _FOO does not exist: ${_FOO}" .endif all: >Fix: Workaround 1: fix all of the makefiles to never search for a directory with a trailing '/' character. Workaround 2: fix all of the module makefiles to never include '../../kern'. Fix: Change the function Dir_FindFile(name,path) in usr.bin/make/dir.c so that (1) there is a check to see if 'name' is absolute BEFORE failing, and/or (2) trailing slashes are recognized and handled appropriately. >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message