<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.kde.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>102941</bug_id>
          
          <creation_ts>2005-03-31 16:23:51 +0000</creation_ts>
          <short_desc>User created sessions with &quot;~&quot; (like &quot;~/somescript&quot;) in execute field or error in command doesn&apos;t appear in menu</short_desc>
          <delta_ts>2005-04-01 18:53:19 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>2</classification_id>
          <classification>Applications</classification>
          <product>konsole</product>
          <component>general</component>
          <version>unspecified</version>
          <rep_platform>Compiled Sources</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>NOR</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Dmitriy Ulupov">dima</reporter>
          <assigned_to name="Konsole Bugs">konsole-bugs-null</assigned_to>
          
          
          <cf_commitlink></cf_commitlink>
          <cf_versionfixedin></cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>0</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>330416</commentid>
    <comment_count>0</comment_count>
    <who name="Dmitriy Ulupov">dima</who>
    <bug_when>2005-03-31 16:23:51 +0000</bug_when>
    <thetext>Version:            (using KDE KDE 3.4.0)
Installed from:    Compiled From Sources
Compiler:          gcc version 3.3.3 20040412 (Red Hat Linux 3.3.3-7) 
OS:                Linux

Starting Konsole.
Opening Settings -&gt; Configure Konsole.

Go to &quot;Session&quot; tab.

Enter any Name.
Fill &quot;Execute&quot; field like that:

~/tools/open_ssh_to_smth

OR

any_error_command

Click on Save Session.
Click Ok.

Close Konsole.
Open it.

And your new session silently ignored.
It doesn&apos;t appear in &quot;Session&quot; menu.

I thing there are two problems.

1) Konsole can&apos;t understand &quot;~&quot; in execute field.
2) Konsole silently ignores errors in &quot;Execute&quot; field.

There must be some check about &quot;execute&quot; field contents.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>330425</commentid>
    <comment_count>1</comment_count>
    <who name="Dmitriy Ulupov">dima</who>
    <bug_when>2005-03-31 16:40:05 +0000</bug_when>
    <thetext>And some more.

If I save new session with name &quot;123&quot;, with &quot;~/tools/connect&quot; in execute field and start Konsole with a command:

konsole --type 123

... everything works! It opens new session 123 and executes ~/tools/connect
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>330521</commentid>
    <comment_count>2</comment_count>
    <who name="Kurt Hindenburg">khindenburg</who>
    <bug_when>2005-04-01 00:59:14 +0000</bug_when>
    <thetext>Yes and yes... thanks for the info.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>330554</commentid>
    <comment_count>3</comment_count>
    <who name="Kurt Hindenburg">khindenburg</who>
    <bug_when>2005-04-01 03:56:48 +0000</bug_when>
    <thetext>This has been fixed...

Replace ~ with homeDirPath in Session&apos;s Exec entries.

BUG: 102941


  M +1 -1      konsole.cpp   1.526


--- kdebase/konsole/konsole/konsole.cpp  #1.525:1.526
@@ -3069,4 +3068,5 @@ void Konsole::addSessionCommand(const QS
   }
 
+  exec = exec.replace( &quot;~&quot;, QDir::homeDirPath() );
   exec = KRun::binaryName(exec, false);
   QString pexec = KGlobal::dirs()-&gt;findExe(exec);
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>330556</commentid>
    <comment_count>4</comment_count>
    <who name="Thiago Macieira">thiago</who>
    <bug_when>2005-04-01 04:05:32 +0000</bug_when>
    <thetext>Hmm... that doesn&apos;t look right.

~ alone is $HOME
but ~thiago should point to thiago&apos;s HOME. In other words:

$ echo ~
/home/thiago
$ echo ~thiago
/home/thiago

but:
$ echo \~ | sed &quot;s,~,$HOME,&quot;
/home/thiago
$ echo \~thiago | sed &quot;s,~,$HOME,&quot;
/home/thiagothiago
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>330571</commentid>
    <comment_count>5</comment_count>
    <who name="Kurt Hindenburg">khindenburg</who>
    <bug_when>2005-04-01 06:43:57 +0000</bug_when>
    <thetext>Well, something is wrong with using BUGS: and CCMAIL in CVS commits tonight:

