summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorSandy Carter2018-02-19 19:28:14 -0800
committerSandy Carter2018-02-19 19:28:14 -0800
commit81a8925401a8cb0e7fd7c0368ea959bc01427341 (patch)
treeac118ac699299bf9d4a1b66ea47d0a552ab714f4
parentdd26a2ccde7ea236a2a0badb8ae65a2cff5af736 (diff)
downloadaur-81a8925401a8cb0e7fd7c0368ea959bc01427341.tar.gz
Add home delete bug patch
-rw-r--r--.SRCINFO4
-rw-r--r--0001-Launcher-add-sanity-checks-for-QDir-removeRecursivel.patch72
-rw-r--r--PKGBUILD12
3 files changed, 84 insertions, 4 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 26748fd8c892..235e7635a9fb 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = vcmi
pkgdesc = Open-source engine for Heroes of Might and Magic III
pkgver = 0.99
- pkgrel = 3
+ pkgrel = 4
url = http://vcmi.eu
install = vcmi.install
arch = i686
@@ -24,7 +24,9 @@ pkgbase = vcmi
optdepends = unzip: required by vcmibuilder
conflicts = fuzzylite
source = https://github.com/vcmi/vcmi/archive/0.99.tar.gz
+ source = 0001-Launcher-add-sanity-checks-for-QDir-removeRecursivel.patch
sha256sums = b7f2459d7e054c8bdcf419cbb80040e751d3dbb06dc1113ac28f7365930f902e
+ sha256sums = fefca8818a11bc753a9dfd828fc1e3f6f64d104713e64fa76088c3ce05f60143
pkgname = vcmi
diff --git a/0001-Launcher-add-sanity-checks-for-QDir-removeRecursivel.patch b/0001-Launcher-add-sanity-checks-for-QDir-removeRecursivel.patch
new file mode 100644
index 000000000000..a23586d94f9a
--- /dev/null
+++ b/0001-Launcher-add-sanity-checks-for-QDir-removeRecursivel.patch
@@ -0,0 +1,72 @@
+From 5d8e943787666543df6b858c001ab4e59b09fe2d Mon Sep 17 00:00:00 2001
+From: Arseniy Shestakov <me@arseniyshestakov.com>
+Date: Thu, 25 May 2017 03:03:02 +0300
+Subject: [PATCH] Launcher: add sanity checks for QDir::removeRecursively.
+ Issue 2673
+
+I'm not always fail to uninstall mod, but when I do I remove $HOME
+Bumblebee developers should be proud of us...
+---
+ launcher/modManager/cmodmanager.cpp | 22 ++++++++++++++++++++--
+ launcher/modManager/cmodmanager.h | 1 +
+ 2 files changed, 21 insertions(+), 2 deletions(-)
+
+diff --git a/launcher/modManager/cmodmanager.cpp b/launcher/modManager/cmodmanager.cpp
+index 59fd7faf..99a3df32 100644
+--- a/launcher/modManager/cmodmanager.cpp
++++ b/launcher/modManager/cmodmanager.cpp
+@@ -245,7 +245,7 @@ bool CModManager::doInstallMod(QString modname, QString archivePath)
+
+ if (!ZipArchive::extract(qstringToPath(archivePath), qstringToPath(destDir)))
+ {
+- QDir(destDir + modDirName).removeRecursively();
++ removeModDir(destDir + modDirName);
+ return addError(modname, "Failed to extract mod data");
+ }
+
+@@ -270,7 +270,7 @@ bool CModManager::doUninstallMod(QString modname)
+ if (!localMods.contains(modname))
+ return addError(modname, "Data with this mod was not found");
+
+- if (!QDir(modDir).removeRecursively())
++ if (!removeModDir(modDir))
+ return addError(modname, "Failed to delete mod data");
+
+ localMods.remove(modname);
+@@ -279,3 +279,21 @@ bool CModManager::doUninstallMod(QString modname)
+
+ return true;
+ }
++
++bool CModManager::removeModDir(QString path)
++{
++ // issues 2673 and 2680 its why you do not recursively remove without sanity check
++ QDir checkDir(path);
++ if(!checkDir.cdUp() || QString::compare("Mods", checkDir.dirName(), Qt::CaseInsensitive))
++ return false;
++ if(!checkDir.cdUp() || QString::compare("vcmi", checkDir.dirName(), Qt::CaseInsensitive))
++ return false;
++
++ QDir dir(path);
++ if(!dir.absolutePath().contains("vcmi", Qt::CaseInsensitive))
++ return false;
++ if(!dir.absolutePath().contains("Mods", Qt::CaseInsensitive))
++ return false;
++
++ return dir.removeRecursively();
++}
+diff --git a/launcher/modManager/cmodmanager.h b/launcher/modManager/cmodmanager.h
+index 800db6b5..b759ef06 100644
+--- a/launcher/modManager/cmodmanager.h
++++ b/launcher/modManager/cmodmanager.h
+@@ -18,6 +18,7 @@ class CModManager
+
+ QStringList recentErrors;
+ bool addError(QString modname, QString message);
++ bool removeModDir(QString mod);
+ public:
+ CModManager(CModList * modList);
+
+--
+2.16.1
+
diff --git a/PKGBUILD b/PKGBUILD
index 65e1072f46ac..8c01738daef9 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -3,7 +3,7 @@
pkgname=vcmi
pkgver=0.99
-pkgrel=3
+pkgrel=4
pkgdesc="Open-source engine for Heroes of Might and Magic III"
arch=('i686' 'x86_64')
url="http://vcmi.eu"
@@ -16,9 +16,15 @@ optdepends=('innoextract: required by vcmibuilder'
'unzip: required by vcmibuilder')
conflicts=('fuzzylite')
install="${pkgname}.install"
-source=(https://github.com/vcmi/${pkgname}/archive/${pkgver}.tar.gz)
-sha256sums=('b7f2459d7e054c8bdcf419cbb80040e751d3dbb06dc1113ac28f7365930f902e')
+source=(https://github.com/vcmi/${pkgname}/archive/${pkgver}.tar.gz
+ 0001-Launcher-add-sanity-checks-for-QDir-removeRecursivel.patch)
+sha256sums=('b7f2459d7e054c8bdcf419cbb80040e751d3dbb06dc1113ac28f7365930f902e'
+ 'fefca8818a11bc753a9dfd828fc1e3f6f64d104713e64fa76088c3ce05f60143')
+prepare() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ patch -p0 "${srcdir}/0001-Launcher-add-sanity-checks-for-QDir-removeRecursivel.patch"
+}
build() {
cd "${srcdir}/${pkgname}-${pkgver}"
cmake \