Subject: Re: portal filesystem
To: Andrew Brown <atatat@atatdot.net>
From: Simon Burge <simonb@netbsd.org>
List: current-users
Date: 05/22/2000 15:07:32
Andrew Brown wrote:

> presupposing that i have a kernwl with portal stuff in it, if i do
> this:
> 
>    # pwd
>    /root
>    # cat > cvs.conf << EOF
>    netbsd/		rfilter	netbsd/	/root/cvs.sh %s
>    EOF
>    # cat > cvs.sh << EOF
>    #!/bin/sh
>    set -- `echo $1 | sed 's/\(.*\),\([\.0-9]*\)/\1 \2/'`
>    file=$1
>    if [ ! -z "$2" ]; then rev="-r $2"; fi
>    export CVSROOT=":pserver:anoncvs@anoncvs.netbsd.org:/cvsroot"
>    cvs co -p $rev $file
>    EOF
>    # mount -t portal /root/cvs.conf /p
> 
> why does this work as expected:
> 
>    # cat /p/netbsd/basesrc/etc/rc.d/LOGIN | diff - /etc/rc.d/LOGIN
> 
> while this does not?
> 
>    # diff /p/netbsd/basesrc/etc/rc.d/LOGIN /etc/rc.d/LOGIN

At a guess, I'd say it's because diff is trying to lseek() on the portal
"file" and the lseek fails...  If the portal "file" appears as a regular
file, I'd expect something like

	main(int argc, char **argv)
	{
		char buf[100];
		int fd;

		fd = open(argv[1], 0);
		read(fd, buf, sizeof(buf));
		if (lseek(fd, 0, 0) != 0)
			perror("lseek");
	}

when run as "foo /p/netbsd/basesrc/etc/rc.d/LOGIN" to return an error.

Simon.