9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* Re: [9fans] remedial sources auth, connect, and mount in plan9port
       [not found] <<d50d7d460910010834r40c926barbc3dedd5828f3bd1@mail.gmail.com>
@ 2009-10-01 16:22 ` erik quanstrom
  2009-10-02  3:03   ` Jason Catena
  0 siblings, 1 reply; 11+ messages in thread
From: erik quanstrom @ 2009-10-01 16:22 UTC (permalink / raw)
  To: 9fans

> Every time I do so, either with touch or  chmod for example, I get
> errors like this:
>
> Oct  1 08:52:39.288 read bad packet from 5

add some debugging to 9pserve.c around 'read bad packet'.
i'm gonna guess (since i don't have time to get p9p auth
working) that this test has failed src/lib9/convM2S.c:216,217

- erik



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9fans] remedial sources auth, connect, and mount in plan9port
  2009-10-01 16:22 ` [9fans] remedial sources auth, connect, and mount in plan9port erik quanstrom
@ 2009-10-02  3:03   ` Jason Catena
  0 siblings, 0 replies; 11+ messages in thread
From: Jason Catena @ 2009-10-02  3:03 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Thu, Oct 1, 2009 at 11:22, erik quanstrom <quanstro@quanstro.net> wrote:
>> Every time I do so, either with touch or  chmod for example, I get
>> errors like this:
>>
>> Oct  1 08:52:39.288 read bad packet from 5
>
> add some debugging to 9pserve.c around 'read bad packet'.
> i'm gonna guess (since i don't have time to get p9p auth
> working) that this test has failed src/lib9/convM2S.c:216,217
>
> - erik

I instrumented the code as you suggested.

/usr/local/plan9/src/cmd/9pserve.c:
Msg*
mread9p(Ioproc *io, int fd, int dotu)
{
	int n, nn;
	uchar *pkt;
	Msg *m;

	if((pkt = read9ppkt(io, fd)) == nil)
		return nil;

	m = msgnew(0);
	m->tpkt = pkt;
	n = GBIT32(pkt);
	nn = convM2Su(pkt, n, &m->tx, dotu);
	if(nn != n){
		fprint(2, "%T read bad packet from %d\n", fd);
		fprint(2, "n=%d nn=%d\n", n, nn);
		return nil;
	}
	return m;
}

/usr/local/plan9/src/lib9/convM2S.c:
uint
convM2Su(uchar *ap, uint nap, Fcall *f, int dotu)
{
/* snip */
	case Twstat:
		if(p+BIT32SZ+BIT16SZ > ep)
			return 0;
		f->fid = GBIT32(p);
		p += BIT32SZ;
		f->nstat = GBIT16(p);
		p += BIT16SZ;
		if(p+f->nstat > ep) {
			fprint(2, "erik is the man! p(%x)+f->nstat(%x) > ep(%x)", p, f->nstat, ep);
			return 0;
		}
		f->stat = p;
		p += f->nstat;
		break;
/* snip */
}

My test case tries to copy a file over top of one that already exists.
 In this case, the bug decided to flit right by the check at
convM2S.c:216,217.

jdc@jdc-desktop:~$ 9 factotum
jdc@jdc-desktop:~$ srv -a sources.cs.bell-labs.com

