fix: detect mounts via /proc/self/mountinfo so stale FUSE works
Update PKGBUILD version / update-pkgver (push) Successful in 5s
Update PKGBUILD version / update-pkgver (push) Successful in 5s
mountinfo.Mounted lstats the path. When the sshfs link dies, every stat on the mountpoint returns EIO, so -l filtered the dead mount out, mount failed in MkdirAll, and -u failed before fusermount. Switch detection to mountinfo.GetMounts (no stat) and add a fusermount -uz fallback so a stale mount can actually be torn down.
This commit is contained in:
@@ -200,3 +200,25 @@ func TestUnmountNotMountedExistingDir(t *testing.T) {
|
||||
t.Fatalf("want not-mounted error, got %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestIsMountedAtFalseOnPlainDir(t *testing.T) {
|
||||
dir := t.TempDir()
|
||||
ok, err := is_mounted_at(dir)
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
if ok {
|
||||
t.Fatalf("plain tempdir should not be a mountpoint")
|
||||
}
|
||||
}
|
||||
|
||||
func TestIsMountedAtFalseOnMissingPath(t *testing.T) {
|
||||
dir := t.TempDir()
|
||||
ok, err := is_mounted_at(filepath.Join(dir, "nope"))
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error (no stat should happen): %v", err)
|
||||
}
|
||||
if ok {
|
||||
t.Fatalf("missing path should not be a mountpoint")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user