Subject: Re: linux emul problem in 1.5R?
To: None <current-users@netbsd.org>
From: Jaromír Dolecek <jdolecek@netbsd.org>
List: current-users
Date: 02/02/2001 11:06:05
Following should fix the problem:


Index: compat/common/compat_util.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/syssrc/sys/compat/common/compat_util.c,v
retrieving revision 1.19
diff -u -u -r1.19 compat_util.c
--- compat/common/compat_util.c	2001/01/22 19:50:56	1.19
+++ compat/common/compat_util.c	2001/02/02 10:03:26
@@ -144,7 +144,10 @@
 		*cp =3D '/';
 		break;
 	case CHECK_ALT_FL_EXISTS:
-		NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, buf, p);
+	case CHECK_ALT_FL_SYMLINK:
+		NDINIT(&nd, LOOKUP,=09
+			(sflag =3D=3D CHECK_ALT_FL_SYMLINK) ? NOFOLLOW : FOLLOW,
+			UIO_SYSSPACE, buf, p);
=20
 		if ((error =3D namei(&nd)) !=3D 0)
 			goto bad;
@@ -174,14 +177,6 @@
 			error =3D ENOENT;
 			goto bad3;
 		}
-
-		break;
-
-	case CHECK_ALT_FL_SYMLINK:
-		NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, buf, p);
-
-		if ((error =3D namei(&nd)) !=3D 0)
-			goto bad;
=20
 		break;
 	}

Jarom=EDr Dolecek wrote:
> Ross Harvey wrote:
> > Some code was added recently that implemented a CHECK_ALT_SYMLINK() fea=
ture
> > to the common emulation code. It's probably what is responsible for your
> > failures; it certainly caused mine.
> >=20
> > I believe it interferes with programs that do things like getcwd(3), be=
cause
> > it bypasses some special logic that deals with the real root vs the emu=
lation
> > root. In any case, the problem it "fixed" was purely hypothetical ... A=
FAIK
> > there were no actual bugs reported, and although a PR is referenced in =
the
> > CVS log, I think that PR just described behavior predicted by reading t=
he
> > code itself, not a problem with any real linux application.
>=20
> No, the PR was filed after I found out FreeBSD binary ignores
> /emul/freebsd/etc/malloc.conf symlink (see malloc(3)).
>=20
> Does readlink(2) work for you in linux binary if you set the symlink as
> /emul/linux/testln -> some_nonexisting_file and do readlink("/testln", ..=
.) ?
> With 'old' code, it incorrectly returned ENOENT.
>=20
> I'll look at why the change is causing problems.
>=20
> Jaromir
> --=20
> Jaromir Dolecek <jdolecek@NetBSD.org>      http://www.ics.muni.cz/~dolece=
k/
> @@@@  Wanna a real operating system ? Go and get NetBSD, dammit!  @@@@
>=20


--=20
Jaromir Dolecek <jdolecek@NetBSD.org>      http://www.ics.muni.cz/~dolecek/
@@@@  Wanna a real operating system ? Go and get NetBSD, dammit!  @@@@