9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] bind -c[ab] -- what am I doing wrong?
@ 2003-07-17 16:13 andrey mirtchovski
  2003-07-17 17:42 ` northern snowfall
  0 siblings, 1 reply; 18+ messages in thread
From: andrey mirtchovski @ 2003-07-17 16:13 UTC (permalink / raw)
  To: 9fans

It is my understanding that a bind() should be "commutative" with respect to
before/after, i.e.:

	bind -cb new old <==> bind -ca old new

why does the following create fail?

	plan9% bind -cb $home/kern/cmd /sys/src/cmd
	plan9% touch /sys/src/cmd/blah		# expected to succeed
	plan9% ls -l $home/kern/cmd/blah
	--rw-rw-r-- M 159 andrey andrey 0 Jul 17 10:06 /usr/andrey/kern/cmd/blah
	plan9% unmount /sys/src/cmd
	plan9% rm $home/kern/cmd/blah
	plan9% bind -ca /sys/src/cmd $home/kern/cmd
	plan9% touch $home/kern/cmd/blah	# expected to succeed
	touch: /usr/andrey/kern/cmd/blah: cannot create: permission denied
	plan9% touch /sys/src/cmd/blah		# expected to fail
	touch: /sys/src/cmd/blah: cannot create: permission denied
	plan9%

who's to blame?



^ permalink raw reply	[flat|nested] 18+ messages in thread
* Re: [9fans] bind -c[ab] -- what am I doing wrong?
@ 2003-07-17 17:30 Richard C Bilson
  0 siblings, 0 replies; 18+ messages in thread
From: Richard C Bilson @ 2003-07-17 17:30 UTC (permalink / raw)
  To: 9fans

> From: andrey mirtchovski <mirtchov@cpsc.ucalgary.ca>
>
> given the man page i expect 'bind -ac new /something/i/can/write/to' to
> allow me to continue to write to '/something/i/can/write/to'.

Here's my guess.  To quote bind(1):

	When a new file is created in a union directory, it is placed
	in the first element of the union that has been bound or
	mounted with the -c flag. If that directory does not have write
	permission, the create fails.

In your example, you're creating a new union directory by binding "new"
with the -c flag.  The union has two directories, and only "new" has
been bound with -c.  If you don't have write permission to "new", the
create will fail.

One might expect some other result in the case where the second
argument is not already a union directory, but then again one might
expect the current behavior.


^ permalink raw reply	[flat|nested] 18+ messages in thread
* Re: [9fans] bind -c[ab] -- what am I doing wrong?
@ 2003-07-17 20:09 northern snowfall
  0 siblings, 0 replies; 18+ messages in thread
From: northern snowfall @ 2003-07-17 20:09 UTC (permalink / raw)
  To: andrey mirtchovski; +Cc: 9fans, northern snowfall

>
>
>well, it doesn't. what you describe is the bahaviour of the command
>according to the  man page. but here's what I observe:
>
Yeh, and what is in the man page is what happens in usage:
but only in my examples. See, this is why I shouldn't get
to check mail until I've had my cranberry juice.

This is what really seems to happen:

The first directory bound into another forces the first
to inherit the second's creation properties. Thus, when we
bind a directory of ours onto a system file, we maintain
write access.

However, when a file that we do not have write access to
is bound into a directory we do have write access to, the
permissions inherited deny creation. This is your example,
Andrey. Though, we can easily remedy this situation by
binding a writable directory over the unwritable:
    cpu% bind -ac /sys/src/cmd try
    cpu% touch try/hello
    touch: try/hello: cannot create: access permission denied
    cpu% mkdir try2
    cpu% bind -ac try2 try
    cpu% touch try/hello
    touch: try/hello: cannot create: access permission denied
    cpu% unmount try2 try
    cpu% bind -bc try2 try
    cpu% touch try/hello
    cpu% wc -l try/unmount.c
         26 try/unmount.c
    cpu%

So the chain context persists, yet is not refinfluenced
by the preemptive bind. However, this doesn't change the
state of 'try'. Its permissions are still influenced by
the first bound directory. Our perception sees creation
is allowed, and that is all we technically care about.
Though, files are generated under the second bound
directory:
    cpu% unmount try
    cpu% ls -l try/hello
    ls: try/hello: 'try/hello' does not exist
    cpu% ls -l try2/hello
    --rw-rw-r-- M 2278 snowfall snowfall 0 Jul 17 13:49 try2/hello
    cpu%

Don

http://www.7f.no-ip.com/~north_










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

end of thread, other threads:[~2003-07-19 17:28 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-17 16:13 [9fans] bind -c[ab] -- what am I doing wrong? andrey mirtchovski
2003-07-17 17:42 ` northern snowfall
2003-07-17 17:10   ` andrey mirtchovski
2003-07-17 17:18     ` boyd, rounin
2003-07-17 17:34       ` andrey mirtchovski
2003-07-17 17:37         ` David Presotto
2003-07-17 17:45         ` boyd, rounin
2003-07-17 18:07           ` andrey mirtchovski
2003-07-17 19:29             ` [9fans] Laptop and VM software vdharani
2003-07-17 18:34               ` jmk
2003-07-18  4:21                 ` Adrian Tritschler
2003-07-18  9:07                   ` vdharani
2003-07-18  8:24                     ` Adrian Tritschler
2003-07-18 11:52                   ` C H Forsyth
2003-07-19 17:28                 ` Russ Cox
2003-07-17 17:35       ` [9fans] bind -c[ab] -- what am I doing wrong? David Presotto
2003-07-17 17:30 Richard C Bilson
2003-07-17 20:09 northern snowfall

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