From 7701b3e2af91c74c36811e80d688308234bf30fc Mon Sep 17 00:00:00 2001 From: imp Date: Fri, 26 Jul 2002 21:50:36 +0000 Subject: Back out jmallett's realpath changes. They break a set of makefiles that we use in sublte ways with relative paths. Until they can be resolved, back out these changes and put a big comment about why using realpath is busted. Approved by: jmallett MFC After: 100 millifortnights --- usr.bin/make/main.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'usr.bin') diff --git a/usr.bin/make/main.c b/usr.bin/make/main.c index 51dab2f..273b5a3 100644 --- a/usr.bin/make/main.c +++ b/usr.bin/make/main.c @@ -923,6 +923,22 @@ ReadMakefile(p, q) /* if we've chdir'd, rebuild the path name */ if (curdir != objdir && *fname != '/') { (void)snprintf(path, MAXPATHLEN, "%s/%s", curdir, fname); + /* + * XXX The realpath stuff breaks relative includes + * XXX in some cases. The problem likely is in + * XXX parse.c where it does special things in + * XXX ParseDoInclude if the file is relateive + * XXX or absolute and not a system file. There + * XXX it assumes that if the current file that's + * XXX being included is absolute, that any files + * XXX that it includes shouldn't do the -I path + * XXX stuff, which is inconsistant with historical + * XXX behavior. However, I can't pentrate the mists + * XXX further, so I'm putting this workaround in + * XXX here until such time as the underlying bug + * XXX can be fixed. + */ +#if THIS_BREAKS_THINGS if (realpath(path, path) != NULL && (stream = fopen(path, "r")) != NULL) { MAKEFILE = fname; @@ -935,6 +951,18 @@ ReadMakefile(p, q) if ((stream = fopen(fname, "r")) != NULL) goto found; } +#else + if ((stream = fopen(path, "r")) != NULL) { + MAKEFILE = fname; + fname = path; + goto found; + } + } else { + MAKEFILE = fname; + if ((stream = fopen(fname, "r")) != NULL) + goto found; + } +#endif /* look in -I and system include directories. */ name = Dir_FindFile(fname, parseIncPath); if (!name) -- cgit v1.1