Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tsc/internal/fswatch/fanotify_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ func (b *fanotifyBackend) markDir(w *dirWatch, path string, markPath string) err
}

func maybeWrapUnsupportedFilesystem(err error) error {
if errors.Is(err, unix.EOPNOTSUPP) || errors.Is(err, unix.ENOTSUP) || errors.Is(err, unix.ENODEV) {
if errors.Is(err, unix.EOPNOTSUPP) || errors.Is(err, unix.ENOTSUP) || errors.Is(err, unix.ENODEV) || errors.Is(err, unix.EXDEV) {
return fmt.Errorf("%w: %w", err, ErrFilesystemUnsupported)
}
return err
Expand Down
16 changes: 9 additions & 7 deletions tsc/internal/fswatch/fanotify_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,15 @@ func TestLinuxFanotifyMaybeWrapUnsupportedFilesystem(t *testing.T) {
// Errnos that indicate the filesystem cannot support fanotify FID-based
// watching are tagged with ErrFilesystemUnsupported so higher layers can
// fall back to inotify (issue #63646).
for _, errno := range []error{unix.EOPNOTSUPP, unix.ENODEV} {
wrapped := maybeWrapUnsupportedFilesystem(fmt.Errorf("name_to_handle_at: %w", errno))
if !errors.Is(wrapped, ErrFilesystemUnsupported) {
t.Errorf("expected %v to be tagged ErrFilesystemUnsupported", errno)
}
if !errors.Is(wrapped, errno) {
t.Errorf("expected wrapped error to still unwrap to %v", errno)
for _, errno := range []error{unix.EOPNOTSUPP, unix.ENODEV, unix.EXDEV} {
for _, err := range []error{errno, fmt.Errorf("name_to_handle_at: %w", errno)} {
wrapped := maybeWrapUnsupportedFilesystem(err)
if !errors.Is(wrapped, ErrFilesystemUnsupported) {
t.Errorf("expected %v to be tagged ErrFilesystemUnsupported", err)
}
if !errors.Is(wrapped, errno) {
t.Errorf("expected wrapped error to still unwrap to %v", errno)
}
}
}

Expand Down
Loading