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.


Ignore-AOSP-First: "Landing internal first for critical ap4a move"
Bug: 369548825
Test: manual
Flag: EXEMPT bugfix
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:c3cd8e3f3c93773f0051608b94a0358554a95c98)
Merged-In: I35f65725b70fc0abb22aff46298d053d98d03b00
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 {