Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package kio for openSUSE:Factory checked in at 2021-05-20 19:23:09 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/kio (Old) and /work/SRC/openSUSE:Factory/.kio.new.2988 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "kio" Thu May 20 19:23:09 2021 rev:111 rq:893279 version:5.82.0 Changes: -------- --- /work/SRC/openSUSE:Factory/kio/kio.changes 2021-05-10 15:37:14.438072536 +0200 +++ /work/SRC/openSUSE:Factory/.kio.new.2988/kio.changes 2021-05-20 19:23:17.282386803 +0200 @@ -1,0 +2,8 @@ +Fri May 14 13:00:14 UTC 2021 - Fabian Vogt <fab...@ritter-vogt.de> + +- Add patches to fix issues with MimeTypeFinderJob (kde#398908): + * 0001-MimeTypeFinderJob-Resolve-symlinks-for-a-local-file.patch + * 0002-MimeTypeFinderJob-the-StatJob-details-should-include.patch + * 0003-kio_file-pass-the-absolute-path-to-QMimeDatabase-mim.patch + +------------------------------------------------------------------- New: ---- 0001-MimeTypeFinderJob-Resolve-symlinks-for-a-local-file.patch 0002-MimeTypeFinderJob-the-StatJob-details-should-include.patch 0003-kio_file-pass-the-absolute-path-to-QMimeDatabase-mim.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ kio.spec ++++++ --- /var/tmp/diff_new_pack.3i9Z2B/_old 2021-05-20 19:23:19.082379188 +0200 +++ /var/tmp/diff_new_pack.3i9Z2B/_new 2021-05-20 19:23:19.082379188 +0200 @@ -37,6 +37,10 @@ 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: 0001-MimeTypeFinderJob-Resolve-symlinks-for-a-local-file.patch +Patch2: 0002-MimeTypeFinderJob-the-StatJob-details-should-include.patch +Patch3: 0003-kio_file-pass-the-absolute-path-to-QMimeDatabase-mim.patch BuildRequires: extra-cmake-modules >= %{_kf5_bugfix_version} BuildRequires: fdupes BuildRequires: kf5-filesystem ++++++ 0001-MimeTypeFinderJob-Resolve-symlinks-for-a-local-file.patch ++++++ >From 542a74b8fa70fa530a436ee3222a9b0562155708 Mon Sep 17 00:00:00 2001 From: Jonathan Marten <j...@keelhaul.me.uk> Date: Sat, 8 May 2021 15:20:39 +0000 Subject: [PATCH 1/3] MimeTypeFinderJob: Resolve symlinks for a local file (cherry picked from commit e79da836c34fce66231e396c7215314d0eba51b4) --- autotests/mimetypefinderjobtest.cpp | 18 +++++++++++++++++- src/core/mimetypefinderjob.cpp | 2 +- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/autotests/mimetypefinderjobtest.cpp b/autotests/mimetypefinderjobtest.cpp index 72296b9b..f494ff3b 100644 --- a/autotests/mimetypefinderjobtest.cpp +++ b/autotests/mimetypefinderjobtest.cpp @@ -48,6 +48,7 @@ void MimeTypeFinderJobTest::determineMimeType_data() QTest::newRow("text_file_no_extension") << "text/plain" << "srcfile"; QTest::newRow("desktop_file") << "application/x-desktop" << "foo.desktop"; QTest::newRow("script") << "application/x-shellscript" << "srcfile.sh"; + QTest::newRow("directory") << "inode/directory" << "srcdir"; /* clang-format on */ } @@ -60,7 +61,12 @@ void MimeTypeFinderJobTest::determineMimeType() QTemporaryDir tempDir; const QString srcDir = tempDir.path(); const QString srcFile = srcDir + QLatin1Char('/') + fileName; - createSrcFile(srcFile); + if (mimeType == "inode/directory") { + QVERIFY(QDir(srcDir).mkdir(fileName)); + } else { + createSrcFile(srcFile); + } + QVERIFY(QFile::exists(srcFile)); const QUrl url = QUrl::fromLocalFile(srcFile); @@ -68,6 +74,16 @@ void MimeTypeFinderJobTest::determineMimeType() KIO::MimeTypeFinderJob *job = new KIO::MimeTypeFinderJob(url, this); QVERIFY2(job->exec(), qPrintable(job->errorString())); QCOMPARE(job->mimeType(), mimeType); + + // Check that the result is the same when accessing the source + // file through a symbolic link (bug #436708) + const QString srcLink = srcDir + QLatin1String("/link_") + fileName; + QVERIFY(QFile::link(srcFile, srcLink)); + const QUrl linkUrl = QUrl::fromLocalFile(srcLink); + + job = new KIO::MimeTypeFinderJob(linkUrl, this); + QVERIFY2(job->exec(), qPrintable(job->errorString())); + QCOMPARE(job->mimeType(), mimeType); } void MimeTypeFinderJobTest::invalidUrl() diff --git a/src/core/mimetypefinderjob.cpp b/src/core/mimetypefinderjob.cpp index f5e50cdc..48fc8c28 100644 --- a/src/core/mimetypefinderjob.cpp +++ b/src/core/mimetypefinderjob.cpp @@ -122,7 +122,7 @@ void KIO::MimeTypeFinderJobPrivate::statFile() { Q_ASSERT(m_mimeTypeName.isEmpty()); - KIO::StatJob *job = KIO::statDetails(m_url, KIO::StatJob::SourceSide, KIO::StatBasic, KIO::HideProgressInfo); + KIO::StatJob *job = KIO::statDetails(m_url, KIO::StatJob::SourceSide, KIO::StatBasic | KIO::StatResolveSymlink, KIO::HideProgressInfo); if (!m_authPrompts) { job->addMetaData(QStringLiteral("no-auth-prompt"), QStringLiteral("true")); } -- 2.25.1 ++++++ 0002-MimeTypeFinderJob-the-StatJob-details-should-include.patch ++++++ >From e78b0cd47422869e980db633cbdc0c7cfcdd8dd8 Mon Sep 17 00:00:00 2001 From: Ahmad Samir <a.samir...@gmail.com> Date: Thu, 13 May 2021 17:02:52 +0200 Subject: [PATCH 2/3] MimeTypeFinderJob: the StatJob details should include the mimetype Apparently we forgot to specify that we want the UDS_MIME_TYPE field in the statFile() method (both when it lived in OpenUrlJob and when it was moved to MimeTypeFinderJob). And now there is a dedicated StatJob flag, StatMimeType, that we can use. Not passing KIO::StatMimeType when creating the StatJob meant the code always used a get job to determine the mime type, which mean that e.g. opening an ISO file from Dolphin, which supposedly just needs to launch Ark, had the whole file read into memory, which means that opening a couple of ISO's and you're out of memory... Thanks to sitter for doing a big chunk of the investigative work in the bug report. CCBUG: 398908 (cherry picked from commit c19876052ecec18a87a82f5950e8909e22e895ba) --- src/core/mimetypefinderjob.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/core/mimetypefinderjob.cpp b/src/core/mimetypefinderjob.cpp index 48fc8c28..baca5869 100644 --- a/src/core/mimetypefinderjob.cpp +++ b/src/core/mimetypefinderjob.cpp @@ -122,7 +122,9 @@ void KIO::MimeTypeFinderJobPrivate::statFile() { Q_ASSERT(m_mimeTypeName.isEmpty()); - KIO::StatJob *job = KIO::statDetails(m_url, KIO::StatJob::SourceSide, KIO::StatBasic | KIO::StatResolveSymlink, KIO::HideProgressInfo); + static constexpr auto statFlags = KIO::StatBasic | KIO::StatResolveSymlink | KIO::StatMimeType; + + KIO::StatJob *job = KIO::statDetails(m_url, KIO::StatJob::SourceSide, statFlags, KIO::HideProgressInfo); if (!m_authPrompts) { job->addMetaData(QStringLiteral("no-auth-prompt"), QStringLiteral("true")); } @@ -147,6 +149,8 @@ void KIO::MimeTypeFinderJobPrivate::statFile() const KIO::UDSEntry entry = job->statResult(); + qCDebug(KIO_CORE) << "UDSEntry from StatJob in MimeTypeFinderJob" << entry; + const QString localPath = entry.stringValue(KIO::UDSEntry::UDS_LOCAL_PATH); if (!localPath.isEmpty()) { m_url = QUrl::fromLocalFile(localPath); -- 2.25.1 ++++++ 0003-kio_file-pass-the-absolute-path-to-QMimeDatabase-mim.patch ++++++ >From dc5e968eefa4e6fafa0eecdfd36e7ea17b42fc08 Mon Sep 17 00:00:00 2001 From: Ahmad Samir <a.samir...@gmail.com> Date: Thu, 13 May 2021 23:03:57 +0200 Subject: [PATCH 3/3] kio_file: pass the absolute path to QMimeDatabase::mimeTypeForFile() Otherwise detecting the mime type based on the file content may fail and return application/octet-stream. And pass the whole url to createUDSEntry(), less QFile::decodeName/encodeName() in the middle is better and less error prone. Note that without this change a MimeTypeFinderJob could end up failing to find the mime type of a local file based on the file contents. (cherry picked from commit c748d6987252fafc296cde9351b289ef734cf861) --- src/ioslaves/file/file_unix.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ioslaves/file/file_unix.cpp b/src/ioslaves/file/file_unix.cpp index 99d46c8f..940e3cbc 100644 --- a/src/ioslaves/file/file_unix.cpp +++ b/src/ioslaves/file/file_unix.cpp @@ -364,7 +364,7 @@ inline static time_t stat_mtime(QT_STATBUF &buf) } #endif -static bool createUDSEntry(const QString &filename, const QByteArray &path, UDSEntry &entry, KIO::StatDetails details) +static bool createUDSEntry(const QString &filename, const QByteArray &path, UDSEntry &entry, KIO::StatDetails details, const QUrl &url) { assert(entry.count() == 0); // by contract :-) int entries = 0; @@ -539,7 +539,7 @@ static bool createUDSEntry(const QString &filename, const QByteArray &path, UDSE if (details & KIO::StatMimeType) { QMimeDatabase db; - entry.fastInsert(KIO::UDSEntry::UDS_MIME_TYPE, db.mimeTypeForFile(filename).name()); + entry.fastInsert(KIO::UDSEntry::UDS_MIME_TYPE, db.mimeTypeForFile(url.toLocalFile()).name()); } return true; @@ -1186,7 +1186,7 @@ void FileProtocol::listDir(const QUrl &url) listEntry(entry); } else { - if (createUDSEntry(filename, QByteArray(ep->d_name), entry, details)) { + if (createUDSEntry(filename, QByteArray(ep->d_name), entry, details, url)) { #if HAVE_SYS_XATTR_H if (isNtfsHidden(filename)) { bool ntfsHidden = true; @@ -1476,7 +1476,7 @@ void FileProtocol::stat(const QUrl &url) const KIO::StatDetails details = getStatDetails(); UDSEntry entry; - if (!createUDSEntry(url.fileName(), _path, entry, details)) { + if (!createUDSEntry(url.fileName(), _path, entry, details, url)) { error(KIO::ERR_DOES_NOT_EXIST, path); return; } -- 2.25.1