Subject: Re: patch to fix mount_nfs(8) problem with relative mount point
To: George Abdelmalik <gabdelmalik@avdat.com.au>
From: Eric Haszlakiewicz <erh@NetBSD.org>
List: netbsd-users
Date: 01/28/2005 20:02:29
On Fri, Jan 28, 2005 at 02:12:06PM +0100, Peter Postma wrote:
> On Sat, Jan 29, 2005 at 04:57:24AM +1100, George Abdelmalik wrote:
> > From those who are interested, I've produced a patch for a problem in 
> > mount_nfs(8) which arises when specify a relative path for the mount point.
> > 
> > I'm running 2-0-RELEASE, and have also verified this with a recent -current, 
> > but have only tested the patch on 2-0.
> > 
> > See attached file mount_nfs.c.diff, this patch was created against HEAD.
> > 
> > If somebody what to bring the patch into the source tree that fine with me.
> > 
> > An example that illustrates the problem is presented as follows.
>
> I think this is very reasonable to do, and by using realpath(3) it also
> fixes the trailing slash problem which has few PRs (3205, 25156, 28644).
> 
> But I think it's better to change all mount utils at once, instead
> only mount_nfs. PR 3617 (from Eric Haszlakiewicz) seems to have to most
> complete patches, but they're rather old.
> 
> Eric, will you take a look at this? (the PR is set to your responsibility :)

	It actually _is_ possible to unmount that relative path:
umount -R mnt
	Using realpath helps avoid needing the -R flag a bit, but it's still
needed since you can mount stuff within a chroot to create a mount point
that has a different path outside of the chroot.

	Note that the generic mount command _does_ do the realpath thing,
so "mount -t nfs ..." should work as expected.  However, given the number
of times people keep running into this problem that's clearly not enough.
I'll take a look later this weekend and see if I can knock the code into
shape.

eric