From owner-dev-commits-ports-all@freebsd.org Fri May 14 19:08:22 2021 Return-Path: Delivered-To: dev-commits-ports-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A201162881D; Fri, 14 May 2021 19:08:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FhdN63QD5z3DNM; Fri, 14 May 2021 19:08:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 60235176E0; Fri, 14 May 2021 19:08:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14EJ8MCs032598; Fri, 14 May 2021 19:08:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14EJ8M4P032597; Fri, 14 May 2021 19:08:22 GMT (envelope-from git) Date: Fri, 14 May 2021 19:08:22 GMT Message-Id: <202105141908.14EJ8M4P032597@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Adriaan de Groot Subject: git: aa6092a1dbfa - main - devel/kf5-kio: backport regression-fixes from upstream MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adridg X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: aa6092a1dbfad606ad6430c71eec6add0bbdb4cf Auto-Submitted: auto-generated X-BeenThere: dev-commits-ports-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the ports repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 May 2021 19:08:22 -0000 The branch main has been updated by adridg: URL: https://cgit.FreeBSD.org/ports/commit/?id=aa6092a1dbfad606ad6430c71eec6add0bbdb4cf commit aa6092a1dbfad606ad6430c71eec6add0bbdb4cf Author: Adriaan de Groot AuthorDate: 2021-05-14 16:15:52 +0000 Commit: Adriaan de Groot CommitDate: 2021-05-14 19:08:19 +0000 devel/kf5-kio: backport regression-fixes from upstream Upstream reports that the following three commits should be backported for improved performance and accuracy for mimetype detection in KIO-using applications: (In https://invent.kde.org/frameworks/kio/commit/) c748d6987252fafc296cde9351b289ef734cf861 e79da836c34fce66231e396c7215314d0eba51b4 c19876052ecec18a87a82f5950e8909e22e895ba --- devel/kf5-kio/Makefile | 1 + .../patch-autotests_mimetypefinderjobtest.cpp | 39 ++++++++++++++++++++++ .../files/patch-src_core_mimetypefinderjob.cpp | 22 ++++++++++++ .../files/patch-src_ioslaves_file_file__unix.cpp | 38 +++++++++++++++++++++ 4 files changed, 100 insertions(+) diff --git a/devel/kf5-kio/Makefile b/devel/kf5-kio/Makefile index f7e2435fbc1b..f8d5117ca61e 100644 --- a/devel/kf5-kio/Makefile +++ b/devel/kf5-kio/Makefile @@ -1,5 +1,6 @@ PORTNAME= kio DISTVERSION= ${KDE_FRAMEWORKS_VERSION} +PORTREVISION= 1 CATEGORIES= devel kde kde-frameworks MAINTAINER= kde@FreeBSD.org diff --git a/devel/kf5-kio/files/patch-autotests_mimetypefinderjobtest.cpp b/devel/kf5-kio/files/patch-autotests_mimetypefinderjobtest.cpp new file mode 100644 index 000000000000..c0dd474fc18c --- /dev/null +++ b/devel/kf5-kio/files/patch-autotests_mimetypefinderjobtest.cpp @@ -0,0 +1,39 @@ +--- autotests/mimetypefinderjobtest.cpp.orig 2021-05-06 17:50:59 UTC ++++ 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,12 +61,27 @@ 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); + + // When running a MimeTypeFinderJob + 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); + } diff --git a/devel/kf5-kio/files/patch-src_core_mimetypefinderjob.cpp b/devel/kf5-kio/files/patch-src_core_mimetypefinderjob.cpp new file mode 100644 index 000000000000..42c0b4929b01 --- /dev/null +++ b/devel/kf5-kio/files/patch-src_core_mimetypefinderjob.cpp @@ -0,0 +1,22 @@ +--- src/core/mimetypefinderjob.cpp.orig 2021-05-14 15:38:26 UTC ++++ 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::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")); + } +@@ -146,6 +148,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()) { diff --git a/devel/kf5-kio/files/patch-src_ioslaves_file_file__unix.cpp b/devel/kf5-kio/files/patch-src_ioslaves_file_file__unix.cpp new file mode 100644 index 000000000000..2898beb65703 --- /dev/null +++ b/devel/kf5-kio/files/patch-src_ioslaves_file_file__unix.cpp @@ -0,0 +1,38 @@ +--- src/ioslaves/file/file_unix.cpp.orig 2021-05-06 17:50:59 UTC ++++ 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, co + + 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; + }