From c8376646536a253c61b1c0dbc65cf5da0632f76d Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Sat, 11 Jan 2025 12:49:40 +0000 Subject: [PATCH] sync: fix cpu spinning when empty directory finding with leading slashes Before this change the logic which makes sure we create all directories could get confused with directories which started with slashes and get into an infinite loop consuming 100% of the CPU. --- fs/sync/sync.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/sync/sync.go b/fs/sync/sync.go index e0a3e23ac..7feedfcd7 100644 --- a/fs/sync/sync.go +++ b/fs/sync/sync.go @@ -726,7 +726,7 @@ func (s *syncCopyMove) markParentNotEmpty(entry fs.DirEntry) { parentDir = "" } delete(s.srcEmptyDirs, parentDir) - if parentDir == "" { + if parentDir == "" || parentDir == "/" { break } parentDir = path.Dir(parentDir)