Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Oct 2004 20:56:16 +0300
From:      Andriy Gapon <avg@icyb.net.ua>
To:        freebsd-emulation@freebsd.org
Subject:   linux emulation: cd / 
Message-ID:  <4176A6C0.5070408@icyb.net.ua>

next in thread | raw e-mail | index | archive | help

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4176A6C0.5070408>