commit 4bcb21630154545503ad5ae693d567ed289cf068
parent d3de47eaee8cb7d47e1ffb680def68c90318d5be
Author: Matsuda Kenji <info@mtkn.jp>
Date: Wed, 29 Nov 2023 09:54:59 +0900
add comment about rename
Diffstat:
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/server.go b/server.go
@@ -836,7 +836,6 @@ func sWStat(ctx context.Context, s *Server, r *Req) {
return
}
if wstat.Name != "" && newStat.Name != wstat.Name {
- log.Printf("wstat: %q, %q", newStat.Name, wstat.Name)
parentPath := path.Dir(r.Fid.path)
parent, err := s.fs.OpenFile(parentPath, OREAD)
if err != nil {
@@ -847,6 +846,12 @@ func sWStat(ctx context.Context, s *Server, r *Req) {
Respond(ctx, r, ErrPerm)
return
}
+ // TODO: I think 9P protocol prohibits renaming to existent file.
+ // Wstat(9P) in p9p says:
+ // it is an error to change the name to that of
+ // an existing file.
+ // but 9pfs, 9pfuse does the rename when used with `git init`.
+ /*
children, err := getChildren(s.fs, parentPath)
if err != nil {
Respond(ctx, r, fmt.Errorf("get children: %v", err))
@@ -863,6 +868,7 @@ func sWStat(ctx context.Context, s *Server, r *Req) {
return
}
}
+ */
newStat.Name = wstat.Name
}
if wstat.Length != ^int64(0) && wstat.Length != newStat.Length {