From owner-freebsd-current@FreeBSD.ORG Fri Oct 22 10:06:33 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 952C516A4CE; Fri, 22 Oct 2004 10:06:33 +0000 (GMT) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5CE1243D46; Fri, 22 Oct 2004 10:06:31 +0000 (GMT) (envelope-from avg@icyb.net.ua) Received: from [212.40.38.87] (oddity.topspin.kiev.ua [212.40.38.87]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id NAA28031; Fri, 22 Oct 2004 13:06:24 +0300 (EEST) (envelope-from avg@icyb.net.ua) Message-ID: <4178DBA0.8050605@icyb.net.ua> Date: Fri, 22 Oct 2004 13:06:24 +0300 From: Andriy Gapon User-Agent: Mozilla Thunderbird 0.8 (X11/20041019) X-Accept-Language: en-us, en MIME-Version: 1.0 To: freebsd-questions@freebsd.org, freebsd-current@freebsd.org Content-Type: text/plain; charset=KOI8-U Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Fri, 22 Oct 2004 11:56:47 +0000 Subject: 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 10:06:33 -0000 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. -- Andriy Gapon