Hello community,

here is the log from the commit of package konsole for openSUSE:Factory checked 
in at 2017-01-31 12:16:10
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/konsole (Old)
 and      /work/SRC/openSUSE:Factory/.konsole.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "konsole"

Changes:
--------
--- /work/SRC/openSUSE:Factory/konsole/konsole.changes  2017-01-25 
23:01:00.484930382 +0100
+++ /work/SRC/openSUSE:Factory/.konsole.new/konsole.changes     2017-02-03 
17:45:51.995355928 +0100
@@ -1,0 +2,6 @@
+Fri Jan 27 16:04:59 UTC 2017 - [email protected]
+
+- Add Pre-process-e-custom-command-argument.patch to restore proper
+  handling of the -e command line option (boo#1018087, kde#366793)
+
+-------------------------------------------------------------------

New:
----
  Pre-process-e-custom-command-argument.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ konsole.spec ++++++
--- /var/tmp/diff_new_pack.SCEjbk/_old  2017-02-03 17:45:52.891229122 +0100
+++ /var/tmp/diff_new_pack.SCEjbk/_new  2017-02-03 17:45:52.891229122 +0100
@@ -35,6 +35,8 @@
 Source24:       utilities-terminal-su-48.png
 Source25:       utilities-terminal-su-64.png
 Source26:       utilities-terminal-su-128.png
+# PATCH-FIX-UPSTREAM Pre-process-e-custom-command-argument.patch boo#1018087, 
kde#366793 -- Special case parsing of -e, to avoid parsing parameters intended 
for the command to be executed.
+Patch:          Pre-process-e-custom-command-argument.patch
 BuildRequires:  fdupes
 BuildRequires:  kbookmarks-devel
 BuildRequires:  kcompletion-devel
@@ -86,6 +88,7 @@
 
 %prep
 %setup -q
+%patch -p1
 
 %build
   %cmake_kf5 -d build

++++++ Pre-process-e-custom-command-argument.patch ++++++
>From a779c8314a7d27bb4691c220f793540e6f84f6c9 Mon Sep 17 00:00:00 2001
From: Maximiliano Curia <[email protected]>
Date: Mon, 19 Dec 2016 22:26:46 +0100
Subject: Pre process the -e custom command argument

Special case parsing of -e, to avoid parsing parameters intended for the
command to be executed.

REVIEW: 129677
---
 src/Application.cpp | 39 ++++++++++++++++++++++++++-------------
 src/Application.h   |  4 +++-
 src/main.cpp        |  8 ++++++--
 3 files changed, 35 insertions(+), 16 deletions(-)

diff --git a/src/Application.cpp b/src/Application.cpp
index 6651fe7..6e8e1ee 100644
--- a/src/Application.cpp
+++ b/src/Application.cpp
@@ -45,7 +45,7 @@
 
 using namespace Konsole;
 
-Application::Application(QSharedPointer<QCommandLineParser> parser) : 
m_parser(parser)
+Application::Application(QSharedPointer<QCommandLineParser> parser, const 
QStringList &customCommand) : m_parser(parser), m_customCommand(customCommand)
 {
     _backgroundInstance = 0;
 }
@@ -115,6 +115,22 @@ void 
Application::populateCommandLineParser(QCommandLineParser *parser)
     parser->addOption(titleOption);
 }
 
+QStringList Application::getCustomCommand(QStringList &args)
+{
+    int i = args.indexOf("-e");
+    QStringList customCommand;
+    if ((0 < i) && (i < (args.size() - 1))) {
+        // -e was specified with at least one extra argument
+        // if -e was specified without arguments, QCommandLineParser will deal
+        // with that
+        args.removeAt(i);
+        while (args.size() > i) {
+            customCommand << args.takeAt(i);
+        }
+    }
+    return customCommand;
+}
+
 Application::~Application()
 {
     SessionManager::instance()->closeAllSessions();
@@ -479,21 +495,16 @@ Profile::Ptr 
Application::processProfileChangeArgs(Profile::Ptr baseProfile)
     }
 
     // run a custom command
-    if (m_parser->isSet(QStringLiteral("e"))) {
-        QString commandExec = m_parser->value(QStringLiteral("e"));
-        QStringList commandArguments;
-
-        if (m_parser->positionalArguments().count() == 0 &&
-            QStandardPaths::findExecutable(commandExec).isEmpty()) {
+    if (!m_customCommand.isEmpty()) {
+        // Example: konsole -e man ls
+        QString commandExec = m_customCommand[0];
+        QStringList commandArguments(m_customCommand);
+        if ((m_customCommand.size() == 1) &&
+            (QStandardPaths::findExecutable(commandExec).isEmpty())) {
             // Example: konsole -e "man ls"
-            ShellCommand shellCommand(m_parser->value(QStringLiteral("e")));
+            ShellCommand shellCommand(commandExec);
             commandExec = shellCommand.command();
             commandArguments = shellCommand.arguments();
-        } else {
-            // Example: konsole -e man ls
-            commandArguments << commandExec;
-            for ( int i = 0 ; i < m_parser->positionalArguments().count() ; 
i++ )
-                commandArguments << m_parser->positionalArguments().at(i);
         }
 
         if (commandExec.startsWith(QLatin1String("./")))
@@ -551,6 +562,8 @@ void Application::slotActivateRequested (QStringList args, 
const QString & /*wor
     // In the current version it just strips it away
     args.prepend(qApp->applicationFilePath());
 
+    m_customCommand = getCustomCommand(args);
+
     // We can't re-use QCommandLineParser instances, it preserves earlier 
parsed values
     QCommandLineParser *parser = new QCommandLineParser;
     populateCommandLineParser(parser);
diff --git a/src/Application.h b/src/Application.h
index 8987d78..8ec7ab6 100644
--- a/src/Application.h
+++ b/src/Application.h
@@ -50,9 +50,10 @@ class Application : public QObject
 
 public:
     /** Constructs a new Konsole application. */
-    explicit Application(QSharedPointer<QCommandLineParser> parser);
+    explicit Application(QSharedPointer<QCommandLineParser> parser, const 
QStringList &customCommand);
 
     static void populateCommandLineParser(QCommandLineParser *parser);
+    static QStringList getCustomCommand(QStringList &args);
 
     ~Application();
 
@@ -89,6 +90,7 @@ private:
 
     MainWindow* _backgroundInstance;
     QSharedPointer<QCommandLineParser> m_parser;
+    QStringList m_customCommand;
 };
 }
 #endif  // APPLICATION_H
diff --git a/src/main.cpp b/src/main.cpp
index f4bb5af..fb53560 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -112,9 +112,13 @@ extern "C" int Q_DECL_EXPORT kdemain(int argc, char* 
argv[])
     parser->addHelpOption();
     parser->addVersionOption();
     about.setupCommandLine(parser.data());
+
+    QStringList args = QStringList(app->arguments());
+    QStringList customCommand = Application::getCustomCommand(args);
+
     Application::populateCommandLineParser(parser.data());
 
-    parser->process(*app);
+    parser->process(args);
     about.processCommandLine(parser.data());
 
     // Enable user to force multiple instances
@@ -158,7 +162,7 @@ extern "C" int Q_DECL_EXPORT kdemain(int argc, char* argv[])
 
     // If we reach this location, there was no existing copy of Konsole
     // running, so create a new instance.
-    Application konsoleApp(parser);
+    Application konsoleApp(parser, customCommand);
 
     // The activateRequested() signal is emitted when a second instance
     // of Konsole is started.
-- 
cgit v0.11.2








Reply via email to