Bug 192212 - konsole -e doesn't start a profile
Summary: konsole -e doesn't start a profile
Status: RESOLVED NOT A BUG
Alias: None
Product: konsole
Classification: Applications
Component: general (show other bugs)
Version: 2.2.3
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-05-10 12:14 UTC by Daniel
Modified: 2017-02-13 18:37 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel 2009-05-10 12:14:27 UTC
Version:           2.2.3 (using Devel)
OS:                Linux
Installed from:    Compiled sources

When starting Konsole with the `konsole` command, without any options, it starts the default profile (in my case "Shell"), which is an expected behavior.
When starting Konsole with the '-e' option eg.:
`konsole -e /bin/sh -l`, it seems it doesn't start a profile, but just loads the default profile's options, and then stays in an ambiguous state:
1. execute: konsole -e /bin/sh -l
2. Edit Current Profile
3. The Profile Name is missing
3a. Changes to any konsole configuration option won't get saved to the default profile.

Passing the --profile option along with the '-e' doesn't help either.
Konsole should always start the default profile, when no --profile option is specified, furthermore, Konsole should respect the --profile option when used in conjunction with the '-e' parameter.
Comment 1 Kurt Hindenburg 2011-09-14 03:28:53 UTC
Git commit 35fae00159372bb332de54edba3a0cbbc22855f6 by Kurt Hindenburg.
Committed on 14/09/2011 at 05:26.
Pushed by hindenburg into branch 'master'.

When using -e <command> don't save to profile for new tabs.

    Currently using -e <command> will cause all new tabs/windows to run
    <command>.  This patch fixes that such that new tabs/windows will start
    the default profile.

    Patch by Gu Rui <chaos.proton@gmail.com> with minor edit by self.
    FIXED-IN: 4.8
    REVIEW: 102602
    CCBUG: 192212

M  +21   -16   src/Application.cpp

http://commits.kde.org/konsole/35fae00159372bb332de54edba3a0cbbc22855f6
Comment 2 Duncan 2012-07-04 15:16:02 UTC
I just upgraded from KDE 4.6 to 4.8 and discovered this change in behaviour.  IMHO the old "bug" was a powerful feature - at least one I used a lot.  I have scripts and URI handlers run "konsole -e ssh <somehost>" and similar many many times a day and rely on double-click-for-new-tab opening another similar session to speed up my workflow.

Is there an option which gives the old behaviour (run the specified commad every time I open a new tab)?  If not, please could there be?  I tried to get the same effect with konsole -p "command=<foo>" but haven't figured out whether that works yet.
Comment 3 Duncan 2012-07-04 16:03:35 UTC
(In reply to comment #2)

For the benefit of anyone stumbling upon this, my workaround is to have the script launching konsole write the command previously passed as the value of -e to a temporary script, then pass -p command=/tmp/<mytmpscript>

Obviously this is not ideal because it litters /tmp with these subscripts.  Perhaps there is a bug in the handling of -p command=<something fairly long>?
Comment 4 Jekyll Wu 2012-07-04 16:09:09 UTC
Konsole shipped in KDE SC 4.9 has a dedicated action: "Clone Tab". 

For KDE SC 4.8, I don't think there is good workaround. If there is, that probably implies the code is buggy and inconsistent.
Comment 5 Duncan 2012-07-05 11:31:06 UTC
On 4 July 2012 17:09, Jekyll Wu <adaptee@gmail.com> wrote:

JW> Konsole shipped in KDE SC 4.9 has a dedicated action: "Clone Tab".

Is there/could there be an option to make that the action performed by
double-clicking on the empty part of the tab bar?

JW> For KDE SC 4.8, I don't think there is good workaround. If there
JW> is, that probably implies the code is buggy and inconsistent.

It does seem to be inconsistent - at least in 2.8.4 as shipped in Debian
unstable.  If I create a profile with

  Command=ssh -i /home/myuser/.ssh/mykey remoteuser@remotehost

and invoke

  konsole --profile=MyCustomProfile

I get the behaviour I want - ie the old behaviour of

  konsole -e ssh -i /home/myuser/.ssh/mykey remoteuser@remotehost

But if I try to shortcut this by invoking one of

  konsole -p Command='ssh -i /home/myuser/.ssh/mykey remoteuser@remotehost'
  konsole -p 'Command=ssh -i /home/myuser/.ssh/mykey remoteuser@remotehost'

I get

  Warning: Could not find '/bin/ssh -i /home/myuser/.ssh/mykey
remoteuser@remotehos', starting '/bin/bash' instead.  Please check
your profile settings.

which just means $PATH is wrong.  But something of the form

  konsole -p 'Command=/usr/bin/ssh -i /home/myuser/.ssh/mykey
remoteuser@remotehost'

opens a window which shuts immediately.  strace reveals we're getting a
usage message back from ssh, and -p 'Command=/bin/bash -c ...' just runs
bash.  So I think maybe "konsole -p 'Command=foo fooargs'" is dropping
fooargs on the floor.

I notice KDE4ProfileReader::readProfile handles the Command property
read from a file much like Application::processProfileChangeArgs handles
-e, using ShellCommand to get the binary name and its args.  However
Application::createTabFromArgs handles "-p Command=..." differently:

    const QString& command = tokens["command"];
...
    if (!command.isEmpty()) {
        newProfile->setProperty(Profile::Command,   command);
        newProfile->setProperty(Profile::Arguments, command.split(' '));
        shouldUseNewProfile = true;
    }

which looks dodgy to me.

I also get the feeling very few of the properties returned by

  konsole --list-profile-properties

can actually be set with konsole -p.  "Arguments" in particular.


I don't currently have a build environment for KDE, but if I get time to
create one, I'll see if I can test the git master version.


Cheers


Duncan
Comment 6 Jekyll Wu 2012-07-05 13:30:26 UTC
The konsole shipped in debian sid is patched. The debian maintainer decides to revert one related commit after talking with me on this issure a few days ago on #kde-devel .  Just run "apt-get source konsole" to check the debian patch.
Comment 7 Adam Hunt 2015-10-07 18:14:12 UTC
Bug related to downstream package modification.

Recommend close INVALID
Comment 8 Adam Hunt 2015-10-07 18:14:23 UTC
Bug related to downstream package modification.

Recommend close INVALID