droyo / styx

Go library for the 9P filesystem protocol
MIT License
64 stars 18 forks source link

Creating a new directory results in `bad message: slash in path element` error #35

Closed zakkor closed 2 years ago

zakkor commented 2 years ago

When a styxfile.Directory is passed as the result of a Tcreate call and the underlying object does not have a Stat method, statGuess for whatever reason does not manage to detect any underlying fs.FileInfo methods, (e.g.: Name, Mode, ...) which means that for opened directories, the results of Tstat are always an incorrectly guessed fallback value.

Furthermore, the fallback value is erroneously being set as the absolute path of the file, instead of the name of the file, which results in bad message: slash in path element errors from any subsequent Twalk (or other types) calls.

It's possible this issue manifests itself for files too, not just dirs.