9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* bind vs pwd
@ 1994-11-16 22:47 Philip
  0 siblings, 0 replies; 5+ messages in thread
From: Philip @ 1994-11-16 22:47 UTC (permalink / raw)


>Given bind -c /usr/$user/tmp /tmp
>if I cd to /usr/$user/tmp and then cd .., pwd says that I'm now in /.
>I expected to be in /usr/$user.  Is that how it's supposed to work,
>or am I all confused about something?

bind is not like ln -s.  The bind command shown above makes /tmp into
a union directory, containing the union of the previous contents of /tmp
(probably nothing in this case), and the contents of /usr/$user/tmp.
In addition, the -c flag specifies that files created in /tmp should
*really* be created in /usr/$user/tmp.  This is critical here as /tmp
is unwritable previous to this.

However, /tmp is still /tmp.  It's contents are really somewhere else,
but as far as the shell is concerned, nothing has happened.  The kernel
may catch readdir() a lie a little, but cd is unaffected.

I think you may be able to "trick" it with something like:

	bind -c /usr/tor/tmp /tmp
	mkdir /tmp/foo
	cd /tmp/foo
	cd ..

I think that will leave you in /usr/tor, as the cd takes you to
/usr/tor/tmp/foo.  At least that's what it appears to me...

Philip Guenther

guenther@stolaf.edu (Philip Guenther) St Olaf College, Northfield, MN 55057
(defun sig-hook () (insert-disclaimer 'my-opinion-only 'powerless-student))
"To go outside the mythos is to become insane..." -Robert Pirsig







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

* bind vs pwd
@ 1994-11-17 19:35 Scott
  0 siblings, 0 replies; 5+ messages in thread
From: Scott @ 1994-11-17 19:35 UTC (permalink / raw)


Phil writes:
| pwd may give either answer.  there is no way of remembering how you
| got somewhere because the mount table is stored by a hash. So '..'
| searches through the table and gives you the first answer.

I was caught by this when I tried to tar up my home directory and my
bin and tmp both sent tar rampaging through the filesystem.  This is
even trickier than symbolic links.  






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

* bind vs pwd
@ 1994-11-17  2:05 philw
  0 siblings, 0 replies; 5+ messages in thread
From: philw @ 1994-11-17  2:05 UTC (permalink / raw)


>From:	Philip Guenther <stolaf.edu!guenther>
>Sender: cse.psu.edu!owner-plan9-fans
>Precedence: bulk
>Reply-To: cse.psu.edu!plan9-fans
>
>>Given bind -c /usr/$user/tmp /tmp
>>if I cd to /usr/$user/tmp and then cd .., pwd says that I'm now in /.
>>I expected to be in /usr/$user.  Is that how it's supposed to work,
>>or am I all confused about something?
>
>bind is not like ln -s.  The bind command shown above makes /tmp into
>a union directory, containing the union of the previous contents of /tmp
>(probably nothing in this case), and the contents of /usr/$user/tmp.
>In addition, the -c flag specifies that files created in /tmp should
>*really* be created in /usr/$user/tmp.  This is critical here as /tmp
>is unwritable previous to this.
This is incorrect. The bind command is specified
as MREPL with no options. There is no union directory.
/usr/$user/tmp replaces /tmp.






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

* bind vs pwd
@ 1994-11-17  1:21 philw
  0 siblings, 0 replies; 5+ messages in thread
From: philw @ 1994-11-17  1:21 UTC (permalink / raw)


pwd may give either answer.
there is no way of remembering how
you got somewhere because the mount
table is stored by a hash. So '..'
searches through the table and gives
you the first answer.






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

* bind vs pwd
@ 1994-11-16 22:02 Scott
  0 siblings, 0 replies; 5+ messages in thread
From: Scott @ 1994-11-16 22:02 UTC (permalink / raw)


Given bind -c /usr/$user/tmp /tmp
if I cd to /usr/$user/tmp and then cd .., pwd says that I'm now in /.
I expected to be in /usr/$user.  Is that how it's supposed to work,
or am I all confused about something?

-- Scott






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

end of thread, other threads:[~1994-11-17 19:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1994-11-16 22:47 bind vs pwd Philip
  -- strict thread matches above, loose matches on Subject: below --
1994-11-17 19:35 Scott
1994-11-17  2:05 philw
1994-11-17  1:21 philw
1994-11-16 22:02 Scott

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