kde-frameworks/kio: Fix default codec being set to US-ASCII in apps

KDE-Bug: https://bugs.kde.org/show_bug.cgi?id=432406

Reported-by: Stefan Radermacher <gentoo@zaister.de>
Closes: https://bugs.gentoo.org/765430
Package-Manager: Portage-3.0.14, Repoman-3.0.2
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
This commit is contained in:
Andreas Sturmlechner
2021-02-12 22:47:18 +01:00
parent 3267620079
commit 76fbe81975
4 changed files with 336 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
From 0a13e0a3e830be2b2b2e5c2c6cf8cef25bd68bd8 Mon Sep 17 00:00:00 2001
From: Tusooa Zhu <tusooa@vista.aero>
Date: Thu, 4 Feb 2021 08:36:26 -0500
Subject: [PATCH] Fix default codec being set to "US-ASCII" in KIO apps
From https://doc.qt.io/qt-5/qloggingcategory.html#Q_LOGGING_CATEGORY-1 :
"The implicitly-defined QLoggingCategory object is created on first use,
in a thread-safe manner."
The original way to explicitly define a static QLoggingCategory will lead
to a call to ucnv_getDefaultName() before QApplication constructor (where
setlocale() is called), thus making QTextCodec::codecForLocale() misbehave.
Here we replace the explicit definition with the Q_LOGGING_CATEGORY macro,
and thus avoid this problem.
BUG: 432406
---
src/widgets/kdirmodel.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/widgets/kdirmodel.cpp b/src/widgets/kdirmodel.cpp
index a48ab462..aa049e3d 100644
--- a/src/widgets/kdirmodel.cpp
+++ b/src/widgets/kdirmodel.cpp
@@ -36,7 +36,7 @@
#include <qt_windows.h>
#endif
-static QLoggingCategory category("kf.kio.widgets.kdirmodel", QtInfoMsg);
+Q_LOGGING_CATEGORY(category, "kf.kio.widgets.kdirmodel", QtInfoMsg)
class KDirModelNode;
class KDirModelDirNode;
--
GitLab

View File

