Bug 187754 - Konsole does not set initial working directory from cwd
Summary: Konsole does not set initial working directory from cwd
Status: RESOLVED FIXED
Alias: None
Product: konsole
Classification: Applications
Component: general (show other bugs)
Version: 2.2.2
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-03-21 01:23 UTC by Johnny Levai
Modified: 2012-04-10 16:38 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.9.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Johnny Levai 2009-03-21 01:23:19 UTC
Version:           2.2.2 (using 4.2.1 (KDE 4.2.1) "release 104", KDE:KDE4:Factory:Desktop / openSUSE_11.1)
Compiler:          gcc
OS:                Linux (i686) release 2.6.27.19-3.2-pae

I have KDE 3.5.10 installed alongside KDE 4.2.1, so I could verify if the problem is truly with the new Konsole.
I use NetBeans 6.5 for developing C++ applications. When I run an application, NetBeans starts a local emulator and passes the compiled application's relative path and name. The problem is, that Konsole 2.2.2 always starts with ~ as an initial working directory and I get a File not found error.
If I log into KDE 3.5.10, running my C++ applications from NetBeans works just fine.
The problem can be reproduced even without NetBeans. 
Open your KDE4 Konsole and "cd Desktop". Start the KDE3 Konsole from there. Notice that the cwd will be set to ~/Desktop, as expected.
Now open your KDE3 Konsole and "cd Desktop". Then start the KDE4 Konsole from there. Notice that the cwd will still be set to ~. That's what makes NetBeans 6.5 C++ unusable under KDE 4.2. 
I payed some attention to the KDE3 Konsole and I could find things like:

KURL Konsole::baseURL() const
{
   KURL url;
   url.setPath(se->getCwd()+"/");
   return url;
}
 
I could really find cwd related settings in the KDE4 Konsole's source code. 
Is this a missing feature or a bug?
Comment 1 Daniel Hahler 2010-05-30 03:08:18 UTC
Confirmed in Konsole 2.4.3.

However, you could workaround this using the "--workdir" switch.
Comment 2 Jekyll Wu 2012-04-10 16:38:56 UTC
Git commit ebcab3c307f83ddf42a9096b8a76a5389ce52f3d by Jekyll Wu.
Committed on 09/04/2012 at 07:53.
Pushed by jekyllwu into branch 'master'.

Use $PWD as the fallback value for setting initial working directory

This means running "konsole" literally in a terminal will open a konsole
which starts in the same directory as the current terminal. "konsole
--workdir ." is no more needed. This makes Konsole behave like most
other emulators.

Another befinit is it is now easier to use konsole for the "Open
terminal here" feature provided in file managers other than dolphin.
Note: due to the "single process" model of konsole, konsole sometimes
does not open the expected the direcotory when used by this "Open
terminal here" feature.

REVIEW: 104518
FIXED-IN: 4.9.0

M  +6    -3    src/Session.cpp

http://commits.kde.org/konsole/ebcab3c307f83ddf42a9096b8a76a5389ce52f3d