bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rm patch suggestion


From: Niels Möller
Subject: Re: rm patch suggestion
Date: 08 May 2002 08:29:21 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Marcus Brinkmann <Marcus.Brinkmann@ruhr-uni-bochum.de> writes:

> /* Same thing, but using an open file descriptor.
>    Also verifies that it is a directory and that we have search permission.  
> */
> extern int _hurd_change_directory_port_from_fd (struct hurd_port *portcell,
>                                                 int fd);
> 
> Read the second sentence in the second comment.

That explains why the code tries to lookup ".", but not why it
installs the result of that lookup, fd/"." into the CWDIR-port, rather
than using the given fd.

Throwing away the result of the lookup would make more sense to. If we
go to the trouble of doing the lookup, in order to verify "that it is
a directory and that we have search permission", it seems stupid to
use a different port than the one we subjected to the test.

In the case under discussion, where

1. a program such as rm opens the dir, fstats the fd
2. a translator is installed on the dir node
3. the program fchdirs to the fd

it seems possible that fd/"." can be looked up but not fd/"."/".".

We also have the case of the directory opened with O_NOTRANS.
In all other cases, it shouldn't matter which of the two ports fchdir
installs; they should be the same.

But now I'm confused, if I understood you correctly, you are saying
that if I open a translated dir with O_NOTRANS, then "." in the
directory refers to the same node, so that opening "." (without
O_NOTRANS) will start the translator and return a different port. It's
a little confusing if looking up "." in a directory is not a NOP. How
does this fit with the behavior of looking up "", was that truly a
NOP, and what's the difference between "." and ""?

/Niels



reply via email to

[Prev in Thread] Current Thread [Next in Thread]