-
Notifications
You must be signed in to change notification settings - Fork 24
Description
intro(5) says
All directories must support walks to the directory .. (dot–dot) meaning parent directory, although by convention directories contain no explicit entry for .. or . (dot). The parent of the root directory of a server's tree is itself.
And walk(5) says
The name
..
(dot–dot) represents the parent directory.
...
A walk of the name..
in the root directory of a server is equivalent to a walk with no name elements.
I don't see any mention of this in diod's protocol document, but I do see it used in their tests:
https://github.com/chaos/diod/blob/9da28f911978957dbec251c653200db7a4dcad6e/tests/user/testopenfid.c#L72
Which leads me to believe the same requirement for 9P, still holds true for 9P2000.L.
However, even if File
implementations handle a dot-dot request inside their Walk
method, Server
explicitly forbids the request from being issued to the File
.
Line 1165 in 49c780c
func (t *twalk) handle(cs *connState) message { |
calls:
Line 1183 in 49c780c
qids, newRef, _, _, err := doWalk(cs, ref, t.Names, false) |
calls:
Lines 1065 to 1070 in 49c780c
for _, name := range names { | |
err = checkSafeName(name) | |
if err != nil { | |
return | |
} | |
} |
Bypassing the check for ..
seems to work as expected (tested against cmd\p9ufs
with Client
; even trying to escape the root resolves to just .
of p9ufs
's -root
argument).
for _, name := range names {
+ if name == ".." {
+ continue
+ }
err = checkSafeName(name)
if err != nil {
return
}
}
However, I'm not familiar enough with how the library tracks fid references, so I'm not sure if such a simple exception to the name rules somehow breaks reference handling in some way.
The logic around here is concerning
Line 1146 in 49c780c
walkRef.pathNode.addChild(newRef, names[i]) |
since
newRef
should actually be walkRef
's parent or walkRef
itself if walkRef
is the root; but we add newRef
as a child of walkRef
.
doWalk
currently handles the case for clones (nil names), and for steps (some string name).
But if the logic for stepping isn't also valid for backtracking (".." names), support for that may have to be added.
I'm not sure.