From owner-freebsd-current@FreeBSD.ORG Fri Oct 22 11:18:54 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9E68816A4CE; Fri, 22 Oct 2004 11:18:54 +0000 (GMT) Received: from gwdu60.gwdg.de (gwdu60.gwdg.de [134.76.8.60]) by mx1.FreeBSD.org (Postfix) with ESMTP id AA9E343D2F; Fri, 22 Oct 2004 11:18:53 +0000 (GMT) (envelope-from kheuer2@gwdg.de) Received: from gwdu60.gwdg.de (localhost [127.0.0.1]) by gwdu60.gwdg.de (8.12.11/8.12.8) with ESMTP id i9MBIqMu058556; Fri, 22 Oct 2004 13:18:52 +0200 (CEST) (envelope-from kheuer2@gwdg.de) Received: from localhost (kheuer2@localhost)i9MBIpNn058553; Fri, 22 Oct 2004 13:18:52 +0200 (CEST) X-Authentication-Warning: gwdu60.gwdg.de: kheuer2 owned process doing -bs Date: Fri, 22 Oct 2004 13:18:51 +0200 (CEST) From: Konrad Heuer To: Andriy Gapon In-Reply-To: <4178DBA0.8050605@icyb.net.ua> Message-ID: <20041022131342.W95775@gwdu60.gwdg.de> References: <4178DBA0.8050605@icyb.net.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Mailman-Approved-At: Fri, 22 Oct 2004 11:56:47 +0000 cc: freebsd-current@freebsd.org cc: freebsd-questions@freebsd.org Subject: Re: linux emulation: "/ " resolves to real root dir; why ? 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, 22 Oct 2004 11:18:54 -0000 On Fri, 22 Oct 2004, Andriy Gapon wrote: > Under Linux emulation "/" resolves to real root directory, not > /compat/linux directory and I am very curious why this is so. > > I see that in linux_emul_convpath() there is a special check for this > case with the following comment: > > /* > * We now compare the vnode of the linux_root to the one > * vnode asked. If they resolve to be the same, then we > * ignore the match so that the real root gets used. > * This avoids the problem of traversing "../.." to find the > * root directory and never finding it, because "/" resolves > * to the emulation root directory. This is expensive :-( > */ > > > Because of such behavior "mkdir -p" (in linux base 7) is broken in cases > where more than one path components needs to be created - mkdir first > chdir()s to / and then iteratively mkdir()s and chdir()s to subdirectories. > > My rationale for throwing out that check is that no linux program should > ever need to access real root directory, and in case of a user using an > interactive linux shell he should be smart enough to break out of > /compat/linux (very easy). > > I have already posted this question to freebsd-emulation list, but got > no responses so far. Linux binaries often need to access files outside the emulation directory tree, just think of data files in the user's homes when running applications like acroread, linux-mozilla, staroffice etc. So you absolutely need to break out. Regards Konrad Heuer GWDG, Am Fassberg, 37077 Goettingen, Germany, kheuer2@gwdg.de