-
-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
Given the conditions:
- Current working directory is not
/. (Say/tmpfor example.) - Get fs with:
fsys, _ := hackpadfs_os.NewFS().Sub("mydir")(Assume/tmp/mydir/exists.) - Call
fsys.Stat(".")
Stat fails with:
stat : no such file or directory
While debugging this, it is apparent that this is caused by fs.rootedPath assuming that the sub path is an absolute path, not a path relative to the cwd. I.e. given the example situation, it runs os.Stat("/mydir"), not os.Stat("/tmp/mydir") which is what I would expect.
The following go playground demonstrates: https://go.dev/play/p/hYuq0VNVybc
It seems Sub is not safe to use with paths relative to the cwd, and given that you can't use rooted paths (gofs.ValidPath disallows them), it is not usable in general.
Metadata
Metadata
Assignees
Labels
No labels