Code: Select all
--- a/kwrite/main.cpp
+++ b/kwrite/main.cpp
@@ -51,18 +51,6 @@
extern "C" Q_DECL_EXPORT int main(int argc, char **argv)
{
-#ifndef Q_OS_WIN
- // Prohibit using sudo or kdesu (but allow using the root user directly)
- if (getuid() == 0) {
- if (!qEnvironmentVariableIsEmpty("SUDO_USER")) {
- std::cout << "Executing KWrite with sudo is not possible due to unfixable security vulnerabilities." << std::endl;
- return EXIT_FAILURE;
- } else if (!qEnvironmentVariableIsEmpty("KDESU_USER")) {
- std::cout << "Executing KWrite with kdesu is not possible due to unfixable security vulnerabilities." << std::endl;
- return EXIT_FAILURE;
- }
- }
-#endif
/**
* Create application first
Code: Select all
diff -Naur orig/src/dolphinviewcontainer.cpp patched/src/dolphinviewcontainer.cpp
--- orig/src/dolphinviewcontainer.cpp 2019-09-03 00:15:08.000000000 +0300
+++ patched/src/dolphinviewcontainer.cpp 2019-09-15 12:45:14.451444593 +0300
@@ -136,13 +136,6 @@
m_messageWidget->setCloseButtonVisible(true);
m_messageWidget->hide();
-#ifndef Q_OS_WIN
- if (getuid() == 0) {
-
- // We must be logged in as the root user; show a big scary warning
- showMessage(i18n("Running Dolphin as root can be dangerous. Please be careful."), Warning);
- }
-#endif
// Initialize filter bar
m_filterBar = new FilterBar(this);
diff -Naur orig/src/main.cpp patched/src/main.cpp
--- orig/src/main.cpp 2019-09-03 00:15:08.000000000 +0300
+++ patched/src/main.cpp 2019-09-15 12:43:55.923439868 +0300
@@ -46,19 +46,6 @@
extern "C" Q_DECL_EXPORT int kdemain(int argc, char **argv)
{
-#ifndef Q_OS_WIN
- // Prohibit using sudo or kdesu (but allow using the root user directly)
- if (getuid() == 0) {
- if (!qEnvironmentVariableIsEmpty("SUDO_USER")) {
- std::cout << "Executing Dolphin with sudo is not possible due to unfixable security vulnerabilities." << std::endl;
- return EXIT_FAILURE;
- } else if (!qEnvironmentVariableIsEmpty("KDESU_USER")) {
- std::cout << "Executing Dolphin with kdesu is not possible due to unfixable security vulnerabilities." << std::endl;
- return EXIT_FAILURE;
- }
- }
-#endif
-
QApplication app(argc, argv);
app.setAttribute(Qt::AA_UseHighDpiPixmaps, true);
app.setWindowIcon(QIcon::fromTheme(QStringLiteral("system-file-manager"), app.windowIcon()));
Code: Select all
wrc@gentoo-main ~ $ kdesu dolphin
wrc@gentoo-main ~ $ su
Password:
gentoo-main ~ # dolphin
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
kf5.kservice.services: The desktop entry file "/usr/share/applications/org.gnupg.pinentry-qt.desktop" has Type= "Application" but no Exec line
kf5.kservice.sycoca: Invalid Service : "/usr/share/applications/org.gnupg.pinentry-qt.desktop"
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
kf5.kio.kio_tags: tag fetch failed: "Failed to open the database"
kf5.kio.kio_tags: "tags:/" list() invalid url
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
kf5.kio.core: "Could not enter folder tags:/."
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
Qt: Session management error: networkIdsList argument is NULL
Code: Select all
--- a/src/dolphinviewcontainer.cpp
+++ b/src/dolphinviewcontainer.cpp
@@ -136,13 +136,6 @@
m_messageWidget->setCloseButtonVisible(true);
m_messageWidget->hide();
-#ifndef Q_OS_WIN
- if (getuid() == 0) {
-
- // We must be logged in as the root user; show a big scary warning
- showMessage(i18n("Running Dolphin as root can be dangerous. Please be careful."), Warning);
- }
-#endif
// Initialize filter bar
m_filterBar = new FilterBar(this);
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -46,19 +46,6 @@
extern "C" Q_DECL_EXPORT int kdemain(int argc, char **argv)
{
-#ifndef Q_OS_WIN
- // Prohibit using sudo or kdesu (but allow using the root user directly)
- if (getuid() == 0) {
- if (!qEnvironmentVariableIsEmpty("SUDO_USER")) {
- std::cout << "Executing Dolphin with sudo is not possible due to unfixable security vulnerabilities." << std::endl;
- return EXIT_FAILURE;
- } else if (!qEnvironmentVariableIsEmpty("KDESU_USER")) {
- std::cout << "Executing Dolphin with kdesu is not possible due to unfixable security vulnerabilities." << std::endl;
- return EXIT_FAILURE;
- }
- }
-#endif
-
/**
* enable high dpi support
*/
Code: Select all
unpacking source...
>>> Unpacking dolphin-19.12.0.tar.xz to /var/tmp/portage/kde-apps/dolphin-19.12.0/work
>>> Source unpacked in /var/tmp/portage/kde-apps/dolphin-19.12.0/work
>>> Preparing source in /var/tmp/portage/kde-apps/dolphin-19.12.0/work/dolphin-19.12.0 ...
* Applying dolphin-19.12.0-root.patch ...
* /etc/portage/patches/kde-apps/dolphin/dolphin-19.12.0-root.patch: patch failed to apply without a fuzz factor, please rebase
patching file src/dolphinviewcontainer.cpp
patching file src/main.cpp
Hunk #1 succeeded at 46 with fuzz 1. [ ok ]
* User patches applied.
>>> Source preparedCode: Select all
--- a/kate/main.cpp
+++ b/kate/main.cpp
@@ -45,24 +45,6 @@
int main(int argc, char **argv)
{
-#ifndef Q_OS_WIN
- // Prohibit using sudo or kdesu (but allow using the root user directly)
- if (getuid() == 0) {
- if (!qEnvironmentVariableIsEmpty("SUDO_USER")) {
- std::cout << "Executing Kate with sudo is not possible due to unfixable security vulnerabilities. "
- "It is also not necessary; simply use Kate normally, and you will be prompted for "
- "elevated privileges when saving documents if needed."
- << std::endl;
- return EXIT_FAILURE;
- } else if (!qEnvironmentVariableIsEmpty("KDESU_USER")) {
- std::cout << "Executing Kate with kdesu is not possible due to unfixable security vulnerabilities. "
- "It is also not necessary; simply use Kate normally, and you will be prompted for "
- "elevated privileges when saving documents if needed."
- << std::endl;
- return EXIT_FAILURE;
- }
- }
-#endif
/**
* init resources from our static lib
*/

Code: Select all
EDITOR=kate sudoedit
Code: Select all
david@localhost ~ $ /bin/su - root
Password:
localhost ~ # dbus-launch dolphinCode: Select all
david@localhost ~ $ sudo passwd
I understand that. I'm not finding fault with writing your own code. It does seem to me it could get to be a hassle applying patches to somebody else's code, especially if they keep moving things around. But most of my coding experience is on older hardware (IBM s/360, etc.), in assembly language. Maybe things are easier now.proteusx wrote:These patches are meant to revert certain changes upstream that broke Dolphin (as well as Kwrite and Kate) for some of us who used it for a long time it in a certain way. I know little about non-gentoo distros.

Code: Select all
$ pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY KDE_SESSION_VERSION=5 KDE_FULL_SESSION=true dolphinCode: Select all
$ pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY KDE_SESSION_VERSION=5 KDE_FULL_SESSION=true kateCode: Select all
$ pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY KDE_SESSION_VERSION=5 KDE_FULL_SESSION=true kwriteCode: Select all
$ tail -n 3 ~/.bashrc
alias dolroot="pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY KDE_SESSION_VERSION=5 KDE_FULL_SESSION=true dolphin"
alias kateroot="pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY KDE_SESSION_VERSION=5 KDE_FULL_SESSION=true kate"
alias kwriteroot="pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY KDE_SESSION_VERSION=5 KDE_FULL_SESSION=true kwrite"Code: Select all
$ dolroot
$ kateroot
$ kwriterootCode: Select all
#!/bin/bash
pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY KDE_SESSION_VERSION=5 KDE_FULL_SESSION=true dolphinCode: Select all
$ chmod 700 dolroot
$ chmod 700 kateroot
$ chmod 700 kwriteroot
$ ls -la *root
-rwx------ 1 fitzcarraldo fitzcarraldo 115 Jul 30 15:33 dolroot
-rwx------ 1 fitzcarraldo fitzcarraldo 112 Jul 30 15:34 kateroot
-rwx------ 1 fitzcarraldo fitzcarraldo 114 Jul 30 15:34 kwriterootCode: Select all
--- a/kate/main.cpp
+++ b/kate/main.cpp
@@ -45,24 +45,6 @@
int main(int argc, char **argv)
{
-#ifndef Q_OS_WIN
- // Prohibit using sudo or kdesu (but allow using the root user directly)
- if (getuid() == 0) {
- if (!qEnvironmentVariableIsEmpty("SUDO_USER")) {
- std::cout << "Executing Kate with sudo is not possible due to unfixable security vulnerabilities. "
- "It is also not necessary; simply use Kate normally, and you will be prompted for "
- "elevated privileges when saving documents if needed."
- << std::endl;
- return EXIT_FAILURE;
- } else if (!qEnvironmentVariableIsEmpty("KDESU_USER")) {
- std::cout << "Executing Kate with kdesu is not possible due to unfixable security vulnerabilities. "
- "It is also not necessary; simply use Kate normally, and you will be prompted for "
- "elevated privileges when saving documents if needed."
- << std::endl;
- return EXIT_FAILURE;
- }
- }
-#endif
/**
* init resources from our static lib
*/
--- a/kwrite/main.cpp
+++ b/kwrite/main.cpp
@@ -37,25 +37,6 @@
extern "C" Q_DECL_EXPORT int main(int argc, char **argv)
{
-#ifndef Q_OS_WIN
- // Prohibit using sudo or kdesu (but allow using the root user directly)
- if (getuid() == 0) {
- if (!qEnvironmentVariableIsEmpty("SUDO_USER")) {
- std::cout << "Executing KWrite with sudo is not possible due to unfixable security vulnerabilities. "
- "It is also not necessary; simply use KWrite normally, and you will be prompted for "
- "elevated privileges when saving documents if needed."
- << std::endl;
- return EXIT_FAILURE;
- } else if (!qEnvironmentVariableIsEmpty("KDESU_USER")) {
- std::cout << "Executing KWrite with kdesu is not possible due to unfixable security vulnerabilities. "
- "It is also not necessary; simply use KWrite normally, and you will be prompted for "
- "elevated privileges when saving documents if needed."
- << std::endl;
- return EXIT_FAILURE;
- }
- }
-#endif
-
/**
* enable high dpi support
*/Code: Select all
diff -Naur kate-21.08.0-orig/kate/main.cpp kate-21.08.0/kate/main.cpp
--- kate-21.08.0-orig/kate/main.cpp 2021-08-05 05:13:14.000000000 +0300
+++ kate-21.08.0/kate/main.cpp 2021-08-13 21:32:06.297158874 +0300
@@ -45,24 +45,6 @@
int main(int argc, char **argv)
{
-#if !defined(Q_OS_WIN) && !defined(Q_OS_HAIKU)
- // Prohibit using sudo or kdesu (but allow using the root user directly)
- if (getuid() == 0) {
- if (!qEnvironmentVariableIsEmpty("SUDO_USER")) {
- std::cout << "Executing Kate with sudo is not possible due to unfixable security vulnerabilities. "
- "It is also not necessary; simply use Kate normally, and you will be prompted for "
- "elevated privileges when saving documents if needed."
- << std::endl;
- return EXIT_FAILURE;
- } else if (!qEnvironmentVariableIsEmpty("KDESU_USER")) {
- std::cout << "Executing Kate with kdesu is not possible due to unfixable security vulnerabilities. "
- "It is also not necessary; simply use Kate normally, and you will be prompted for "
- "elevated privileges when saving documents if needed."
- << std::endl;
- return EXIT_FAILURE;
- }
- }
-#endif
/**
* init resources from our static lib
*/
diff -Naur kate-21.08.0-orig/kwrite/main.cpp kate-21.08.0/kwrite/main.cpp
--- kate-21.08.0-orig/kwrite/main.cpp 2021-08-05 05:13:14.000000000 +0300
+++ kate-21.08.0/kwrite/main.cpp 2021-08-13 21:32:44.912161356 +0300
@@ -37,25 +37,6 @@
extern "C" Q_DECL_EXPORT int main(int argc, char **argv)
{
-#if !defined(Q_OS_WIN) && !defined(Q_OS_HAIKU)
- // Prohibit using sudo or kdesu (but allow using the root user directly)
- if (getuid() == 0) {
- if (!qEnvironmentVariableIsEmpty("SUDO_USER")) {
- std::cout << "Executing KWrite with sudo is not possible due to unfixable security vulnerabilities. "
- "It is also not necessary; simply use KWrite normally, and you will be prompted for "
- "elevated privileges when saving documents if needed."
- << std::endl;
- return EXIT_FAILURE;
- } else if (!qEnvironmentVariableIsEmpty("KDESU_USER")) {
- std::cout << "Executing KWrite with kdesu is not possible due to unfixable security vulnerabilities. "
- "It is also not necessary; simply use KWrite normally, and you will be prompted for "
- "elevated privileges when saving documents if needed."
- << std::endl;
- return EXIT_FAILURE;
- }
- }
-#endif
-
/**
* enable high dpi support
*/Code: Select all
--- a/src/dolphinviewcontainer.cpp
+++ b/src/dolphinviewcontainer.cpp
@@ -87,14 +87,6 @@
m_messageWidget->setCloseButtonVisible(true);
m_messageWidget->hide();
-#ifndef Q_OS_WIN
- if (getuid() == 0) {
-
- // We must be logged in as the root user; show a big scary warning
- showMessage(i18n("Running Dolphin as root can be dangerous. Please be careful."), Warning);
- }
-#endif
-
// Initialize filter bar
m_filterBar = new FilterBar(this);
m_filterBar->setVisible(GeneralSettings::filterBar());
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -40,25 +40,6 @@
int main(int argc, char **argv)
{
-#ifndef Q_OS_WIN
- // Prohibit using sudo or kdesu (but allow using the root user directly)
- if (getuid() == 0) {
- if (!qEnvironmentVariableIsEmpty("SUDO_USER")) {
- std::cout << "Running Dolphin with sudo can cause bugs and expose you to security vulnerabilities. "
- "Instead use Dolphin normally and you will be prompted for elevated privileges when "
- "performing file operations that require them."
- << std::endl;
- return EXIT_FAILURE;
- } else if (!qEnvironmentVariableIsEmpty("KDESU_USER")) {
- std::cout << "Running Dolphin with kdesu can cause bugs and expose you to security vulnerabilities. "
- "Instead use Dolphin normally and you will be prompted for elevated privileges when "
- "performing file operations that require them."
- << std::endl;
- return EXIT_FAILURE;
- }
- }
-#endif
-
/**
* enable high dpi support
*/
Code: Select all
--- a/kate/main.cpp
+++ b/kate/main.cpp
@@ -46,24 +46,6 @@
int main(int argc, char **argv)
{
-#if !defined(Q_OS_WIN) && !defined(Q_OS_HAIKU)
- // Prohibit using sudo or kdesu (but allow using the root user directly)
- if (getuid() == 0) {
- if (!qEnvironmentVariableIsEmpty("SUDO_USER")) {
- std::cout << "Running Kate with sudo can cause bugs and expose you to security vulnerabilities. "
- "Instead use Kate normally and you will be prompted for elevated privileges when "
- "saving documents if needed."
- << std::endl;
- return EXIT_FAILURE;
- } else if (!qEnvironmentVariableIsEmpty("KDESU_USER")) {
- std::cout << "Running Kate with kdesu can cause bugs and expose you to security vulnerabilities. "
- "Instead use Kate normally and you will be prompted for elevated privileges when "
- "saving documents if needed."
- << std::endl;
- return EXIT_FAILURE;
- }
- }
-#endif
/**
* init resources from our static lib
*/
--- a/kwrite/main.cpp
+++ b/kwrite/main.cpp
@@ -38,25 +38,6 @@
extern "C" Q_DECL_EXPORT int main(int argc, char **argv)
{
-#if !defined(Q_OS_WIN) && !defined(Q_OS_HAIKU)
- // Prohibit using sudo or kdesu (but allow using the root user directly)
- if (getuid() == 0) {
- if (!qEnvironmentVariableIsEmpty("SUDO_USER")) {
- std::cout << "Running KWrite with sudo can cause bugs and expose you to security vulnerabilities. "
- "Instead use KWrite normally and you will be prompted for elevated privileges when "
- "saving documents if needed."
- << std::endl;
- return EXIT_FAILURE;
- } else if (!qEnvironmentVariableIsEmpty("KDESU_USER")) {
- std::cout << "Running KWrite with kdesu can cause bugs and expose you to security vulnerabilities. "
- "Instead use KWrite normally and you will be prompted for elevated privileges when "
- "saving documents if needed."
- << std::endl;
- return EXIT_FAILURE;
- }
- }
-#endif
-
/**
* enable high dpi support
*/