Subject: pkg/32745: pkgsrc mk-files use wrong include paths
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <mlelstv@serpens.de>
List: pkgsrc-bugs
Date: 02/05/2006 10:15:01
>Number:         32745
>Category:       pkg
>Synopsis:       pkgsrc mk-files use wrong include paths
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Feb 05 10:15:01 +0000 2006
>Originator:     Michael van Elst
>Release:        NetBSD 3.0_STABLE
>Organization:
-- 
                                Michael van Elst
Internet: mlelstv@serpens.de
                                "A potential Snark may lurk in every tree."
>Environment:
	
	
System: NetBSD henery 3.0_STABLE NetBSD 3.0_STABLE (HENERY) #26: Sat Jan 28 20:13:18 CET 2006 src@henery:/usr/obj/home/src/sys/arch/i386/compile/HENERY i386
Architecture: i386
Machine: i386
>Description:
pkgsrc mk-files use relative file paths to include other mk-files.
E.g.: mk/bsd.pkg.mk includes "../../mk/bsd.prefs.mk".

This assumes that the file is read relative to the current directory
of the make process.

make however uses a more complicated scheme to locate include files.
In particular, it first appends the include path to the directory
where the file is located that contained the .include statement.

E.g.  mk/bsd.pkg.mk tries to include mk/../../mk/bsd.prefs.mk
which is even outside the pkgsrc tree.

pkgsrc still works, because you rarely have a mk-directory next
to the pkgsrc directory and make tries to locate the file also
in some standard directories and finally relative to the current
directory where it then is found.


>How-To-Repeat:
	
>Fix:
Replace the include paths with correct paths reflecting the
position in the pkgsrc tree. E.g.

mk/bsd.pkg.mk should simply include "bsd.prefs.mk"
mk/buildlink3/*.mk should include "../bsd.prefs.mk"

and so on..

>Unformatted: