Subject: Re: emul vs. symlinks
To: Bill Studenmund <email@example.com>
From: Quentin Garnier <cube@NetBSD.org>
Date: 07/10/2004 11:05:25
Content-Type: text/plain; charset=US-ASCII
Le Fri, 9 Jul 2004 19:00:44 -0700
Bill Studenmund a ecrit :
> On Fri, Jul 09, 2004 at 11:33:20PM +0200, Quentin Garnier wrote:
> > Hi folks,
> > There is an issue with the way the emulation layer works with
> > symlinks. When opening a file or looking for an interpreter, the
> > emul_find() function is usually called, and its main purpose is to try
> > and find a file in the emulation root and failback on the real root if
> > it isn't found there.
> > It doesn't work well with symlinks since that part is completely
> > handled by namei(), which doesn't know, and therefore ignore, the
> > emulation root.
> I think the thing to do is either teach namei about emulations or have
> your lookup routine enforce NOFOLLOW (i.e. clear FOLLOW) and handle
> symlinks yourself.
There is the issue der Mouse pointed out, but it's not that important in
the general case.
> Actually, since the emulation code already does the "/emul/foo/path"
> then "/path" stuff, you just need to put a symlink handling wrapper
> outside of that.
No. emul_find() only looks up in the emulation root if the target exists,
and returns with the prefixed path in that case, and returns with the
non-prefixed path in the other case. That's just that.
> I really think that you don't need to add your own namei() routine.
> Since you can tell namei() to not follow symlinks and the symlink
> following isn't hard, just do it yourself.
Well, what namei() does is exactly that: call lookup() and handle
symlinks when it returns. As ugly as it might be, it's easier to start
from namei() than from scratch.
Quentin Garnier - cube@NetBSD.org
The NetBSD Project - http://www.NetBSD.org/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (NetBSD)
-----END PGP SIGNATURE-----