Possible fix for stat error during globbing
Globs can fail when a directory is replaced with a file:
Error checking globs: stat foo: not a directory
Manually check for syscall.ENOTDIR, which is not covered by
fs.ErrNotExist.
Bug: 369548825
Test: manual
Flag: EXEMPT bugfix
Change-Id: I35f65725b70fc0abb22aff46298d053d98d03b00
diff --git a/ui/build/soong.go b/ui/build/soong.go
index eb51022..41425ac 100644
--- a/ui/build/soong.go
+++ b/ui/build/soong.go
@@ -27,6 +27,7 @@
"strings"
"sync"
"sync/atomic"
+ "syscall"
"time"
"android/soong/ui/tracer"
@@ -780,7 +781,7 @@
hasNewDep := false
for _, dep := range cachedGlob.Deps {
info, err := os.Stat(dep)
- if errors.Is(err, fs.ErrNotExist) {
+ if errors.Is(err, fs.ErrNotExist) || errors.Is(err, syscall.ENOTDIR) {
hasNewDep = true
break
} else if err != nil {