]> source.dussan.org Git - gitea.git/commitdiff
Retry rename on lock induced failures (re-fix) (#16461) (#16463)
authorzeripath <art27@cantab.net>
Fri, 16 Jul 2021 16:48:39 +0000 (17:48 +0100)
committerGitHub <noreply@github.com>
Fri, 16 Jul 2021 16:48:39 +0000 (17:48 +0100)
Backport #16461

Unfortunately #16435 asserts the wrong error and should use
os.LinkError not os.PathError.

Fix #16439

Signed-off-by: Andrew Thornton <art27@cantab.net>
modules/util/remove.go

index 23104365256fc6f45e9fc98ed42e775c560ad671..754f3b7c1174db06fa07a48292a4807e7de04973 100644 (file)
@@ -64,7 +64,7 @@ func Rename(oldpath, newpath string) error {
                if err == nil {
                        break
                }
-               unwrapped := err.(*os.PathError).Err
+               unwrapped := err.(*os.LinkError).Err
                if unwrapped == syscall.EBUSY || unwrapped == syscall.ENOTEMPTY || unwrapped == syscall.EPERM || unwrapped == syscall.EMFILE || unwrapped == syscall.ENFILE {
                        // try again
                        <-time.After(100 * time.Millisecond)