9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] replica under 9vx
@ 2009-10-04  6:08 ron minnich
  0 siblings, 0 replies; 11+ messages in thread
From: ron minnich @ 2009-10-04  6:08 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

I'm having an issue with replica on 9vx. I keep getting files like this:

d---------    2 tc       staff        4096 Oct  4 05:38 bibtex/
d---------    2 tc       staff        4096 Oct  4 05:38 bin/

strace shows this:

13293 mkdir("/mnt/sdb1/tc/plan9/9vx-0.12/sys/lib/texmf/bibtex/bst", 0)
= -1 EACCES (Permission denied)

Which looks like a bad idea.

I'm going to look into devfs-posix but wanted to mention this in case
anyone has seen it too.

thanks

ron



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

* Re: [9fans] replica under 9vx
       [not found] <<13426df10910042341k73b0de26u6c7f3f1992549c9c@mail.gmail.com>
@ 2009-10-05 13:56 ` erik quanstrom
  0 siblings, 0 replies; 11+ messages in thread
From: erik quanstrom @ 2009-10-05 13:56 UTC (permalink / raw)
  To: 9fans

> > if (perm&0400 == 0) then do a mkdir with 0400, an open, and an fchmod. Tomorrow,
> > that is. I think the work-around is pretty easy.
> > I figure the 0400 might work because mode has to be OREAD at this point anyway.
>
> This is the only way to do it, since as I earlier pointed out, perm is
> 0 ... sheesh!

i believe you ment
	if((perm&0400) == 0)

- erik



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

* Re: [9fans] replica under 9vx
  2009-10-05  6:39             ` ron minnich
@ 2009-10-05  6:41               ` ron minnich
  0 siblings, 0 replies; 11+ messages in thread
From: ron minnich @ 2009-10-05  6:41 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Should have gone to bed before writing the last note.

On Sun, Oct 4, 2009 at 11:39 PM, ron minnich <rminnich@gmail.com> wrote:

> if (perm&0400 == 0) then do a mkdir with 0400, an open, and an fchmod. Tomorrow,
> that is. I think the work-around is pretty easy.
> I figure the 0400 might work because mode has to be OREAD at this point anyway.

This is the only way to do it, since as I earlier pointed out, perm is
0 ... sheesh!

Good night all :-)

ron



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

* Re: [9fans] replica under 9vx
  2009-10-05  4:42           ` ron minnich
@ 2009-10-05  6:39             ` ron minnich
  2009-10-05  6:41               ` ron minnich
  0 siblings, 1 reply; 11+ messages in thread
From: ron minnich @ 2009-10-05  6:39 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

OK, it's an incompatibility between Posix world and Plan 9 world. It's
because mkdir doesn't open the directory, and
create on Plan 9 does.

