From owner-freebsd-hackers@FreeBSD.ORG Thu Dec 27 02:54:21 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 68E8B16A418 for ; Thu, 27 Dec 2007 02:54:21 +0000 (UTC) (envelope-from emaste@freebsd.org) Received: from gw.sandvine.com (gw.sandvine.com [199.243.201.138]) by mx1.freebsd.org (Postfix) with ESMTP id 1FB6013C459 for ; Thu, 27 Dec 2007 02:54:20 +0000 (UTC) (envelope-from emaste@freebsd.org) Received: from labgw2.phaedrus.sandvine.com ([192.168.3.11]) by gw.sandvine.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 26 Dec 2007 21:54:20 -0500 Received: by labgw2.phaedrus.sandvine.com (Postfix, from userid 12627) id 17DE611715; Wed, 26 Dec 2007 21:54:20 -0500 (EST) Date: Wed, 26 Dec 2007 21:54:19 -0500 From: Ed Maste To: Dag-Erling Sm??rgrav Message-ID: <20071227025419.GA18816@sandvine.com> References: <20071219222621.GA79432@sandvine.com> <86ejddg354.fsf@ds4.des.no> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <86ejddg354.fsf@ds4.des.no> User-Agent: Mutt/1.4.2.1i X-OriginalArrivalTime: 27 Dec 2007 02:54:20.0287 (UTC) FILETIME=[C73720F0:01C84833] Cc: freebsd-hackers@freebsd.org 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: Thu, 27 Dec 2007 02:54:21 -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")? 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