!adding key: role=client proto=p9sk1 dom=outside.plan9.bell-labs.com
user[jdc]: catenate
password:
!
jdc@jdc-desktop:~$ sudo 9mount -i
'unix!/tmp/ns.jdc.192.168.1.101:0/sources.cs.bell-labs.com' /n/sources
[sudo] password for jdc:
9mount: mount: Not a directory
jdc@jdc-desktop:~$ ls /n/sources
/n/sources
jdc@jdc-desktop:~$ sudo 9umount /n/sources
jdc@jdc-desktop:~$ sudo 9mount -i
'unix!/tmp/ns.jdc.192.168.1.101:0/sources.cs.bell-labs.com' /n/sources
jdc@jdc-desktop:~$ ps ax|grep 9ps
10426 pts/3    Sl     0:00 9pserve -u unix!/tmp/ns.jdc.192.168.1.101:0/factotum
10586 pts/3    Sl     0:00 9pserve -u -M 8192 -A  0
unix!/tmp/ns.jdc.192.168.1.101:0/sources.cs.bell-labs.com
10603 pts/3    R+     0:00 grep 9ps
jdc@jdc-desktop:~$ cd /n/sources/contrib/catenate
jdc@jdc-desktop:/n/sources/contrib/catenate$ cd times
jdc@jdc-desktop:/n/sources/contrib/catenate/times$ ls
latin1.7a.font
jdc@jdc-desktop:/n/sources/contrib/catenate/times$ ls ~/contrib
acme  guide  latin1.7a.font
jdc@jdc-desktop:/n/sources/contrib/catenate/times$ sudo cp
/home/jdc/contrib/latin1.7a.font .
Oct  1 21:52:45.219 read bad packet from 6
n=62 nn=0
cp: cannot create regular file `./latin1.7a.font': Connection reset by peer

Jason Catena



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9fans] remedial sources auth, connect, and mount in plan9port
  2009-10-02  3:11 ` erik quanstrom
@ 2009-10-02 16:52   ` Jason Catena
  0 siblings, 0 replies; 11+ messages in thread
From: Jason Catena @ 2009-10-02 16:52 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Instrumented each return from convM2S.c.

jdc@jdc-desktop:/n/sources/contrib/catenate/times$ sudo cp
/home/jdc/contrib/latin1.7a.font .
ap(9cd1a0) + size(b) == p(9cd1ab)
ap(9d0510) + size(52) == p(9d0562)
ap(9d04e0) + size(21) == p(9d0501)
ap(9d02a0) + size(16) == p(9d02b6)
ap(9d02a0) + size(b) == p(9d02ab)
ap(9d0550) + size(5b) == p(9d05ab)
ap(9d02a0) + size(b) == p(9d02ab)
ap(9d0550) + size(5b) == p(9d05ab)
ap(9d02a0) + size(b) == p(9d02ab)
ap(9d04c0) + size(7) == p(9d04c7)
ap(9d04e0) + size(21) == p(9d0501)
ap(9cd1a0) + size(16) == p(9cd1b6)
ap(9cd1a0) + size(b) == p(9cd1ab)
ap(9d0570) + size(5b) == p(9d05cb)
last return
Oct  2 11:47:38.617 read bad packet from 5
n=62 nn=0
ap(9cd7d0) + size(7) == p(9cd7d7)
ap(9cd7d0) + size(7) == p(9cd7d7)
ap(9cd7d0) + size(7) == p(9cd7d7)
ap(9cd7d0) + size(7) == p(9cd7d7)
ap(9cd7d0) + size(7) == p(9cd7d7)
cp: cannot create regular file `./latin1.7a.font': Connection reset by peer

Jason Catena


On Thu, Oct 1, 2009 at 22:11, erik quanstrom <quanstro@quanstro.net> wrote:
>> My test case tries to copy a file over top of one that already exists.
>>  In this case, the bug decided to flit right by the check at
>> convM2S.c:216,217.
>
> i thought the original problem was trying to change
> modes or permissions on a file.  that's why i guessed
> the problem message would be a Rwstat.  perhaps i
> gave the wrong line numbers?  in any event, you're
> doing writes with your current example, so you
> may wish to instrument all the cases in M2S that
> return 0.
>
> - erik
>
>



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9fans] remedial sources auth, connect, and mount in plan9port
       [not found] <<d50d7d460910012003h6aec0d3bj40ebdadac3358b6a@mail.gmail.com>
@ 2009-10-02  3:11 ` erik quanstrom
  2009-10-02 16:52   ` Jason Catena
  0 siblings, 1 reply; 11+ messages in thread
From: erik quanstrom @ 2009-10-02  3:11 UTC (permalink / raw)
  To: 9fans

