From owner-freebsd-current@FreeBSD.ORG Fri May 7 03:53:56 2004 Return-Path: Delivered-To: freebsd-current@www.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 969B216A4CE for ; Fri, 7 May 2004 03:53:56 -0700 (PDT) Received: from hexagon.stack.nl (hexagon.stack.nl [131.155.140.144]) by mx1.FreeBSD.org (Postfix) with ESMTP id BB51043D3F for ; Fri, 7 May 2004 03:53:55 -0700 (PDT) (envelope-from marcolz@stack.nl) Received: from hammer.stack.nl (hammer.stack.nl [IPv6:2001:610:1108:5010::153]) by hexagon.stack.nl (Postfix) with ESMTP id C91B351E8; Fri, 7 May 2004 12:53:54 +0200 (CEST) Received: by hammer.stack.nl (Postfix, from userid 333) id 7511F6484; Fri, 7 May 2004 12:53:55 +0200 (CEST) Date: Fri, 7 May 2004 12:53:55 +0200 From: Marc Olzheim To: Tim Robbins Message-ID: <20040507105355.GA93808@stack.nl> References: <20040507092235.GA61837@stack.nl> <20040507100119.GA15782@cat.robbins.dropbear.id.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040507100119.GA15782@cat.robbins.dropbear.id.au> X-Operating-System: FreeBSD hammer.stack.nl 5.2-CURRENT FreeBSD 5.2-CURRENT X-URL: http://www.stack.nl/~marcolz/ User-Agent: Mutt/1.5.6i cc: Marc Olzheim cc: Bruce M Simpson cc: Poul-Henning Kamp cc: freebsd-current@www.freebsd.org Subject: Re: Unified getcwd() implementation X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2004 10:53:56 -0000 On Fri, May 07, 2004 at 08:01:19PM +1000, Tim Robbins wrote: > > Hi, > > > > (Re: http://lists.freebsd.org/pipermail/freebsd-arch/2003-August/001152.html) > > > > > Yes, it's quite an old patch, and much has happened since it was written. > > > > Mostly some fine-grained locking was introduced. > > > > I hope I got everything covered. Here Bruce's patch reworked, that works > > for me. (even over NFS ;-)) > > > > Anyone care to share their view on it ? > > Why is this necessary? Emulation of the Linux getcwd() syscall belongs > in the Linux emulator. There is also some fairly blatantly plagiarised code > in this patch. Because getcwd() is a function that might or might not return EACCESS in the current implementation, depending on whether the current path is in the cache or not. If in /a/b/c/ directory b is unreadable for a user, /a/b/c is returned by getcwd() as long as it is in the cache (kernel), if not, the libc getcwd tries to resolve it, but fails. Besides from the inconsistency (see standards/44425) it breaks linux-targeted software that expects getcwd() to always return something valid. (see bin/22291 kern/39331 kern/55993 kern/30527) And yes, this is blatantly plagiarised, since most of the code came straight from compat/linux/linux_getcwd(). Why reinvent the wheel... Marc