parent
73e2e10e1c
commit
e727e901ee
@ -1 +0,0 @@
|
||||
12
|
@ -0,0 +1,115 @@
|
||||
From 7e79e591eb536603da92ee537bf949490b1259fc Mon Sep 17 00:00:00 2001
|
||||
From: Tsu Jan <tsujan2000@gmail.com>
|
||||
Date: Sun, 21 Apr 2019 14:11:14 +0430
|
||||
Subject: [PATCH] Don't ignore creation-deletion sequences
|
||||
|
||||
Fixes https://github.com/lxqt/pcmanfm-qt/issues/944
|
||||
|
||||
Previously, if a file was in addition queue and then it came into the deletion
|
||||
queue, its addition and deletion were both ignored. That was wrong and could
|
||||
result in showing nonexistent files because addition can also happen in
|
||||
directory list job before being processed by file info job.
|
||||
|
||||
Also process accumulated changes only after finishing the current info job and
|
||||
don't clear all deletion paths after processing them (because, logically, only
|
||||
those paths that can be deleted should be removed).
|
||||
---
|
||||
src/core/folder.cpp | 60 +++++++++++++++++++++++----------------------
|
||||
1 file changed, 31 insertions(+), 29 deletions(-)
|
||||
|
||||
diff --git a/src/core/folder.cpp b/src/core/folder.cpp
|
||||
index 6c2b27d..2385a8b 100644
|
||||
--- a/src/core/folder.cpp
|
||||
+++ b/src/core/folder.cpp
|
||||
@@ -228,16 +228,6 @@ void Folder::onFileInfoFinished() {
|
||||
return;
|
||||
}
|
||||
|
||||
- // process the changes accumulated during this info job
|
||||
- if(filesystem_info_pending // means a pending change; see "onFileSystemInfoFinished()"
|
||||
- || !paths_to_update.empty() || !paths_to_add.empty() || !paths_to_del.empty()) {
|
||||
- QTimer::singleShot(0, this, &Folder::processPendingChanges);
|
||||
- }
|
||||
- // there's no pending change at the moment; let the next one be processed
|
||||
- else {
|
||||
- has_idle_update_handler = false;
|
||||
- }
|
||||
-
|
||||
FileInfoList files_to_add;
|
||||
FileInfoList files_to_delete;
|
||||
std::vector<FileInfoPair> files_to_update;
|
||||
@@ -271,6 +261,16 @@ void Folder::onFileInfoFinished() {
|
||||
Q_EMIT filesChanged(files_to_update);
|
||||
}
|
||||
Q_EMIT contentChanged();
|
||||
+
|
||||
+ // process the changes accumulated during this info job
|
||||
+ if(filesystem_info_pending // means a pending change; see "onFileSystemInfoFinished()"
|
||||
+ || !paths_to_update.empty() || !paths_to_add.empty() || !paths_to_del.empty()) {
|
||||
+ QTimer::singleShot(0, this, &Folder::processPendingChanges);
|
||||
+ }
|
||||
+ // there's no pending change at the moment; let the next one be processed
|
||||
+ else {
|
||||
+ has_idle_update_handler = false;
|
||||
+ }
|
||||
}
|
||||
|
||||
void Folder::processPendingChanges() {
|
||||
@@ -314,21 +314,24 @@ void Folder::processPendingChanges() {
|
||||
}
|
||||
|
||||
// process deletion
|
||||
- if(!paths_to_del.empty()) {
|
||||
- FileInfoList deleted_files;
|
||||
- for(const auto &path: paths_to_del) {
|
||||
- auto name = path.baseName();
|
||||
- auto it = files_.find(name.get());
|
||||
- if(it != files_.end()) {
|
||||
- deleted_files.push_back(it->second);
|
||||
- files_.erase(it);
|
||||
- }
|
||||
+ FileInfoList deleted_files;
|
||||
+ auto path_it = paths_to_del.begin();
|
||||
+ while(path_it != paths_to_del.end()) {
|
||||
+ const auto& path = *path_it;
|
||||
+ auto name = path.baseName();
|
||||
+ auto it = files_.find(name.get());
|
||||
+ if(it != files_.end()) {
|
||||
+ deleted_files.push_back(it->second);
|
||||
+ files_.erase(it);
|
||||
+ path_it = paths_to_del.erase(path_it);
|
||||
}
|
||||
- if(!deleted_files.empty()) {
|
||||
- Q_EMIT filesRemoved(deleted_files);
|
||||
- Q_EMIT contentChanged();
|
||||
+ else {
|
||||
+ ++path_it;
|
||||
}
|
||||
- paths_to_del.clear();
|
||||
+ }
|
||||
+ if(!deleted_files.empty()) {
|
||||
+ Q_EMIT filesRemoved(deleted_files);
|
||||
+ Q_EMIT contentChanged();
|
||||
}
|
||||
|
||||
if(pending_change_notify) {
|
||||
@@ -404,13 +407,12 @@ void Folder::eventFileDeleted(const FilePath& path) {
|
||||
bool deleted = true;
|
||||
// qDebug() << "delete " << path.baseName().get();
|
||||
// G_LOCK(lists);
|
||||
- if(std::find(paths_to_add.cbegin(), paths_to_add.cend(), path) != paths_to_add.cend()) {
|
||||
- // if the file was going to be added, just remove it from the addition queue
|
||||
- paths_to_add.erase(std::remove(paths_to_add.begin(), paths_to_add.end(), path), paths_to_add.cend());
|
||||
- }
|
||||
- else if(std::find(paths_to_del.cbegin(), paths_to_del.cend(), path) == paths_to_del.cend()) {
|
||||
+ /* WARNING: If the file is in the addition queue, we shouldn not remove it from that queue
|
||||
+ and ignore its deletion because it may have been added by the directory list job, in
|
||||
+ which case, ignoring an addition-deletion sequence would result in a nonexistent file. */
|
||||
+ if(std::find(paths_to_del.cbegin(), paths_to_del.cend(), path) == paths_to_del.cend()) {
|
||||
paths_to_del.push_back(path);
|
||||
- // the update queue should be cancelled for a file that is going to be deleted
|
||||
+ // the update queue can be cancelled for a file that is going to be deleted
|
||||
paths_to_update.erase(std::remove(paths_to_update.begin(), paths_to_update.end(), path), paths_to_update.cend());
|
||||
}
|
||||
else {
|
||||
|
@ -0,0 +1,97 @@
|
||||
From 3d23ec7f0857cbc1ae8e42bdd27ab179a7e8344f Mon Sep 17 00:00:00 2001
|
||||
From: "Hong Jen Yee (PCMan)" <pcman.tw@gmail.com>
|
||||
Date: Fri, 19 Apr 2019 01:19:08 +0800
|
||||
Subject: [PATCH] Fix the license header of code we took from libfm (they
|
||||
should use LGPL2 instead of GPL2). - src/core/vfs/vfs-menu.c -
|
||||
src/core/vfs/vfs-search.c These files are taken from libfm which has been
|
||||
relicensed to LGPL 2 on 2014-09-05 by Andrey N. Gritsenko after consulting
|
||||
other contributors.
|
||||
|
||||
---
|
||||
src/core/vfs/vfs-menu.c | 21 ++++++++++-----------
|
||||
src/core/vfs/vfs-search.c | 37 +++++++++++++++++--------------------
|
||||
2 files changed, 27 insertions(+), 31 deletions(-)
|
||||
|
||||
diff --git a/src/core/vfs/vfs-menu.c b/src/core/vfs/vfs-menu.c
|
||||
index c541159..069b1bc 100644
|
||||
--- a/src/core/vfs/vfs-menu.c
|
||||
+++ b/src/core/vfs/vfs-menu.c
|
||||
@@ -4,20 +4,19 @@
|
||||
*
|
||||
* Copyright 2012-2014 Andriy Grytsenko (LStranger) <andrej@rep.kiev.ua>
|
||||
*
|
||||
- * This program is free software; you can redistribute it and/or modify
|
||||
- * it under the terms of the GNU General Public License as published by
|
||||
- * the Free Software Foundation; either version 2 of the License, or
|
||||
- * (at your option) any later version.
|
||||
+ * This library is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU Lesser General Public
|
||||
+ * License as published by the Free Software Foundation; either
|
||||
+ * version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
- * This program is distributed in the hope that it will be useful,
|
||||
+ * This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
- * GNU General Public License for more details.
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+ * Lesser General Public License for more details.
|
||||
*
|
||||
- * You should have received a copy of the GNU General Public License
|
||||
- * along with this program; if not, write to the Free Software
|
||||
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
- * MA 02110-1301, USA.
|
||||
+ * You should have received a copy of the GNU Lesser General Public
|
||||
+ * License along with this library; if not, write to the Free Software
|
||||
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
diff --git a/src/core/vfs/vfs-search.c b/src/core/vfs/vfs-search.c
|
||||
index 0a64fb6..92b932c 100644
|
||||
--- a/src/core/vfs/vfs-search.c
|
||||
+++ b/src/core/vfs/vfs-search.c
|
||||
@@ -1,25 +1,22 @@
|
||||
/*
|
||||
- * fm-vfs-search.c
|
||||
- *
|
||||
- * Copyright 2012 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
|
||||
- * Copyright 2010 Shae Smittle <starfall87@gmail.com>
|
||||
- *
|
||||
- * This program is free software; you can redistribute it and/or modify
|
||||
- * it under the terms of the GNU General Public License as published by
|
||||
- * the Free Software Foundation; either version 2 of the License, or
|
||||
- * (at your option) any later version.
|
||||
- *
|
||||
- * This program is distributed in the hope that it will be useful,
|
||||
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
- * GNU General Public License for more details.
|
||||
- *
|
||||
- * You should have received a copy of the GNU General Public License
|
||||
- * along with this program; if not, write to the Free Software
|
||||
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
- * MA 02110-1301, USA.
|
||||
- *
|
||||
+ * fm-vfs-search.c
|
||||
*
|
||||
+ * Copyright 2012 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
|
||||
+ * Copyright 2010 Shae Smittle <starfall87@gmail.com>
|
||||
+ *
|
||||
+ * This library is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU Lesser General Public
|
||||
+ * License as published by the Free Software Foundation; either
|
||||
+ * version 2.1 of the License, or (at your option) any later version.
|
||||
+ *
|
||||
+ * This library is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+ * Lesser General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU Lesser General Public
|
||||
+ * License along with this library; if not, write to the Free Software
|
||||
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
|
@ -0,0 +1,36 @@
|
||||
From 6cb5f38d2c1261b782b16da45bb323b069db94fe Mon Sep 17 00:00:00 2001
|
||||
From: Tsu Jan <tsujan2000@gmail.com>
|
||||
Date: Mon, 8 Apr 2019 07:13:09 +0430
|
||||
Subject: [PATCH] Fixed SMB recursive copy
|
||||
|
||||
Fixes https://github.com/lxqt/libfm-qt/issues/385 by trying to set dir permissions only once and ignoring possible errors (that happen with SMB and, maybe, other protocols).
|
||||
---
|
||||
src/core/filetransferjob.cpp | 9 +++++----
|
||||
1 file changed, 5 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/core/filetransferjob.cpp b/src/core/filetransferjob.cpp
|
||||
index 4039c58..6b44576 100644
|
||||
--- a/src/core/filetransferjob.cpp
|
||||
+++ b/src/core/filetransferjob.cpp
|
||||
@@ -279,16 +279,17 @@ bool FileTransferJob::makeDir(const FilePath& srcPath, GFileInfoPtr srcInfo, Fil
|
||||
mode, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
|
||||
cancellable().get(), &err);
|
||||
if(!chmod_done) {
|
||||
- ErrorAction act = emitError(err, ErrorSeverity::MODERATE);
|
||||
+ /* NOTE: Some filesystems may not support this. So, ignore errors for now. */
|
||||
+ break;
|
||||
+ /*ErrorAction act = emitError(err, ErrorSeverity::MODERATE);
|
||||
if(act != ErrorAction::RETRY) {
|
||||
break;
|
||||
- }
|
||||
- /* FIXME: some filesystems may not support this. */
|
||||
+ }*/
|
||||
}
|
||||
} while(!chmod_done && !isCancelled());
|
||||
}
|
||||
}
|
||||
- return mkdir_done && chmod_done;
|
||||
+ return mkdir_done/* && chmod_done*/;
|
||||
}
|
||||
|
||||
bool FileTransferJob::handleError(GErrorPtr &err, const FilePath &srcPath, const GFileInfoPtr &srcInfo, FilePath &destPath, int& flags) {
|
@ -1 +1,5 @@
|
||||
fix-metadata-for-trusting-executables.patch
|
||||
fix-smb-recursive-copy.patch
|
||||
fix-license-headers.patch
|
||||
dont-ignore-crea-del-sequences.patch
|
||||
workaround-glib-recursive-moving-error.patch
|
||||
|
@ -0,0 +1,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 {
|
@ -0,0 +1,7 @@
|
||||
Name: libfm-qt
|
||||
Bug-Database: https://github.com/lxqt/libfm-qt/issues
|
||||
Bug-Submit: https://github.com/lxqt/libfm-qt/issues/new
|
||||
Changelog: https://github.com/lxqt/libfm-qt/blob/master/CHANGELOG
|
||||
Repository: https://github.com/lxqt/libfm-qt
|
||||
Repository-Browser: https://github.com/lxqt/libfm-qt
|
||||
|
Loading…
Reference in new issue