> My test case tries to copy a file over top of one that already exists.
>  In this case, the bug decided to flit right by the check at
> convM2S.c:216,217.

i thought the original problem was trying to change
modes or permissions on a file.  that's why i guessed
the problem message would be a Rwstat.  perhaps i
gave the wrong line numbers?  in any event, you're
doing writes with your current example, so you
may wish to instrument all the cases in M2S that
return 0.

- erik



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9fans] remedial sources auth, connect, and mount in plan9port
  2009-10-01 10:31       ` sqweek
  2009-10-01 12:38         ` Abhishek Kulkarni
@ 2009-10-01 15:34         ` Jason Catena
  1 sibling, 0 replies; 11+ messages in thread
From: Jason Catena @ 2009-10-01 15:34 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Thu, Oct 1, 2009 at 05:31, sqweek <sqweek@gmail.com> wrote:
> 2009/10/1 Ethan Grammatikidis <eekee57@fastmail.fm>:
>> On Thu, 1 Oct 2009 04:50:40 -0500
>> Jason Catena <jason.catena@gmail.com> wrote:
>>> $ ls -lad
>>> drwxrwxr-x 1 4294967294 4294967294 0 2009-09-30 23:11 .
>>
>> You have numbers for user and group names there.  Un*x likes the
>> numbers, but plan 9 wants strings.
>
>  Yeah, I suspect at this point the linux kernel is denying the
> operation based on its idea of permissions. there's a v9fs mount
> option you might try... I forget what it is exactly but 9mount -i does
> it :)
>  Try:
>
> 9mount -i 'unix!/tmp/ns.jdc.192.168.1.101:0/sources.cs.bell-labs.com' /n/sources

This does mount, and let me write into my directory, thanks!

Every time I do so, either with touch or  chmod for example, I get
errors like this:

Oct  1 08:52:39.288 read bad packet from 5

I can 9umount and then 9mount again for my next write operation as root.

Oddly enough, cp does not throw the error.  I can cp fine, then touch
gives me this

$ sudo touch that
[sudo] password for jdc:
Oct  1 10:20:25.502 read bad packet from 6
$ ls
ls: cannot open directory .: Input/output error

I unmount and remount and then I can cp again.

$ cd -
/home/jdc
$ sudo 9umount /n/sources
[sudo] password for jdc:
$ sudo 9mount -i
'unix!/tmp/ns.jdc.192.168.1.101:0/sources.cs.bell-labs.com' /n/sources
$ cd -
/n/sources/contrib/catenate
$ sudo cp /home/jdc/contrib/latin1.7a.font .
$ ls
lsguide  latin1.7a.font  that  this

So all the files get there, it's just annoying to have to
unmount/remount, and to have everything owned by root.

$ ls -la
total 2
-rw-r--r-- 1 root root  62 2009-10-01 08:59 guide
-rw-r--r-- 1 root root 577 2009-10-01 10:21 latin1.7a.font
-rw-r--r-- 1 root root   0 2009-10-01 10:20 that
-rw-r--r-- 1 root root   0 2009-10-01 08:49 this

> -sqweek

I also tried Abhishek's command also, but still got "permission denied".

Thanks everyone for your help.

Jason Catena



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9fans] remedial sources auth, connect, and mount in plan9port
  2009-10-01 10:31       ` sqweek
@ 2009-10-01 12:38         ` Abhishek Kulkarni
  2009-10-01 15:34         ` Jason Catena
  1 sibling, 0 replies; 11+ messages in thread
From: Abhishek Kulkarni @ 2009-10-01 12:38 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

>  Yeah, I suspect at this point the linux kernel is denying the
> operation based on its idea of permissions. there's a v9fs mount
> option you might try... I forget what it is exactly

srv(4) has an example on how to do an authenticated
mount of sources, which needs an update BTW. The
command to mount using  v9fs should now look like:

mount -t 9p -o user=$USER,uid=`id -u`,gid=`id -g`,trans=unix
`namespace`/sources.cs.bell-labs.com /n/sources

