|
@@ -7,6 +7,7 @@
|
|
package fs
|
|
package fs
|
|
|
|
|
|
import (
|
|
import (
|
|
|
|
+ "errors"
|
|
"fmt"
|
|
"fmt"
|
|
osexec "os/exec"
|
|
osexec "os/exec"
|
|
"path/filepath"
|
|
"path/filepath"
|
|
@@ -105,8 +106,16 @@ func testWalkInfiniteRecursion(t *testing.T, fsType FilesystemType, uri string)
|
|
}
|
|
}
|
|
dirjunctCnt := 0
|
|
dirjunctCnt := 0
|
|
fooCnt := 0
|
|
fooCnt := 0
|
|
|
|
+ found := false
|
|
if err := fs.Walk("towalk", func(path string, info FileInfo, err error) error {
|
|
if err := fs.Walk("towalk", func(path string, info FileInfo, err error) error {
|
|
if err != nil {
|
|
if err != nil {
|
|
|
|
+ if errors.Is(err, ErrInfiniteRecursion) {
|
|
|
|
+ if found {
|
|
|
|
+ t.Fatal("second infinite recursion detected at", path)
|
|
|
|
+ }
|
|
|
|
+ found = true
|
|
|
|
+ return nil
|
|
|
|
+ }
|
|
t.Fatal(err)
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
if info.Name() == "dirjunct" {
|
|
if info.Name() == "dirjunct" {
|
|
@@ -118,7 +127,7 @@ func testWalkInfiniteRecursion(t *testing.T, fsType FilesystemType, uri string)
|
|
}); err != nil {
|
|
}); err != nil {
|
|
t.Fatal(err)
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
- if dirjunctCnt != 2 || fooCnt != 1 {
|
|
|
|
|
|
+ if dirjunctCnt != 2 || fooCnt != 1 || !found {
|
|
t.Fatal("Infinite recursion not detected correctly")
|
|
t.Fatal("Infinite recursion not detected correctly")
|
|
}
|
|
}
|
|
}
|
|
}
|