@@ -0,0 +1,100 @@
From 423bea37e4bb06b9c04a62a9a91b720ec5d5e3d5 Mon Sep 17 00:00:00 2001
From: Tusooa Zhu <tusooa@vista.aero>
Date: Thu, 4 Feb 2021 18:06:23 -0500
Subject: [PATCH] Use Q_LOGGING_CATEGORY macro instead of explicit
QLoggingCategory
Explicitly defining a QLoggingCategory will make QTextCodec::codecForLocale()
misbehave, so we change it to Q_LOGGING_CATEGORY macro.
CCBUG: 432406
---
src/kpasswdserver/kpasswdserver.cpp | 2 +-
src/urifilters/ikws/kuriikwsfilter.cpp | 2 +-
src/urifilters/ikws/kuriikwsfiltereng.cpp | 2 +-
src/urifilters/ikws/kurisearchfilter.cpp | 2 +-
src/urifilters/localdomain/localdomainurifilter.cpp | 2 +-
src/urifilters/shorturi/kshorturifilter.cpp | 2 +-
6 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/kpasswdserver/kpasswdserver.cpp b/src/kpasswdserver/kpasswdserver.cpp
index 4ed73085..a832a0ab 100644
--- a/src/kpasswdserver/kpasswdserver.cpp
+++ b/src/kpasswdserver/kpasswdserver.cpp
@@ -28,7 +28,7 @@
#include <QTimer>
#include <ctime>
-static QLoggingCategory category("kf.kio.kpasswdserver", QtInfoMsg);
+Q_LOGGING_CATEGORY(category, "kf.kio.kpasswdserver", QtInfoMsg)
#define AUTHINFO_EXTRAFIELD_DOMAIN QStringLiteral("domain")
#define AUTHINFO_EXTRAFIELD_ANONYMOUS QStringLiteral("anonymous")
diff --git a/src/urifilters/ikws/kuriikwsfilter.cpp b/src/urifilters/ikws/kuriikwsfilter.cpp
index 3a516fd8..bbc17678 100644
--- a/src/urifilters/ikws/kuriikwsfilter.cpp
+++ b/src/urifilters/ikws/kuriikwsfilter.cpp
@@ -22,7 +22,7 @@
#define QL1C(x) QLatin1Char(x)
namespace {
-QLoggingCategory category("kf.kio.urifilters.ikws", QtWarningMsg);
+Q_LOGGING_CATEGORY(category, "kf.kio.urifilters.ikws", QtWarningMsg)
}
/**
diff --git a/src/urifilters/ikws/kuriikwsfiltereng.cpp b/src/urifilters/ikws/kuriikwsfiltereng.cpp
index 5b1bbc48..29647e3e 100644
--- a/src/urifilters/ikws/kuriikwsfiltereng.cpp
+++ b/src/urifilters/ikws/kuriikwsfiltereng.cpp
@@ -22,7 +22,7 @@
#include <QLoggingCategory>
namespace {
-QLoggingCategory category("kf.kio.urifilters.ikws", QtWarningMsg);
+Q_LOGGING_CATEGORY(category, "kf.kio.urifilters.ikws", QtWarningMsg)
}
#define PDVAR(n, v) qCDebug(category) << n << " = '" << v << "'"
diff --git a/src/urifilters/ikws/kurisearchfilter.cpp b/src/urifilters/ikws/kurisearchfilter.cpp
index a12a9f59..669246c1 100644
--- a/src/urifilters/ikws/kurisearchfilter.cpp
+++ b/src/urifilters/ikws/kurisearchfilter.cpp
@@ -26,7 +26,7 @@
K_PLUGIN_CLASS_WITH_JSON(KUriSearchFilter, "kurisearchfilter.json")
namespace {
-QLoggingCategory category("kf.kio.urifilters.ikws", QtWarningMsg);
+Q_LOGGING_CATEGORY(category, "kf.kio.urifilters.ikws", QtWarningMsg)
}
KUriSearchFilter::KUriSearchFilter(QObject *parent, const QVariantList &)
diff --git a/src/urifilters/localdomain/localdomainurifilter.cpp b/src/urifilters/localdomain/localdomainurifilter.cpp
index 862419a7..94a53606 100644
--- a/src/urifilters/localdomain/localdomainurifilter.cpp
+++ b/src/urifilters/localdomain/localdomainurifilter.cpp
@@ -20,7 +20,7 @@
#define QL1S(x) QLatin1String(x)
namespace {
-QLoggingCategory category("kf.kio.urifilters.localdomain", QtWarningMsg);
+Q_LOGGING_CATEGORY(category, "kf.kio.urifilters.localdomain", QtWarningMsg)
}
/**
diff --git a/src/urifilters/shorturi/kshorturifilter.cpp b/src/urifilters/shorturi/kshorturifilter.cpp
index dc866e6c..62d810c4 100644
--- a/src/urifilters/shorturi/kshorturifilter.cpp
+++ b/src/urifilters/shorturi/kshorturifilter.cpp
@@ -27,7 +27,7 @@
#include <KUser>
namespace {
-QLoggingCategory category("kf.kio.urifilters.shorturi", QtWarningMsg);
+Q_LOGGING_CATEGORY(category, "kf.kio.urifilters.shorturi", QtWarningMsg)
}
/**
--
GitLab

View File

@@ -0,0 +1,100 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
ECM_DESIGNERPLUGIN="true"
ECM_TEST="forceoptional"
PVCUT=$(ver_cut 1-2)
QTMIN=5.15.1
VIRTUALX_REQUIRED="test"
inherit ecm kde.org xdg-utils
DESCRIPTION="Framework providing transparent file and data management"
LICENSE="LGPL-2+"
KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86"
IUSE="acl +handbook kerberos +kwallet X"
# tests hang
RESTRICT+=" test"
RDEPEND="
dev-libs/libxml2
dev-libs/libxslt
>=dev-qt/qtdbus-${QTMIN}:5
>=dev-qt/qtdeclarative-${QTMIN}:5
>=dev-qt/qtgui-${QTMIN}:5
>=dev-qt/qtnetwork-${QTMIN}:5[ssl]
>=dev-qt/qtwidgets-${QTMIN}:5
>=dev-qt/qtxml-${QTMIN}:5
=kde-frameworks/kauth-${PVCUT}*:5
=kde-frameworks/karchive-${PVCUT}*:5
=kde-frameworks/kbookmarks-${PVCUT}*:5
=kde-frameworks/kcodecs-${PVCUT}*:5
=kde-frameworks/kcompletion-${PVCUT}*:5
=kde-frameworks/kconfig-${PVCUT}*:5
=kde-frameworks/kconfigwidgets-${PVCUT}*:5
=kde-frameworks/kcoreaddons-${PVCUT}*:5
=kde-frameworks/kcrash-${PVCUT}*:5
=kde-frameworks/kdbusaddons-${PVCUT}*:5
=kde-frameworks/ki18n-${PVCUT}*:5
=kde-frameworks/kiconthemes-${PVCUT}*:5
=kde-frameworks/kitemviews-${PVCUT}*:5
=kde-frameworks/kjobwidgets-${PVCUT}*:5
=kde-frameworks/knotifications-${PVCUT}*:5
=kde-frameworks/kservice-${PVCUT}*:5
=kde-frameworks/ktextwidgets-${PVCUT}*:5
=kde-frameworks/kwidgetsaddons-${PVCUT}*:5
=kde-frameworks/kwindowsystem-${PVCUT}*:5
=kde-frameworks/kxmlgui-${PVCUT}*:5
=kde-frameworks/solid-${PVCUT}*:5
acl? (
sys-apps/attr
virtual/acl
)
handbook? ( =kde-frameworks/kdoctools-${PVCUT}*:5 )
kerberos? ( virtual/krb5 )
kwallet? ( =kde-frameworks/kwallet-${PVCUT}*:5 )
X? ( >=dev-qt/qtx11extras-${QTMIN}:5 )
"
DEPEND="${RDEPEND}
>=dev-qt/qtconcurrent-${QTMIN}:5
test? ( sys-libs/zlib )
X? (
x11-base/xorg-proto
x11-libs/libX11
x11-libs/libXrender
)
"
PDEPEND="
>=kde-frameworks/kded-${PVCUT}:5
"
PATCHES=(
"${FILESDIR}"/${P}-crashfix.patch
"${FILESDIR}"/${P}-gcc11.patch # bug 766480
"${FILESDIR}"/${P}-fix-default-codec-not-usascii-{1,2}.patch # bug 765430
)
src_configure() {
local mycmakeargs=(
$(cmake_use_find_package acl ACL)
$(cmake_use_find_package handbook KF5DocTools)
$(cmake_use_find_package kerberos GSSAPI)
$(cmake_use_find_package kwallet KF5Wallet)
$(cmake_use_find_package X X11)
)
ecm_src_configure
}
pkg_postinst() {
ecm_pkg_postinst
xdg_desktop_database_update
}
pkg_postrm() {
ecm_pkg_postrm
xdg_desktop_database_update
}

View File

@@ -0,0 +1,100 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
ECM_DESIGNERPLUGIN="true"
ECM_TEST="forceoptional"
PVCUT=$(ver_cut 1-2)
QTMIN=5.15.1
VIRTUALX_REQUIRED="test"
inherit ecm kde.org xdg-utils
DESCRIPTION="Framework providing transparent file and data management"
LICENSE="LGPL-2+"
KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86"
IUSE="acl +handbook kerberos +kwallet X"
# tests hang
RESTRICT+=" test"
RDEPEND="
dev-libs/libxml2
dev-libs/libxslt
>=dev-qt/qtdbus-${QTMIN}:5
>=dev-qt/qtdeclarative-${QTMIN}:5
>=dev-qt/qtgui-${QTMIN}:5
>=dev-qt/qtnetwork-${QTMIN}:5[ssl]
>=dev-qt/qtwidgets-${QTMIN}:5
>=dev-qt/qtxml-${QTMIN}:5
=kde-frameworks/kauth-${PVCUT}*:5
=kde-frameworks/karchive-${PVCUT}*:5
=kde-frameworks/kbookmarks-${PVCUT}*:5
=kde-frameworks/kcodecs-${PVCUT}*:5
=kde-frameworks/kcompletion-${PVCUT}*:5
=kde-frameworks/kconfig-${PVCUT}*:5
=kde-frameworks/kconfigwidgets-${PVCUT}*:5
=kde-frameworks/kcoreaddons-${PVCUT}*:5
=kde-frameworks/kcrash-${PVCUT}*:5
=kde-frameworks/kdbusaddons-${PVCUT}*:5
=kde-frameworks/ki18n-${PVCUT}*:5
=kde-frameworks/kiconthemes-${PVCUT}*:5
=kde-frameworks/kitemviews-${PVCUT}*:5
=kde-frameworks/kjobwidgets-${PVCUT}*:5
=kde-frameworks/knotifications-${PVCUT}*:5
=kde-frameworks/kservice-${PVCUT}*:5
=kde-frameworks/ktextwidgets-${PVCUT}*:5
=kde-frameworks/kwidgetsaddons-${PVCUT}*:5
=kde-frameworks/kwindowsystem-${PVCUT}*:5
=kde-frameworks/kxmlgui-${PVCUT}*:5
=kde-frameworks/solid-${PVCUT}*:5
acl? (
sys-apps/attr
virtual/acl
)
handbook? ( =kde-frameworks/kdoctools-${PVCUT}*:5 )
kerberos? ( virtual/krb5 )
kwallet? ( =kde-frameworks/kwallet-${PVCUT}*:5 )
X? ( >=dev-qt/qtx11extras-${QTMIN}:5 )
"
DEPEND="${RDEPEND}
>=dev-qt/qtconcurrent-${QTMIN}:5
test? ( sys-libs/zlib )
X? (
x11-base/xorg-proto
x11-libs/libX11
x11-libs/libXrender
)
"
PDEPEND="
>=kde-frameworks/kded-${PVCUT}:5
"
PATCHES=(
"${FILESDIR}"/${PN}-5.77.0-gcc11.patch # bug 766480
"${FILESDIR}"/${P}-copyjob-crash.patch # KDE-Bug 431731
"${FILESDIR}"/${PN}-5.77.0-fix-default-codec-not-usascii-{1,2}.patch # bug 765430
)
src_configure() {
local mycmakeargs=(
$(cmake_use_find_package acl ACL)
$(cmake_use_find_package handbook KF5DocTools)
$(cmake_use_find_package kerberos GSSAPI)
$(cmake_use_find_package kwallet KF5Wallet)
$(cmake_use_find_package X X11)
)
ecm_src_configure
}
pkg_postinst() {
ecm_pkg_postinst
xdg_desktop_database_update
}
pkg_postrm() {
ecm_pkg_postrm
xdg_desktop_database_update
}