From owner-freebsd-hackers@FreeBSD.ORG Sun Dec 23 22:25:08 2007 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E5AA016A418; Sun, 23 Dec 2007 22:25:08 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (meestal-mk5.stack.nl [IPv6:2001:610:1108:5010::149]) by mx1.freebsd.org (Postfix) with ESMTP id A2D4113C465; Sun, 23 Dec 2007 22:25:08 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mx1.stack.nl (Postfix) with ESMTP id E40D944C2B; Sun, 23 Dec 2007 23:25:06 +0100 (CET) Received: by snail.stack.nl (Postfix, from userid 1677) id CD79322899; Sun, 23 Dec 2007 23:25:06 +0100 (CET) Date: Sun, 23 Dec 2007 23:25:06 +0100 From: Jilles Tjoelker To: Dag-Erling =?iso-8859-1?Q?Sm=F8rgrav?= Message-ID: <20071223222506.GA64207@stack.nl> References: <20071219222621.GA79432@sandvine.com> <86ejddg354.fsf@ds4.des.no> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <86ejddg354.fsf@ds4.des.no> X-Operating-System: FreeBSD 6.2-STABLE i386 User-Agent: Mutt/1.5.17 (2007-11-01) Cc: freebsd-hackers@freebsd.org, Ed Maste Subject: Re: config(8) patch for review for src dir handling X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Dec 2007 22:25:09 -0000 On Sun, Dec 23, 2007 at 10:40:39AM +0100, Dag-Erling Smørgrav wrote: > Ed Maste 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")? getcwd() does not use $PWD, it returns a pathname without symlinks. So that would lead to the original behaviour. A better way could be to use $PWD if it is set and an absolute logical pathname referring to the current directory, as in src/bin/pwd/pwd.c . -- Jilles Tjoelker