From owner-freebsd-emulation@FreeBSD.ORG Wed Oct 20 17:56:21 2004 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 727D416A4CF for ; Wed, 20 Oct 2004 17:56:21 +0000 (GMT) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.FreeBSD.org (Postfix) with ESMTP id AE9A143D3F for ; Wed, 20 Oct 2004 17:56:19 +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 UAA04731 for ; Wed, 20 Oct 2004 20:56:17 +0300 (EEST) (envelope-from avg@icyb.net.ua) Message-ID: <4176A6C0.5070408@icyb.net.ua> Date: Wed, 20 Oct 2004 20:56:16 +0300 From: Andriy Gapon User-Agent: Mozilla Thunderbird 0.8 (X11/20041019) X-Accept-Language: en-us, en MIME-Version: 1.0 To: freebsd-emulation@freebsd.org Content-Type: text/plain; charset=KOI8-U Content-Transfer-Encoding: 7bit Subject: linux emulation: cd / X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Oct 2004 17:56:21 -0000 This is another bug-or-feature question: doing cd / under linux emulation /linux_chdir("/")/ sets current directory to real root rather than /compat/linux. I see that this happens because of some check in linux_emul_convpath() 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 :-( */ I see where this is useful, but I think that explicit chdir to / should be exempted from such check. One reason for my opinion is that currently linux mkdir -p is broken bacause of this: try mkdir -p /foo/bar/blah1/blah2/blah3 so that /compat/linux/foo/bar exist and you can write to it, but /foo/bar doesn't exist (or exists but is not writable) and you can not create it and blah1, blah2 and blah3 do not exist. mkdir will check if /compat/linux/foo/bar/blah1/blah2 exists (it doesn't) and then will chdir to root (which will be real root) and try to create foo, chdir to foo, create bar etc - this will fail. -- Andriy Gapon