Codebase list kio / debian/5.82.0-3
One more patch, use cherry-picked format-patch Norbert Preining 2 years ago
7 changed file(s) with 255 addition(s) and 143 deletion(s). Raw diff Collapse all Expand all
0 kio (5.82.0-3) experimental; urgency=medium
1
2 [ Norbert Preining ]
3 * Cherry-pick another fix according to upstream.
4
5 -- Norbert Preining <norbert@preining.info> Sun, 16 May 2021 20:54:16 +0900
6
07 kio (5.82.0-2) experimental; urgency=medium
18
29 [ Norbert Preining ]
0 From 21d516bd69ba989374426a3466231f4ed7c5f796 Mon Sep 17 00:00:00 2001
1 From: Jonathan Marten <jjm@keelhaul.me.uk>
2 Date: Sat, 8 May 2021 15:20:39 +0000
3 Subject: [PATCH 1/4] MimeTypeFinderJob: Resolve symlinks for a local file
4
5 ---
6 autotests/mimetypefinderjobtest.cpp | 18 +++++++++++++++++-
7 src/core/mimetypefinderjob.cpp | 2 +-
8 2 files changed, 18 insertions(+), 2 deletions(-)
9
10 diff --git a/autotests/mimetypefinderjobtest.cpp b/autotests/mimetypefinderjobtest.cpp
11 index 72296b9b..f494ff3b 100644
12 --- a/autotests/mimetypefinderjobtest.cpp
13 +++ b/autotests/mimetypefinderjobtest.cpp
14 @@ -48,6 +48,7 @@ void MimeTypeFinderJobTest::determineMimeType_data()
15 QTest::newRow("text_file_no_extension") << "text/plain" << "srcfile";
16 QTest::newRow("desktop_file") << "application/x-desktop" << "foo.desktop";
17 QTest::newRow("script") << "application/x-shellscript" << "srcfile.sh";
18 + QTest::newRow("directory") << "inode/directory" << "srcdir";
19 /* clang-format on */
20 }
21
22 @@ -60,7 +61,12 @@ void MimeTypeFinderJobTest::determineMimeType()
23 QTemporaryDir tempDir;
24 const QString srcDir = tempDir.path();
25 const QString srcFile = srcDir + QLatin1Char('/') + fileName;
26 - createSrcFile(srcFile);
27 + if (mimeType == "inode/directory") {
28 + QVERIFY(QDir(srcDir).mkdir(fileName));
29 + } else {
30 + createSrcFile(srcFile);
31 + }
32 +
33 QVERIFY(QFile::exists(srcFile));
34 const QUrl url = QUrl::fromLocalFile(srcFile);
35
36 @@ -68,6 +74,16 @@ void MimeTypeFinderJobTest::determineMimeType()
37 KIO::MimeTypeFinderJob *job = new KIO::MimeTypeFinderJob(url, this);
38 QVERIFY2(job->exec(), qPrintable(job->errorString()));
39 QCOMPARE(job->mimeType(), mimeType);
40 +
41 + // Check that the result is the same when accessing the source
42 + // file through a symbolic link (bug #436708)
43 + const QString srcLink = srcDir + QLatin1String("/link_") + fileName;
44 + QVERIFY(QFile::link(srcFile, srcLink));
45 + const QUrl linkUrl = QUrl::fromLocalFile(srcLink);
46 +
47 + job = new KIO::MimeTypeFinderJob(linkUrl, this);
48 + QVERIFY2(job->exec(), qPrintable(job->errorString()));
49 + QCOMPARE(job->mimeType(), mimeType);
50 }
51
52 void MimeTypeFinderJobTest::invalidUrl()
53 diff --git a/src/core/mimetypefinderjob.cpp b/src/core/mimetypefinderjob.cpp
54 index f5e50cdc..48fc8c28 100644
55 --- a/src/core/mimetypefinderjob.cpp
56 +++ b/src/core/mimetypefinderjob.cpp
57 @@ -122,7 +122,7 @@ void KIO::MimeTypeFinderJobPrivate::statFile()
58 {
59 Q_ASSERT(m_mimeTypeName.isEmpty());
60
61 - KIO::StatJob *job = KIO::statDetails(m_url, KIO::StatJob::SourceSide, KIO::StatBasic, KIO::HideProgressInfo);
62 + KIO::StatJob *job = KIO::statDetails(m_url, KIO::StatJob::SourceSide, KIO::StatBasic | KIO::StatResolveSymlink, KIO::HideProgressInfo);
63 if (!m_authPrompts) {
64 job->addMetaData(QStringLiteral("no-auth-prompt"), QStringLiteral("true"));
65 }
66 --
67 2.31.1
68
0 From 665c0f5cdd302f74d8bdb59fba8fc2e2313c6bf6 Mon Sep 17 00:00:00 2001
1 From: Ahmad Samir <a.samirh78@gmail.com>
2 Date: Thu, 13 May 2021 23:03:57 +0200
3 Subject: [PATCH 2/4] kio_file: pass the absolute path to
4 QMimeDatabase::mimeTypeForFile()
5
6 Otherwise detecting the mime type based on the file content may fail and
7 return application/octet-stream.
8
9 And pass the whole url to createUDSEntry(), less QFile::decodeName/encodeName()
10 in the middle is better and less error prone.
11
12 Note that without this change a MimeTypeFinderJob could end up failing to
13 find the mime type of a local file based on the file contents.
14 ---
15 src/ioslaves/file/file_unix.cpp | 8 ++++----
16 1 file changed, 4 insertions(+), 4 deletions(-)
17
18 diff --git a/src/ioslaves/file/file_unix.cpp b/src/ioslaves/file/file_unix.cpp
19 index 99d46c8f..940e3cbc 100644
20 --- a/src/ioslaves/file/file_unix.cpp
21 +++ b/src/ioslaves/file/file_unix.cpp
22 @@ -364,7 +364,7 @@ inline static time_t stat_mtime(QT_STATBUF &buf)
23 }
24 #endif
25
26 -static bool createUDSEntry(const QString &filename, const QByteArray &path, UDSEntry &entry, KIO::StatDetails details)
27 +static bool createUDSEntry(const QString &filename, const QByteArray &path, UDSEntry &entry, KIO::StatDetails details, const QUrl &url)
28 {
29 assert(entry.count() == 0); // by contract :-)
30 int entries = 0;
31 @@ -539,7 +539,7 @@ static bool createUDSEntry(const QString &filename, const QByteArray &path, UDSE
32
33 if (details & KIO::StatMimeType) {
34 QMimeDatabase db;
35 - entry.fastInsert(KIO::UDSEntry::UDS_MIME_TYPE, db.mimeTypeForFile(filename).name());
36 + entry.fastInsert(KIO::UDSEntry::UDS_MIME_TYPE, db.mimeTypeForFile(url.toLocalFile()).name());
37 }
38
39 return true;
40 @@ -1186,7 +1186,7 @@ void FileProtocol::listDir(const QUrl &url)
41 listEntry(entry);
42
43 } else {
44 - if (createUDSEntry(filename, QByteArray(ep->d_name), entry, details)) {
45 + if (createUDSEntry(filename, QByteArray(ep->d_name), entry, details, url)) {
46 #if HAVE_SYS_XATTR_H
47 if (isNtfsHidden(filename)) {
48 bool ntfsHidden = true;
49 @@ -1476,7 +1476,7 @@ void FileProtocol::stat(const QUrl &url)
50 const KIO::StatDetails details = getStatDetails();
51
52 UDSEntry entry;
53 - if (!createUDSEntry(url.fileName(), _path, entry, details)) {
54 + if (!createUDSEntry(url.fileName(), _path, entry, details, url)) {
55 error(KIO::ERR_DOES_NOT_EXIST, path);
56 return;
57 }
58 --
59 2.31.1
60
0 From 7732251924dbd907351f847ae731058af713bbc8 Mon Sep 17 00:00:00 2001
1 From: Ahmad Samir <a.samirh78@gmail.com>
2 Date: Thu, 13 May 2021 17:02:52 +0200
3 Subject: [PATCH 3/4] MimeTypeFinderJob: the StatJob details should include the
4 mimetype
5
6 Apparently we forgot to specify that we want the UDS_MIME_TYPE field in
7 the statFile() method (both when it lived in OpenUrlJob and when it was moved
8 to MimeTypeFinderJob). And now there is a dedicated StatJob flag, StatMimeType,
9 that we can use.
10
11 Not passing KIO::StatMimeType when creating the StatJob meant the code always
12 used a get job to determine the mime type, which mean that e.g. opening an
13 ISO file from Dolphin, which supposedly just needs to launch Ark, had the
14 whole file read into memory, which means that opening a couple of ISO's and
15 you're out of memory...
16
17 Thanks to sitter for doing a big chunk of the investigative work in the bug
18 report.
19
20 CCBUG: 398908
21 ---
22 src/core/mimetypefinderjob.cpp | 6 +++++-
23 1 file changed, 5 insertions(+), 1 deletion(-)
24
25 diff --git a/src/core/mimetypefinderjob.cpp b/src/core/mimetypefinderjob.cpp
26 index 48fc8c28..baca5869 100644
27 --- a/src/core/mimetypefinderjob.cpp
28 +++ b/src/core/mimetypefinderjob.cpp
29 @@ -122,7 +122,9 @@ void KIO::MimeTypeFinderJobPrivate::statFile()
30 {
31 Q_ASSERT(m_mimeTypeName.isEmpty());
32
33 - KIO::StatJob *job = KIO::statDetails(m_url, KIO::StatJob::SourceSide, KIO::StatBasic | KIO::StatResolveSymlink, KIO::HideProgressInfo);
34 + static constexpr auto statFlags = KIO::StatBasic | KIO::StatResolveSymlink | KIO::StatMimeType;
35 +
36 + KIO::StatJob *job = KIO::statDetails(m_url, KIO::StatJob::SourceSide, statFlags, KIO::HideProgressInfo);
37 if (!m_authPrompts) {
38 job->addMetaData(QStringLiteral("no-auth-prompt"), QStringLiteral("true"));
39 }
40 @@ -147,6 +149,8 @@ void KIO::MimeTypeFinderJobPrivate::statFile()
41
42 const KIO::UDSEntry entry = job->statResult();
43
44 + qCDebug(KIO_CORE) << "UDSEntry from StatJob in MimeTypeFinderJob" << entry;
45 +
46 const QString localPath = entry.stringValue(KIO::UDSEntry::UDS_LOCAL_PATH);
47 if (!localPath.isEmpty()) {
48 m_url = QUrl::fromLocalFile(localPath);
49 --
50 2.31.1
51
0 From aefc86886a9e76b8a0d44e0e16d2ce502d5c9f7e Mon Sep 17 00:00:00 2001
1 From: Ahmad Samir <a.samirh78@gmail.com>
2 Date: Fri, 14 May 2021 21:19:31 +0200
3 Subject: [PATCH 4/4] kio_file: fix how createUDSEntry() is called
4
5 When calling createUDSEntry() from listDir(), we need to concatenate the full
6 path to the item.
7
8 This is an addendum to commit c748d6987252f.
9 ---
10 src/ioslaves/file/file_unix.cpp | 14 ++++++++++----
11 1 file changed, 10 insertions(+), 4 deletions(-)
12
13 diff --git a/src/ioslaves/file/file_unix.cpp b/src/ioslaves/file/file_unix.cpp
14 index 940e3cbc..3573c200 100644
15 --- a/src/ioslaves/file/file_unix.cpp
16 +++ b/src/ioslaves/file/file_unix.cpp
17 @@ -364,7 +364,7 @@ inline static time_t stat_mtime(QT_STATBUF &buf)
18 }
19 #endif
20
21 -static bool createUDSEntry(const QString &filename, const QByteArray &path, UDSEntry &entry, KIO::StatDetails details, const QUrl &url)
22 +static bool createUDSEntry(const QString &filename, const QByteArray &path, UDSEntry &entry, KIO::StatDetails details, const QString &fullPath)
23 {
24 assert(entry.count() == 0); // by contract :-)
25 int entries = 0;
26 @@ -539,7 +539,7 @@ static bool createUDSEntry(const QString &filename, const QByteArray &path, UDSE
27
28 if (details & KIO::StatMimeType) {
29 QMimeDatabase db;
30 - entry.fastInsert(KIO::UDSEntry::UDS_MIME_TYPE, db.mimeTypeForFile(url.toLocalFile()).name());
31 + entry.fastInsert(KIO::UDSEntry::UDS_MIME_TYPE, db.mimeTypeForFile(fullPath).name());
32 }
33
34 return true;
35 @@ -1186,7 +1186,13 @@ void FileProtocol::listDir(const QUrl &url)
36 listEntry(entry);
37
38 } else {
39 - if (createUDSEntry(filename, QByteArray(ep->d_name), entry, details, url)) {
40 + QString fullPath(path);
41 + if (!fullPath.endsWith(QLatin1Char('/'))) {
42 + fullPath += QLatin1Char('/');
43 + }
44 + fullPath += filename;
45 +
46 + if (createUDSEntry(filename, QByteArray(ep->d_name), entry, details, fullPath)) {
47 #if HAVE_SYS_XATTR_H
48 if (isNtfsHidden(filename)) {
49 bool ntfsHidden = true;
50 @@ -1476,7 +1482,7 @@ void FileProtocol::stat(const QUrl &url)
51 const KIO::StatDetails details = getStatDetails();
52
53 UDSEntry entry;
54 - if (!createUDSEntry(url.fileName(), _path, entry, details, url)) {
55 + if (!createUDSEntry(url.fileName(), _path, entry, details, path)) {
56 error(KIO::ERR_DOES_NOT_EXIST, path);
57 return;
58 }
59 --
60 2.31.1
61
+0
-142
debian/patches/kio-upstream-patches-from-freebsd less more
0 From aa6092a1dbfad606ad6430c71eec6add0bbdb4cf Mon Sep 17 00:00:00 2001
1 From: Adriaan de Groot <adridg@FreeBSD.org>
2 Date: Fri, 14 May 2021 18:15:52 +0200
3 Subject: devel/kf5-kio: backport regression-fixes from upstream
4
5 Upstream reports that the following three commits should be
6 backported for improved performance and accuracy for
7 mimetype detection in KIO-using applications:
8
9 (In https://invent.kde.org/frameworks/kio/commit/)
10 c748d6987252fafc296cde9351b289ef734cf861
11 e79da836c34fce66231e396c7215314d0eba51b4
12 c19876052ecec18a87a82f5950e8909e22e895ba
13 ---
14 .../patch-autotests_mimetypefinderjobtest.cpp | 39 ++++++++++++++++++++++
15 .../files/patch-src_core_mimetypefinderjob.cpp | 22 ++++++++++++
16 .../files/patch-src_ioslaves_file_file__unix.cpp | 38 +++++++++++++++++++++
17 4 files changed, 100 insertions(+)
18 create mode 100644 devel/kf5-kio/files/patch-autotests_mimetypefinderjobtest.cpp
19 create mode 100644 devel/kf5-kio/files/patch-src_core_mimetypefinderjob.cpp
20 create mode 100644 devel/kf5-kio/files/patch-src_ioslaves_file_file__unix.cpp
21
22 diff --git a/devel/kf5-kio/files/patch-autotests_mimetypefinderjobtest.cpp b/devel/kf5-kio/files/patch-autotests_mimetypefinderjobtest.cpp
23 new file mode 100644
24 index 000000000000..c0dd474fc18c
25 --- /dev/null
26 +++ b/devel/kf5-kio/files/patch-autotests_mimetypefinderjobtest.cpp
27 @@ -0,0 +1,39 @@
28 +--- autotests/mimetypefinderjobtest.cpp.orig 2021-05-06 17:50:59 UTC
29 ++++ autotests/mimetypefinderjobtest.cpp
30 +@@ -48,6 +48,7 @@ void MimeTypeFinderJobTest::determineMimeType_data()
31 + QTest::newRow("text_file_no_extension") << "text/plain" << "srcfile";
32 + QTest::newRow("desktop_file") << "application/x-desktop" << "foo.desktop";
33 + QTest::newRow("script") << "application/x-shellscript" << "srcfile.sh";
34 ++ QTest::newRow("directory") << "inode/directory" << "srcdir";
35 + /* clang-format on */
36 + }
37 +
38 +@@ -60,12 +61,27 @@ void MimeTypeFinderJobTest::determineMimeType()
39 + QTemporaryDir tempDir;
40 + const QString srcDir = tempDir.path();
41 + const QString srcFile = srcDir + QLatin1Char('/') + fileName;
42 +- createSrcFile(srcFile);
43 ++ if (mimeType == "inode/directory") {
44 ++ QVERIFY(QDir(srcDir).mkdir(fileName));
45 ++ } else {
46 ++ createSrcFile(srcFile);
47 ++ }
48 ++
49 + QVERIFY(QFile::exists(srcFile));
50 + const QUrl url = QUrl::fromLocalFile(srcFile);
51 +
52 + // When running a MimeTypeFinderJob
53 + KIO::MimeTypeFinderJob *job = new KIO::MimeTypeFinderJob(url, this);
54 ++ QVERIFY2(job->exec(), qPrintable(job->errorString()));
55 ++ QCOMPARE(job->mimeType(), mimeType);
56 ++
57 ++ // Check that the result is the same when accessing the source
58 ++ // file through a symbolic link (bug #436708)
59 ++ const QString srcLink = srcDir + QLatin1String("/link_") + fileName;
60 ++ QVERIFY(QFile::link(srcFile, srcLink));
61 ++ const QUrl linkUrl = QUrl::fromLocalFile(srcLink);
62 ++
63 ++ job = new KIO::MimeTypeFinderJob(linkUrl, this);
64 + QVERIFY2(job->exec(), qPrintable(job->errorString()));
65 + QCOMPARE(job->mimeType(), mimeType);
66 + }
67 diff --git a/devel/kf5-kio/files/patch-src_core_mimetypefinderjob.cpp b/devel/kf5-kio/files/patch-src_core_mimetypefinderjob.cpp
68 new file mode 100644
69 index 000000000000..42c0b4929b01
70 --- /dev/null
71 +++ b/devel/kf5-kio/files/patch-src_core_mimetypefinderjob.cpp
72 @@ -0,0 +1,22 @@
73 +--- src/core/mimetypefinderjob.cpp.orig 2021-05-14 15:38:26 UTC
74 ++++ src/core/mimetypefinderjob.cpp
75 +@@ -122,7 +122,9 @@ void KIO::MimeTypeFinderJobPrivate::statFile()
76 + {
77 + Q_ASSERT(m_mimeTypeName.isEmpty());
78 +
79 +- KIO::StatJob *job = KIO::statDetails(m_url, KIO::StatJob::SourceSide, KIO::StatBasic, KIO::HideProgressInfo);
80 ++ static constexpr auto statFlags = KIO::StatBasic | KIO::StatResolveSymlink | KIO::StatMimeType;
81 ++
82 ++ KIO::StatJob *job = KIO::statDetails(m_url, KIO::StatJob::SourceSide, statFlags, KIO::HideProgressInfo);
83 + if (!m_authPrompts) {
84 + job->addMetaData(QStringLiteral("no-auth-prompt"), QStringLiteral("true"));
85 + }
86 +@@ -146,6 +148,8 @@ void KIO::MimeTypeFinderJobPrivate::statFile()
87 + }
88 +
89 + const KIO::UDSEntry entry = job->statResult();
90 ++
91 ++ qCDebug(KIO_CORE) << "UDSEntry from StatJob in MimeTypeFinderJob" << entry;
92 +
93 + const QString localPath = entry.stringValue(KIO::UDSEntry::UDS_LOCAL_PATH);
94 + if (!localPath.isEmpty()) {
95 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
96 new file mode 100644
97 index 000000000000..2898beb65703
98 --- /dev/null
99 +++ b/devel/kf5-kio/files/patch-src_ioslaves_file_file__unix.cpp
100 @@ -0,0 +1,38 @@
101 +--- src/ioslaves/file/file_unix.cpp.orig 2021-05-06 17:50:59 UTC
102 ++++ src/ioslaves/file/file_unix.cpp
103 +@@ -364,7 +364,7 @@ inline static time_t stat_mtime(QT_STATBUF &buf)
104 + }
105 + #endif
106 +
107 +-static bool createUDSEntry(const QString &filename, const QByteArray &path, UDSEntry &entry, KIO::StatDetails details)
108 ++static bool createUDSEntry(const QString &filename, const QByteArray &path, UDSEntry &entry, KIO::StatDetails details, const QUrl &url)
109 + {
110 + assert(entry.count() == 0); // by contract :-)
111 + int entries = 0;
112 +@@ -539,7 +539,7 @@ static bool createUDSEntry(const QString &filename, co
113 +
114 + if (details & KIO::StatMimeType) {
115 + QMimeDatabase db;
116 +- entry.fastInsert(KIO::UDSEntry::UDS_MIME_TYPE, db.mimeTypeForFile(filename).name());
117 ++ entry.fastInsert(KIO::UDSEntry::UDS_MIME_TYPE, db.mimeTypeForFile(url.toLocalFile()).name());
118 + }
119 +
120 + return true;
121 +@@ -1186,7 +1186,7 @@ void FileProtocol::listDir(const QUrl &url)
122 + listEntry(entry);
123 +
124 + } else {
125 +- if (createUDSEntry(filename, QByteArray(ep->d_name), entry, details)) {
126 ++ if (createUDSEntry(filename, QByteArray(ep->d_name), entry, details, url)) {
127 + #if HAVE_SYS_XATTR_H
128 + if (isNtfsHidden(filename)) {
129 + bool ntfsHidden = true;
130 +@@ -1476,7 +1476,7 @@ void FileProtocol::stat(const QUrl &url)
131 + const KIO::StatDetails details = getStatDetails();
132 +
133 + UDSEntry entry;
134 +- if (!createUDSEntry(url.fileName(), _path, entry, details)) {
135 ++ if (!createUDSEntry(url.fileName(), _path, entry, details, url)) {
136 + error(KIO::ERR_DOES_NOT_EXIST, path);
137 + return;
138 + }
139 --
140 cgit v1.2.3
141
11 fix_kfreebsd_build
22 fix_hurd_build.patch
33 #Use-CXX_FLAGS-for-moc_predefs.h.patch
4 kio-upstream-patches-from-freebsd
4 0001-MimeTypeFinderJob-Resolve-symlinks-for-a-local-file.patch
5 0002-kio_file-pass-the-absolute-path-to-QMimeDatabase-mim.patch
6 0003-MimeTypeFinderJob-the-StatJob-details-should-include.patch
7 0004-kio_file-fix-how-createUDSEntry-is-called.patch