From 891da648e30658c94248a589acf3021ab43ae406 Mon Sep 17 00:00:00 2001 From: raj-prince Date: Wed, 27 Aug 2025 12:26:25 +0000 Subject: [PATCH 1/2] fix: false success in unmount flow --- unmount_linux.go | 1 + unmount_linux_test.go | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/unmount_linux.go b/unmount_linux.go index 6fabb35e..cdb06fbe 100644 --- a/unmount_linux.go +++ b/unmount_linux.go @@ -13,6 +13,7 @@ func unmount(dir string) error { if strings.HasPrefix(dir, "/dev/fd/") { return fmt.Errorf("%w: %s", ErrExternallyManagedMountPoint, err) } + return err } return nil } diff --git a/unmount_linux_test.go b/unmount_linux_test.go index 4c357ee7..d58349df 100644 --- a/unmount_linux_test.go +++ b/unmount_linux_test.go @@ -18,7 +18,7 @@ func Test_umountNoCustomError(t *testing.T) { t.Setenv("PATH", "") // Clear PATH to fail unmount with fusermount is not found err := unmount("/dev") - if err != nil && errors.Is(err, ErrExternallyManagedMountPoint) { - t.Errorf("Not expected custom error.") + if err == nil || errors.Is(err, ErrExternallyManagedMountPoint) { + t.Errorf("Expected error but not the custom error.") } } From 365a48506bcd05af22c6a29d3d94cc6103721743 Mon Sep 17 00:00:00 2001 From: raj-prince Date: Thu, 28 Aug 2025 23:55:06 +0000 Subject: [PATCH 2/2] review comments. --- unmount_linux_test.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/unmount_linux_test.go b/unmount_linux_test.go index d58349df..f2023226 100644 --- a/unmount_linux_test.go +++ b/unmount_linux_test.go @@ -18,7 +18,10 @@ func Test_umountNoCustomError(t *testing.T) { t.Setenv("PATH", "") // Clear PATH to fail unmount with fusermount is not found err := unmount("/dev") - if err == nil || errors.Is(err, ErrExternallyManagedMountPoint) { - t.Errorf("Expected error but not the custom error.") + if err == nil { + t.Fatal("Expected error but got none.") + } + if errors.Is(err, ErrExternallyManagedMountPoint) { + t.Error("Custom error was not expected.") } }