Subject: emulators/suse100_base: mtab problem under -current NetBSD/{amd64,i386}
To: pkgsrc users <pkgsrc-users@netbsd.org>
From: Nicolas Joly <njoly@pasteur.fr>
List: pkgsrc-users
Date: 10/17/2007 19:40:55
--LZvS9be/3tNcYl/X
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline


Hi,

I just discovered that applications running under compat linux
emulation on my NetBSD -current machines cannot open `/etc/mtab'
anymore ...

 23861      1 mtab32   CALL  open(0x804853c,0,0xbfbfec78)
 23861      1 mtab32   NAMI  "/emul/linux/etc/mtab"
 23861      1 mtab32   NAMI  "/etc/mtab"
 23861      1 mtab32   RET   open -1 errno -2 No such file or directory

The main problem is that `mtab' file, installed by
`emulators/suse100_base' package, is a symlink that points to
`/usr/pkg/emul/linux/proc/mounts', outside the allowed `/emul/linux'
tree.

njoly@calamity [~]> ls -l /emul/linux/etc/mtab /usr/pkg/emul/linux/proc/mounts
lrwxr-xr-x  1 root  wheel  31 Aug 15 00:15 /emul/linux/etc/mtab -> /usr/pkg/emul/linux/proc/mounts
-r--r--r--  1 root  wheel   0 Oct 17 19:37 /usr/pkg/emul/linux/proc/mounts

The attached patch fix the problem by making the symlink relative
instead of absolute; but i wonder if this is correct ?

Thanks.

-- 
Nicolas Joly

Biological Software and Databanks.
Institut Pasteur, Paris.

--LZvS9be/3tNcYl/X
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="pkgsrc-suse100mtab.diff"

Index: INSTALL
===================================================================
RCS file: /cvsroot/pkgsrc/emulators/suse100_base/INSTALL,v
retrieving revision 1.8
diff -u -p -r1.8 INSTALL
--- INSTALL	23 Aug 2007 21:50:23 -0000	1.8
+++ INSTALL	17 Oct 2007 17:09:09 -0000
@@ -142,7 +142,7 @@ POST-INSTALL)
 
 	# Make /etc/mtab usable for Linux programs.
 	${RM} -f ${EMULDIR}/etc/mtab
-	${LN} -fs ${EMULDIR}/proc/mounts ${EMULDIR}/etc/mtab
+	${LN} -fs ../proc/mounts ${EMULDIR}/etc/mtab
 
 	# Run any actions that require root privileges.
 	${TEST} ! -x ./+ROOT_ACTIONS ||

--LZvS9be/3tNcYl/X--