> but 9mount -i does
> it :)
>  Try:
>
> 9mount -i 'unix!/tmp/ns.jdc.192.168.1.101:0/sources.cs.bell-labs.com' /n/sources
>
> -sqweek
>
>



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9fans] remedial sources auth, connect, and mount in plan9port
  2009-10-01 10:04     ` Ethan Grammatikidis
@ 2009-10-01 10:31       ` sqweek
  2009-10-01 12:38         ` Abhishek Kulkarni
  2009-10-01 15:34         ` Jason Catena
  0 siblings, 2 replies; 11+ messages in thread
From: sqweek @ 2009-10-01 10:31 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

2009/10/1 Ethan Grammatikidis <eekee57@fastmail.fm>:
> On Thu, 1 Oct 2009 04:50:40 -0500
> Jason Catena <jason.catena@gmail.com> wrote:
> $ touch this
> touch: cannot touch `this': Hammer Time!

 Fixed.

>> $ ls -lad
>> drwxrwxr-x 1 4294967294 4294967294 0 2009-09-30 23:11 .
>
> You have numbers for user and group names there.  Un*x likes the
> numbers, but plan 9 wants strings.

 Yeah, I suspect at this point the linux kernel is denying the
operation based on its idea of permissions. there's a v9fs mount
option you might try... I forget what it is exactly but 9mount -i does
it :)
 Try:

9mount -i 'unix!/tmp/ns.jdc.192.168.1.101:0/sources.cs.bell-labs.com' /n/sources

-sqweek



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9fans] remedial sources auth, connect, and mount in plan9port
  2009-10-01  9:50   ` Jason Catena
@ 2009-10-01 10:04     ` Ethan Grammatikidis
  2009-10-01 10:31       ` sqweek
  0 siblings, 1 reply; 11+ messages in thread
From: Ethan Grammatikidis @ 2009-10-01 10:04 UTC (permalink / raw)
  To: 9fans

On Thu, 1 Oct 2009 04:50:40 -0500
Jason Catena <jason.catena@gmail.com> wrote:

> $ ls -lad
> drwxrwxr-x 1 4294967294 4294967294 0 2009-09-30 23:11 .

You have numbers for user and group names there.  Un*x likes the
numbers, but plan 9 wants strings.  Maybe when you write your system
is sending those numeric IDs because it hasn't got anything to
translate them to.  I'm just guessing, but based on a little
experience with drawterm I'd at least find out if there's more work
needed to get the right names to the remote system.


--
Ethan Grammatikidis

Those who are slower at parsing information must
necessarily be faster at problem-solving.



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9fans] remedial sources auth, connect, and mount in plan9port
  2009-10-01  7:44 ` Venkatesh Srinivas
@ 2009-10-01  9:50   ` Jason Catena
  2009-10-01 10:04     ` Ethan Grammatikidis
  0 siblings, 1 reply; 11+ messages in thread
From: Jason Catena @ 2009-10-01  9:50 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Thank you very much, Venkatesh.  All the commands work (don't fail) as
you gave them.  I still get the same permission-denied error I got
before.  I can see it, but am not allowed to write to it.

$ 9 factotum
$ srv -a sources.cs.bell-labs.com

!adding key: role=client proto=p9sk1 dom=outside.plan9.bell-labs.com
user[jdc]: catenate
password:
!
$ sudo mount -t 9p
/tmp/ns.jdc.192.168.1.101\:0/sources.cs.bell-labs.com /n/sources -o
trans=unix
[sudo] password for jdc:
$ cd /n/sources/contrib/catenate
$ ls -lad
drwxrwxr-x 1 4294967294 4294967294 0 2009-09-30 23:11 .
$ touch this
touch: cannot touch `this': Permission denied
$ ls `namespace`
acme  factotum  plumb  sources.cs.bell-labs.com

Jason Catena