Here is what I think is the relevant code from applylog.


			if(rd.mode&DMDIR){
				fd = create(local, OREAD, DMDIR); <========= creates d--------- --
but it's open.
				if(fd < 0 && isdir(local))
					fd = open(local, OREAD);
				if(fd  < 0){
					error("mkdir %q: %r", name);
					skip = 1;
					continue;
				}

This sequence works fine on Plan 9.

In devfs-posix.c we have this:

                if(mkdir(path, perm & 0777) < 0)
                        oserror();
                if((fd = open(path, 0)) < 0)
                        oserror();

Which fails very badly on linux if perm is 0, as it is from replica.

This works on Plan 9 because create is one operation, even for
directories. Chalk it up to another Posix botch. I can't recall how
many times this one has bitten me.

I can special-case the code in devfs-posix.c:

if (perm&0400 == 0) then do a mkdir, an open, and an fchmod. Tomorrow,
that is. I think the work-around is pretty easy.
I figure the 0400 might work because mode has to be OREAD at this point anyway.

or, simpler: take this code:
                // Be like Plan 9 file servers: inherit mode bits
                // and group from parent.
                fchmod(fd, perm & st.st_mode & 0777);

which happens AFTER the mkdir, and instead compute the perms first and
do the mkdir with those perms.

Russ, any reason to make the d--------- perm directory and then change
it with the fchmod later? Can we just do the mkdir with the final
permissions? Or is this d--------- guarding against some race
condition in the linux vfs?

ron



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

* Re: [9fans] replica under 9vx
  2009-10-05  0:55         ` Fernan Bolando
@ 2009-10-05  4:42           ` ron minnich
  2009-10-05  6:39             ` ron minnich
  0 siblings, 1 reply; 11+ messages in thread
From: ron minnich @ 2009-10-05  4:42 UTC (permalink / raw)
  To: fernanbolando, Fans of the OS Plan 9 from Bell Labs

seems to be a bug in replica on 9vx? I'll look more tomorrow.

mkdir /sys/lib/texmf perm -20000000000
mkdir /sys/lib/texmf/bibtex perm -20000000000
mkdir /sys/lib/texmf/bibtex/bst perm -20000000000
mkdir /sys/lib/texmf/bibtex/bst/base perm -20000000000
mkdir /sys/lib/texmf/bibtex/bst/base/abbrv.bst perm 0
mkdir /sys/lib/texmf/bibtex/bst/base/acm.bst perm 0
mkdir /sys/lib/texmf/bibtex/bst/base/alpha.bst perm 0
mkdir /sys/lib/texmf/bibtex/bst/base/apalike.bst perm 0
mkdir /sys/lib/texmf/bibtex/bst/base/ieeetr.bst perm 0
mkdir /sys/lib/texmf/bibtex/bst/base/plain.bst perm 0
mkdir /sys/lib/texmf/bibtex/bst/base/siam.bst perm 0
mkdir /sys/lib/texmf/bibtex/bst/base/unsrt.bst perm 0
mkdir /sys/lib/texmf/bibtex/bst/ams perm -20000000000

directories are created with permissions of 0. Then a mkdir follows
and it's a bad day. The proto has more reasonable values :-)

ron



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

* Re: [9fans] replica under 9vx
  2009-10-04 21:15       ` ron minnich
@ 2009-10-05  0:55         ` Fernan Bolando
  2009-10-05  4:42           ` ron minnich
  0 siblings, 1 reply; 11+ messages in thread
From: Fernan Bolando @ 2009-10-05  0:55 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Mon, Oct 5, 2009 at 5:15 AM, ron minnich <rminnich@gmail.com> wrote:
> On Sun, Oct 4, 2009 at 10:20 AM, Steve Simon <steve@quintile.net> wrote:
>>> I don't see this explaining a
>>> mkdir with mode of 0 however.
>>
>> Does the file/dir actually have a mode of zero on the source machine?
>
> no, it has mode 755
>
> This is for the tex install but the problem exists in general when
> using applylog on 9vx. I just don't see why yet.
>
> Gonna rebuild 9vx with some debug prints ...
>

I remember getting the same problem, when I installed tex on 9vx. I
thought my installation was bad, so I manually changed permission
which got tex installed.

just incase it is related I also had problems running ape/psh which is
due to permission failure.
rebuilding ape fixed that problem as indicated in the thread

http://9fans.net/narchive/2008/09/206

fernan




--
http://www.fernski.com



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

* Re: [9fans] replica under 9vx
  2009-10-04 17:20     ` Steve Simon
@ 2009-10-04 21:15       ` ron minnich
  2009-10-05  0:55         ` Fernan Bolando
  0 siblings, 1 reply; 11+ messages in thread
From: ron minnich @ 2009-10-04 21:15 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Sun, Oct 4, 2009 at 10:20 AM, Steve Simon <steve@quintile.net> wrote:
>> I don't see this explaining a
>> mkdir with mode of 0 however.
>
> Does the file/dir actually have a mode of zero on the source machine?

no, it has mode 755

This is for the tex install but the problem exists in general when
using applylog on 9vx. I just don't see why yet.

Gonna rebuild 9vx with some debug prints ...

ron



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

* Re: [9fans] replica under 9vx
       [not found] <<f7c633ef2aae073a6ed65cf21142b5b2@quintile.net>
@ 2009-10-04 17:25 ` erik quanstrom
  0 siblings, 0 replies; 11+ messages in thread
From: erik quanstrom @ 2009-10-04 17:25 UTC (permalink / raw)
  To: 9fans

> Plan9 can happily create an object with mode zero but a posix
> emulation of wstat() must do the rename()/chmod()/chown()/chgrp()
> etc in a fixed order which is bound to make some combinations
> mutually exclusive.

i'd be willing to bet that posix doesn't guarentee anything
even with the contortions.

- erik



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

* Re: [9fans] replica under 9vx
  2009-10-04 16:30   ` ron minnich
@ 2009-10-04 17:20     ` Steve Simon
  2009-10-04 21:15       ` ron minnich
  0 siblings, 1 reply; 11+ messages in thread
From: Steve Simon @ 2009-10-04 17:20 UTC (permalink / raw)
  To: 9fans

> I don't see this explaining a
> mkdir with mode of 0 however.

Does the file/dir actually have a mode of zero on the source machine?

Plan9 can happily create an object with mode zero but a posix
emulation of wstat() must do the rename()/chmod()/chown()/chgrp()
etc in a fixed order which is bound to make some combinations
mutually exclusive.

-Steve



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

* Re: [9fans] replica under 9vx
  2009-10-04 15:22 ` erik quanstrom
@ 2009-10-04 16:30   ` ron minnich
  2009-10-04 17:20     ` Steve Simon
  0 siblings, 1 reply; 11+ messages in thread
From: ron minnich @ 2009-10-04 16:30 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Sun, Oct 4, 2009 at 8:22 AM, erik quanstrom <quanstro@quanstro.net> wrote:
>> 13293 mkdir("/mnt/sdb1/tc/plan9/9vx-0.12/sys/lib/texmf/bibtex/bst", 0)
>> = -1 EACCES (Permission denied)
>>
>
> perhaps replica is expecting specific error messages
> and they're not getting translated
>
> ; cd /n/sources/plan9/`{pwd}
> ; g strstr
> applylog.c:161:         if(strstr(buf, "entry not found") || strstr(buf, "not exist"))
> applylog.c:1036:                if(strstr(err, "permission") == nil)
> updatedb.c:107:         p = strstr(msg, ": ");
> updatedb.c:123:                 if(cistrstr(p, "hungup") || cistrstr(p, "Hangup")
> updatedb.c:124:                 || cistrstr(p, "rpc error")
> updatedb.c:125:                 || cistrstr(p, "shut down")
> updatedb.c:126:                 || cistrstr(p, "i/o")
> updatedb.c:127:                 || cistrstr(p, "connection"))

Even if this is not it, you raise a possible issue: for things like
devfs-posix.c we may need to map error strings as in the previous
patch for oserror(). I just looked for strcmp in the kernel ... OK,
good point, I'll look at this later. I don't see this explaining a
mkdir with mode of 0 however.

ron



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

* Re: [9fans] replica under 9vx
       [not found] <<13426df10910032308j1c9aac90k51dd2400db23f79f@mail.gmail.com>
@ 2009-10-04 15:22 ` erik quanstrom
  2009-10-04 16:30   ` ron minnich
  0 siblings, 1 reply; 11+ messages in thread
From: erik quanstrom @ 2009-10-04 15:22 UTC (permalink / raw)
  To: 9fans

> 13293 mkdir("/mnt/sdb1/tc/plan9/9vx-0.12/sys/lib/texmf/bibtex/bst", 0)
> = -1 EACCES (Permission denied)
>

perhaps replica is expecting specific error messages
and they're not getting translated

; cd /n/sources/plan9/`{pwd}
; g strstr
applylog.c:161: 	if(strstr(buf, "entry not found") || strstr(buf, "not exist"))
applylog.c:1036: 		if(strstr(err, "permission") == nil)
updatedb.c:107: 	p = strstr(msg, ": ");
updatedb.c:123: 		if(cistrstr(p, "hungup") || cistrstr(p, "Hangup")
updatedb.c:124: 		|| cistrstr(p, "rpc error")
updatedb.c:125: 		|| cistrstr(p, "shut down")
updatedb.c:126: 		|| cistrstr(p, "i/o")
updatedb.c:127: 		|| cistrstr(p, "connection"))

- erik



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

end of thread, other threads:[~2009-10-05 13:56 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-04  6:08 [9fans] replica under 9vx ron minnich
     [not found] <<13426df10910032308j1c9aac90k51dd2400db23f79f@mail.gmail.com>
2009-10-04 15:22 ` erik quanstrom
2009-10-04 16:30   ` ron minnich
2009-10-04 17:20     ` Steve Simon
2009-10-04 21:15       ` ron minnich
2009-10-05  0:55         ` Fernan Bolando
2009-10-05  4:42           ` ron minnich
2009-10-05  6:39             ` ron minnich
2009-10-05  6:41               ` ron minnich
     [not found] <<f7c633ef2aae073a6ed65cf21142b5b2@quintile.net>
2009-10-04 17:25 ` erik quanstrom
     [not found] <<13426df10910042341k73b0de26u6c7f3f1992549c9c@mail.gmail.com>
2009-10-05 13:56 ` erik quanstrom

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).