With an empty base dir and the default deduplicatePath, abs calls itself with the same input:
osfs.New("", osfs.WithBoundOS()).Stat("/tmp")
// fatal error: stack overflow
In os_bound.go abs:
dup := filepath.Join(fs.baseDir, fs.baseDir[len(vol):]) // "" when baseDir == ""
if strings.HasPrefix(path, dup+string(filepath.Separator)) { // HasPrefix(path, "/") -> true
return fs.abs(path[len(dup):]) // fs.abs(path) -> same input
}
Reproduced on v5.8.0 and v5.9.0, darwin/arm64.
Happy to send a PR. Guarding the dedup block with fs.baseDir != "" (or dup != "") fixes it.
With an empty base dir and the default
deduplicatePath,abscalls itself with the same input:In
os_bound.goabs:Reproduced on v5.8.0 and v5.9.0, darwin/arm64.
Happy to send a PR. Guarding the dedup block with
fs.baseDir != ""(ordup != "") fixes it.