CVS commit by hindenburg: 

Try this again... expand ~ in Exec=~/script
Qt/KDE needs a function for this.

CCBUGS: 102941


  M +13 -2     konsole.cpp   1.527


--- kdebase/konsole/konsole/konsole.cpp  #1.526:1.527
@@ -3068,7 +3068,18 @@ void Konsole::addSessionCommand(const QS
   }
 
-  exec = exec.replace( &quot;~&quot;, QDir::homeDirPath() );
   exec = KRun::binaryName(exec, false);
+
+  if ( exec.startsWith( &quot;~/&quot; ) ) {        // ~/script
+    exec = exec.remove( 0, 1 );      // ~
+    exec = exec.prepend( QDir::homeDirPath() );
+  } else if ( exec.startsWith( &quot;~&quot; ) ) {  // ~user/script
+      // FIXME: What do when ~user != ~ ?
+      // We could check that user == current user... blah!
+    kdWarning()&lt;&lt;&quot;Unable to handle Exec=~user/ (use ~/ or full path): &quot;&lt;&lt;exec&lt;&lt;&quot; in &quot;&lt;&lt;path.latin1()&lt;&lt;endl;
+    return;    // ignore
+  }
+
   QString pexec = KGlobal::dirs()-&gt;findExe(exec);
+
   if (typ.isEmpty() || txt.isEmpty() || typ != &quot;KonsoleApplication&quot;
       || ( !exec.isEmpty() &amp;&amp; pexec.isEmpty() ) )
@@ -3076,6 +3087,6 @@ void Konsole::addSessionCommand(const QS
     if (!path.isEmpty())
        delete co;
+    kdWarning()&lt;&lt;&quot;Unable to use &quot;&lt;&lt;path.latin1()&lt;&lt;endl;
     return; // ignore
-
   }</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>330638</commentid>
    <comment_count>6</comment_count>
    <who name="Dirk Mueller">mueller</who>
    <bug_when>2005-04-01 12:08:49 +0000</bug_when>
    <thetext>test - ignore
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>330772</commentid>
    <comment_count>7</comment_count>
    <who name="Kurt Hindenburg">khindenburg</who>
    <bug_when>2005-04-01 18:53:18 +0000</bug_when>
    <thetext>CVS commit by hindenburg: 

Use KShell::tildeExpand (thanks ossi).

CCBUGS: 102941


  M +2 -11     konsole.cpp   1.528


--- kdebase/konsole/konsole/konsole.cpp  #1.527:1.528
@@ -109,4 +109,5 @@ Time to start a requirement list.
 
 #include &lt;kaction.h&gt;
+#include &lt;kshell.h&gt;
 #include &lt;qlabel.h&gt;
 #include &lt;kpopupmenu.h&gt;
@@ -3069,15 +3070,5 @@ void Konsole::addSessionCommand(const QS
 
   exec = KRun::binaryName(exec, false);
-
-  if ( exec.startsWith( &quot;~/&quot; ) ) {        // ~/script
-    exec = exec.remove( 0, 1 );      // ~
-    exec = exec.prepend( QDir::homeDirPath() );
-  } else if ( exec.startsWith( &quot;~&quot; ) ) {  // ~user/script
-      // FIXME: What do when ~user != ~ ?
-      // We could check that user == current user... blah!
-    kdWarning()&lt;&lt;&quot;Unable to handle Exec=~user/ (use ~/ or full path): &quot;&lt;&lt;exec&lt;&lt;&quot; in &quot;&lt;&lt;path.latin1()&lt;&lt;endl;
-    return;    // ignore
-  }
-
+  exec = KShell::tildeExpand(exec);
   QString pexec = KGlobal::dirs()-&gt;findExe(exec);
 
</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>