config(8) patch for review for src dir handling
Ed Maste
emaste at freebsd.org
Wed Dec 26 18:54:21 PST 2007
On Sun, Dec 23, 2007 at 10:40:39AM +0100, Dag-Erling Sm??rgrav wrote:
> Ed Maste <emaste at freebsd.org> writes:
> > Right now config(8) calls realpath("../..", ... to find the src path
> > to write into the kernel Makefile. I want to change this to use $PWD
> > with the last two path components removed, assuming it's the same dir
> > as ../.. .
>
> I'm worried that your patch assumes that $PWD is present and correct,
> for which there is no guarantee. What happens if you use getcwd()
> instead of getenv("PWD")?
The patch assumes neither; it checks for $PWD and verifies that the dir
obtained by removing the last two components is the same as that
provided by realpath("../.." . If $PWD is not set, or the path based on
it is not correct, it falls back to the current behaviour -- the path
returned by realpath("../.." .
Getcwd doesn't give the desired behaviour since, like realpath, it
returns the physical directory.
-Ed
More information about the freebsd-hackers
mailing list