On Thu, Oct 1, 2009 at 02:44, Venkatesh Srinivas <me@acm.jhu.edu> wrote:
> Hi,
>
> In order to construct an authenticated mount of sources, you will need
> to start factotum, use srv -a to create an auth-ed connection to the
> server and to "post" it, and to mount the "posted" connection.
>
> (assuming you have a working plan9port install and are on a unix):
> $ 9 factotum
> (start factotum in the current 'namespace'. p9p's current namespace is
> the value of the NAMESPACE environmental variable).
>
> $ srv -a sources.cs.bell-labs.com
> (I am prompted for my userid and password on the server)
> user[venkatesh]: <my sources username>
>
> [mount step; I use v9fs.You will have to adapt if you're using 9pfuse or 9mount]
> $ sudo mount -t 9p $NAMESPACE/sources.cs.bell-labs.com <mountpath> -o trans=unix
>
> Good luck,
> -- vs
>
>



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9fans] remedial sources auth, connect, and mount in plan9port
  2009-10-01  5:06 Jason Catena
@ 2009-10-01  7:44 ` Venkatesh Srinivas
  2009-10-01  9:50   ` Jason Catena
  0 siblings, 1 reply; 11+ messages in thread
From: Venkatesh Srinivas @ 2009-10-01  7:44 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Hi,

In order to construct an authenticated mount of sources, you will need
to start factotum, use srv -a to create an auth-ed connection to the
server and to "post" it, and to mount the "posted" connection.

(assuming you have a working plan9port install and are on a unix):
$ 9 factotum
(start factotum in the current 'namespace'. p9p's current namespace is
the value of the NAMESPACE environmental variable).

$ srv -a sources.cs.bell-labs.com
(I am prompted for my userid and password on the server)
user[venkatesh]: <my sources username>

[mount step; I use v9fs.You will have to adapt if you're using 9pfuse or 9mount]
$ sudo mount -t 9p $NAMESPACE/sources.cs.bell-labs.com <mountpath> -o trans=unix

Good luck,
-- vs



^ permalink raw reply	[flat|nested] 11+ messages in thread

* [9fans] remedial sources auth, connect, and mount in plan9port
@ 2009-10-01  5:06 Jason Catena
  2009-10-01  7:44 ` Venkatesh Srinivas
  0 siblings, 1 reply; 11+ messages in thread
From: Jason Catena @ 2009-10-01  5:06 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Geoff was kind enough to provide to me a contrib directory on sources,
so I'm now trying to write into it.

I can't seem to get the hang of the authorization, connection, and
mount steps necessary for an authorized mount of sources in plan9port,
so I can just copy files into my contrib directory.  Over several
dozen attempts to understand factotum, it never saves any actual data
for me, so I apparently have some serious misunderstandings.

For the mount, I can use the following to mount sources read-only, but
I can't save anything into it.
sudo 9mount 'tcp!sources.cs.bell-labs.com' /n/sources

9fs sources also doesn't seem to provide an authenticated connection,
or a mount.

Would someone be kind enough to chant the few magic plan9(port)
incantations with which I can store my sources-server username and
password with factotum, connect to sources, and mount sources
(specifically, my directory) as a writable filesystem?   I promise
diligent study, to understand what the commands do.

Jason Catena



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2009-10-02 16:52 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <<d50d7d460910010834r40c926barbc3dedd5828f3bd1@mail.gmail.com>
2009-10-01 16:22 ` [9fans] remedial sources auth, connect, and mount in plan9port erik quanstrom
2009-10-02  3:03   ` Jason Catena
     [not found] <<d50d7d460910012003h6aec0d3bj40ebdadac3358b6a@mail.gmail.com>
2009-10-02  3:11 ` erik quanstrom
2009-10-02 16:52   ` Jason Catena
2009-10-01  5:06 Jason Catena
2009-10-01  7:44 ` Venkatesh Srinivas
2009-10-01  9:50   ` Jason Catena
2009-10-01 10:04     ` Ethan Grammatikidis
2009-10-01 10:31       ` sqweek
2009-10-01 12:38         ` Abhishek Kulkarni
2009-10-01 15:34         ` Jason Catena

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).