Subject: Re: emul vs. symlinks
To: Quentin Garnier <cube@NetBSD.org>
From: Bill Studenmund <wrstuden@netbsd.org>
List: tech-kern
Date: 07/09/2004 19:00:44
--EP0wieDxd4TSJjHq
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Fri, Jul 09, 2004 at 11:33:20PM +0200, Quentin Garnier wrote:
> Hi folks,
>=20
> 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.
>=20
> 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=20
your lookup routine enforce NOFOLLOW (i.e. clear FOLLOW) and handle=20
symlinks yourself.

Actually, since the emulation code already does the "/emul/foo/path" then=
=20
"/path" stuff, you just need to put a symlink handling wrapper outside of=
=20
that.

I really think that you don't need to add your own namei() routine. Since=
=20
you can tell namei() to not follow symlinks and the symlink following=20
isn't hard, just do it yourself.

Take care,

Bill

--EP0wieDxd4TSJjHq
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (NetBSD)

iD8DBQFA703MWz+3JHUci9cRAonOAJ0ZaSQ6sl99GLmUOU118Et04oI/eQCfZeFY
DI4A4ggS0f/inpvcasFbZ7Y=
=QYvX
-----END PGP SIGNATURE-----

--EP0wieDxd4TSJjHq--