[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    [PATCH] kstart mishandles arguments that should be passed to the
From:       Rudo Thomas <rudo () matfyz ! cz>
Date:       2005-01-29 18:49:41
Message-ID: 20050129184941.GB4394 () ss1000 ! ms ! mff ! cuni ! cz
[Download RAW message or body]

Hello, everyone.

Simply put, kstart lets the shell reparse the arguments that should not
be touched, but rather passed directly to the started program. Both 3.3.
and 3.4b1 are affected. 
 
See comment in kdebase/kstart/kstart.cpp, line ~325.

The bug is filed, #98160 http://bugs.kde.org/show_bug.cgi?id=98160 .

Please, review the attached patch and consider applying it to the 3.4
branch. And maybe to the stable one? ;-)

Thank you and have a pleasant day.

Rudo Thomas.

["kstart_dont_reparse_arguments.patch" (text/plain)]

diff -ur kdebase-3.3.2-orig/kstart/kstart.cpp kdebase-3.3.2/kstart/kstart.cpp
--- kdebase-3.3.2-orig/kstart/kstart.cpp	2004-11-28 18:27:29.000000000 +0100
+++ kdebase-3.3.2/kstart/kstart.cpp	2005-01-29 18:34:42.090138648 +0100
@@ -29,19 +29,10 @@
 
 #include <netwm.h>
 
-pid_t execute(const QCString & cmd){
-  KProcess proc;
-  proc.setUseShell(true);
-  proc << cmd;
-  if(proc.start(KProcess::DontCare))
-      return proc.pid();
-  return -1;
-}
-
 
 // some globals
 
-static QCString command = 0;
+static KProcess proc;
 static QCString windowtitle = 0;
 static QCString windowclass = 0;
 static int desktop = 0;
@@ -74,16 +65,11 @@
     id.setupStartupEnv();
 
     //finally execute the comand
-    pid_t pid = execute(command);
-
-    if( pid >= 0 ) {
+    if( proc.start(KProcess::DontCare) ) {
         KStartupInfoData data;
-        data.addPid( pid );
-        data.setName( command );
-        QCString bin = command;
-        int space = bin.find( ' ' ); // try to get the name of the binary
-        if( space != -1 )
-            bin = bin.left( space );
+        data.addPid( proc.pid() );
+        QCString bin = proc.args().first();
+        data.setName( bin );
         data.setBin( bin.mid( bin.findRev( '/' ) + 1 ));
         KStartupInfo::sendChange( id, data );
     }
@@ -322,9 +308,8 @@
   if ( args->count() == 0 )
       KCmdLineArgs::usage(i18n("No command specified"));
 
-  // Perhaps we should use a konsole-like solution here (shell, list of args...)
   for(int i=0; i < args->count(); i++)
-      command += QCString(args->arg(i)) + " ";
+    proc << args->arg(i);
 
   kwinmodule = new KWinModule;
 


>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic