Accepting request 805891 from home:wolfi323:test
- Add Fix-service-file-specifying-Run-in-terminal-giving-error.patch to fix starting services that use "Run in terminal" (kde#421374) - Add CopyJob-Check-if-destination-dir-is-a-symlink.patch to fix copying files to symlinked folders (kde#421213) OBS-URL: https://build.opensuse.org/request/show/805891 OBS-URL: https://build.opensuse.org/package/show/KDE:Frameworks5/kio?expand=0&rev=294
This commit is contained in:
parent
fda713b5f6
commit
d320b8b2e8
95
CopyJob-Check-if-destination-dir-is-a-symlink.patch
Normal file
95
CopyJob-Check-if-destination-dir-is-a-symlink.patch
Normal file
@ -0,0 +1,95 @@
|
||||
From 8769b6360d87c1b688eac4d0ce97594351bad13c Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?M=C3=A9ven=20Car?= <meven29@gmail.com>
|
||||
Date: Fri, 15 May 2020 12:44:35 +0200
|
||||
Subject: CopyJob: Check if destination dir is a symlink
|
||||
|
||||
Summary:
|
||||
BUG: 421213
|
||||
FIXED-IN: 5.71
|
||||
|
||||
Test Plan: ctest
|
||||
|
||||
Reviewers: #frameworks, dfaure, ngraham
|
||||
|
||||
Reviewed By: dfaure
|
||||
|
||||
Subscribers: kde-frameworks-devel
|
||||
|
||||
Tags: #frameworks
|
||||
|
||||
Differential Revision: https://phabricator.kde.org/D29767
|
||||
---
|
||||
autotests/jobtest.cpp | 30 ++++++++++++++++++++++++++++++
|
||||
autotests/jobtest.h | 1 +
|
||||
src/core/copyjob.cpp | 2 +-
|
||||
3 files changed, 32 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/autotests/jobtest.cpp b/autotests/jobtest.cpp
|
||||
index 5d5117a..0602319 100644
|
||||
--- a/autotests/jobtest.cpp
|
||||
+++ b/autotests/jobtest.cpp
|
||||
@@ -619,6 +619,36 @@ void JobTest::copyDirectoryToExistingDirectory()
|
||||
copyLocalDirectory(src, dest, AlreadyExists);
|
||||
}
|
||||
|
||||
+void JobTest::copyDirectoryToExistingSymlinkedDirectory()
|
||||
+{
|
||||
+ // qDebug();
|
||||
+ // just the same as copyDirectoryToSamePartition, but this time dest is a symlink.
|
||||
+ // So we get a file in the symlink dir, "dirFromHome_symlink/dirFromHome" and
|
||||
+ // "dirFromHome_symOrigin/dirFromHome"
|
||||
+ const QString src = homeTmpDir() + "dirFromHome";
|
||||
+ const QString origSymlink = homeTmpDir() + "dirFromHome_symOrigin";
|
||||
+ const QString targetSymlink = homeTmpDir() + "dirFromHome_symlink";
|
||||
+ createTestDirectory(src);
|
||||
+ createTestDirectory(origSymlink);
|
||||
+
|
||||
+ bool ok = KIOPrivate::createSymlink(origSymlink, targetSymlink);
|
||||
+ if (!ok) {
|
||||
+ qFatal("couldn't create symlink: %s", strerror(errno));
|
||||
+ }
|
||||
+ QVERIFY(QFileInfo(targetSymlink).isSymLink());
|
||||
+ QVERIFY(QFileInfo(targetSymlink).isDir());
|
||||
+
|
||||
+ KIO::Job *job = KIO::copy(QUrl::fromLocalFile(src), QUrl::fromLocalFile(targetSymlink), KIO::HideProgressInfo);
|
||||
+ job->setUiDelegate(nullptr);
|
||||
+ job->setUiDelegateExtension(nullptr);
|
||||
+ QVERIFY2(job->exec(), qPrintable(job->errorString()));
|
||||
+ QVERIFY(QFile::exists(src)); // still there
|
||||
+
|
||||
+ // file is visible in both places due to symlink
|
||||
+ QVERIFY(QFileInfo(origSymlink + "/dirFromHome").isDir());;
|
||||
+ QVERIFY(QFileInfo(targetSymlink + "/dirFromHome").isDir());
|
||||
+}
|
||||
+
|
||||
void JobTest::copyFileToOtherPartition()
|
||||
{
|
||||
// qDebug();
|
||||
diff --git a/autotests/jobtest.h b/autotests/jobtest.h
|
||||
index d8ac33f..9ebb2ad 100644
|
||||
--- a/autotests/jobtest.h
|
||||
+++ b/autotests/jobtest.h
|
||||
@@ -49,6 +49,7 @@ private Q_SLOTS:
|
||||
void copyFileToSamePartition();
|
||||
void copyDirectoryToSamePartition();
|
||||
void copyDirectoryToExistingDirectory();
|
||||
+ void copyDirectoryToExistingSymlinkedDirectory();
|
||||
void copyFileToOtherPartition();
|
||||
void copyDirectoryToOtherPartition();
|
||||
void copyRelativeSymlinkToSamePartition();
|
||||
diff --git a/src/core/copyjob.cpp b/src/core/copyjob.cpp
|
||||
index 06e0612..ec15543 100644
|
||||
--- a/src/core/copyjob.cpp
|
||||
+++ b/src/core/copyjob.cpp
|
||||
@@ -366,7 +366,7 @@ void CopyJobPrivate::slotStart()
|
||||
state = STATE_STATING;
|
||||
const QUrl dest = m_asMethod ? m_dest.adjusted(QUrl::RemoveFilename) : m_dest;
|
||||
// We need isDir() and UDS_LOCAL_PATH (for slaves who set it). Let's assume the latter is part of StatBasic too.
|
||||
- KIO::Job *job = KIO::statDetails(dest, StatJob::DestinationSide, KIO::StatBasic, KIO::HideProgressInfo);
|
||||
+ KIO::Job *job = KIO::statDetails(dest, StatJob::DestinationSide, KIO::StatBasic | KIO::StatResolveSymlink, KIO::HideProgressInfo);
|
||||
qCDebug(KIO_COPYJOB_DEBUG) << "CopyJob: stating the dest" << dest;
|
||||
q->addSubjob(job);
|
||||
}
|
||||
--
|
||||
cgit v1.1
|
||||
|
@ -0,0 +1,90 @@
|
||||
From 6452a34cf01d03d3167b38bc28a2fe8e13569021 Mon Sep 17 00:00:00 2001
|
||||
From: Jonathan Marten <jjm@keelhaul.me.uk>
|
||||
Date: Thu, 14 May 2020 19:17:54 +0100
|
||||
Subject: Fix service file specifying 'Run in terminal' giving an error code
|
||||
100
|
||||
|
||||
Happens because KIO::DesktopExecParser::resultingArguments() prepends
|
||||
the terminal application to the command line. If this is a relative path,
|
||||
as it is most likely to be (and will be in the default 'konsole' case),
|
||||
the "realExecutable" check in KProcessRunner::KProcessRunner() is triggered
|
||||
and the job aborts with an error.
|
||||
|
||||
Expand the specified terminal executable into a full path in resultingArguments(),
|
||||
and return an error immediately if it cannot be found. This full terminal path
|
||||
is not relative for the KProcessRunner::KProcessRunner() check and does not fail.
|
||||
|
||||
Check that resultingArguments() is not empty (an error return) before accessing
|
||||
the first word of the command, so that it does not assert if the list is empty.
|
||||
Also only call resultingArguments() once.
|
||||
|
||||
BUG: 421374
|
||||
FIXED-IN: 5.71
|
||||
|
||||
Differential Revision: https://phabricator.kde.org/D29738
|
||||
---
|
||||
src/core/desktopexecparser.cpp | 10 +++++++++-
|
||||
src/gui/kprocessrunner.cpp | 17 +++++++++--------
|
||||
2 files changed, 18 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/src/core/desktopexecparser.cpp b/src/core/desktopexecparser.cpp
|
||||
index a3b5219..fcf83d9 100644
|
||||
--- a/src/core/desktopexecparser.cpp
|
||||
+++ b/src/core/desktopexecparser.cpp
|
||||
@@ -421,7 +421,15 @@ QStringList KIO::DesktopExecParser::resultingArguments() const
|
||||
if (d->service.terminal()) {
|
||||
KConfigGroup cg(KSharedConfig::openConfig(), "General");
|
||||
QString terminal = cg.readPathEntry("TerminalApplication", QStringLiteral("konsole"));
|
||||
- if (terminal == QLatin1String("konsole")) {
|
||||
+ const bool isKonsole = (terminal == QLatin1String("konsole"));
|
||||
+
|
||||
+ QString terminalPath = QStandardPaths::findExecutable(terminal);
|
||||
+ if (terminalPath.isEmpty()) {
|
||||
+ qCWarning(KIO_CORE) << "Terminal" << terminal << "not found, service" << d->service.name();
|
||||
+ return QStringList();
|
||||
+ }
|
||||
+ terminal = terminalPath;
|
||||
+ if (isKonsole) {
|
||||
if (!d->service.workingDirectory().isEmpty()) {
|
||||
terminal += QLatin1String(" --workdir ") + KShell::quoteArg(d->service.workingDirectory());
|
||||
}
|
||||
diff --git a/src/gui/kprocessrunner.cpp b/src/gui/kprocessrunner.cpp
|
||||
index a4701a7..cc57b54 100644
|
||||
--- a/src/gui/kprocessrunner.cpp
|
||||
+++ b/src/gui/kprocessrunner.cpp
|
||||
@@ -88,9 +88,17 @@ KProcessRunner::KProcessRunner(const KService::Ptr &service, const QList<QUrl> &
|
||||
emitDelayedError(i18n("The desktop entry file\n%1\nis not valid.", service->entryPath()));
|
||||
return;
|
||||
}
|
||||
+
|
||||
KIO::DesktopExecParser execParser(*service, urls);
|
||||
+ execParser.setUrlsAreTempFiles(flags & KIO::ApplicationLauncherJob::DeleteTemporaryFiles);
|
||||
+ execParser.setSuggestedFileName(suggestedFileName);
|
||||
+ const QStringList args = execParser.resultingArguments();
|
||||
+ if (args.isEmpty()) {
|
||||
+ emitDelayedError(i18n("Error processing Exec field in %1", service->entryPath()));
|
||||
+ return;
|
||||
+ }
|
||||
|
||||
- const QString realExecutable = execParser.resultingArguments().at(0);
|
||||
+ const QString realExecutable = args.at(0);
|
||||
// realExecutable is a full path if DesktopExecParser was able to locate it. Otherwise it's still relative, which is a bad sign.
|
||||
if (QDir::isRelativePath(realExecutable) || !QFileInfo(realExecutable).isExecutable()) {
|
||||
// Does it really not exist, or is it non-executable? (bug #415567)
|
||||
@@ -103,13 +111,6 @@ KProcessRunner::KProcessRunner(const KService::Ptr &service, const QList<QUrl> &
|
||||
return;
|
||||
}
|
||||
|
||||
- execParser.setUrlsAreTempFiles(flags & KIO::ApplicationLauncherJob::DeleteTemporaryFiles);
|
||||
- execParser.setSuggestedFileName(suggestedFileName);
|
||||
- const QStringList args = execParser.resultingArguments();
|
||||
- if (args.isEmpty()) {
|
||||
- emitDelayedError(i18n("Error processing Exec field in %1", service->entryPath()));
|
||||
- return;
|
||||
- }
|
||||
//qDebug() << "KProcess args=" << args;
|
||||
*m_process << args;
|
||||
|
||||
--
|
||||
cgit v1.1
|
||||
|
@ -1,3 +1,11 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri May 15 17:03:12 UTC 2020 - Wolfgang Bauer <wbauer@tmo.at>
|
||||
|
||||
- Add Fix-service-file-specifying-Run-in-terminal-giving-error.patch
|
||||
to fix starting services that use "Run in terminal" (kde#421374)
|
||||
- Add CopyJob-Check-if-destination-dir-is-a-symlink.patch to fix
|
||||
copying files to symlinked folders (kde#421213)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sun May 3 09:40:02 UTC 2020 - Christophe Giboudeaux <christophe@krop.fr>
|
||||
|
||||
|
4
kio.spec
4
kio.spec
@ -37,6 +37,10 @@ Source2: frameworks.keyring
|
||||
Source99: baselibs.conf
|
||||
# PATCH-FIX-OPENSUSE kio_help-fallback-to-kde4-docs.patch -- allow kio_help to see into kde4 documentation, needed especially for khelpcenter5
|
||||
Patch0: kio_help-fallback-to-kde4-docs.patch
|
||||
# PATCH-FIX-UPSTREAM
|
||||
Patch1: Fix-service-file-specifying-Run-in-terminal-giving-error.patch
|
||||
# PATCH-FIX-UPSTREAM
|
||||
Patch2: CopyJob-Check-if-destination-dir-is-a-symlink.patch
|
||||
BuildRequires: cmake >= 3.0
|
||||
BuildRequires: extra-cmake-modules >= %{_kf5_bugfix_version}
|
||||
BuildRequires: fdupes
|
||||
|
Loading…
Reference in New Issue
Block a user