Package: libfm-qt / 0.14.1-9

workaround-glib-recursive-moving-error.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
From 476dded99de11a57c64103b4610f0de3dbdbc769 Mon Sep 17 00:00:00 2001
From: Tsu Jan <tsujan2000@gmail.com>
Date: Mon, 22 Apr 2019 00:07:07 +0430
Subject: [PATCH] Workaround for GLib's recursive moving error, e.g. with bound
 mounts

`g_file_move()` may not work recursively on the same filesystem, especially
with bound mounts (to `/mnt`, for example) and give the `G_IO_ERROR_WOULD_RECURSE`
error. This patch ignores the error and tries our `FileTransferJob::copyFile()`.

Closes https://github.com/lxqt/pcmanfm-qt/issues/943
---
 src/core/filetransferjob.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/core/filetransferjob.cpp b/src/core/filetransferjob.cpp
index c3d5851..32f0f89 100644
--- a/src/core/filetransferjob.cpp
+++ b/src/core/filetransferjob.cpp
@@ -83,6 +83,13 @@ bool FileTransferJob::moveFileSameFs(const FilePath& srcPath, const GFileInfoPtr
         // do the file operation
         if(!g_file_move(srcPath.gfile().get(), destPath.gfile().get(), GFileCopyFlags(flags), cancellable().get(),
                        nullptr, this, &err)) {
+            // Specially with mounts bound to /mnt, g_file_move() may give the recursive error
+            // and fail, in which case, we ignore the error and try copying and deleting.
+            if(err.code() == G_IO_ERROR_WOULD_RECURSE) {
+              if(auto parent = destPath.parent()) {
+                  return copyFile(srcPath, srcInfo, parent, destPath.baseName().get());
+              }
+            }
             retry = handleError(err, srcPath, srcInfo, destPath, flags);
         }
         else {