Bug 486582 - Konsole start new sessions from previous folder ignores symlinks
Summary: Konsole start new sessions from previous folder ignores symlinks
Status: REPORTED
Alias: None
Product: konsole
Classification: Applications
Component: general (show other bugs)
Version: 24.02.2
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-05-04 16:07 UTC by Ty Smith
Modified: 2024-08-28 02:41 UTC (History)
2 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 Ty Smith 2024-05-04 16:07:56 UTC
SUMMARY

I'm using an Atomic Distro (Kinoite 40) that symlinks /home to /var/home

STEPS TO REPRODUCE
1.  Enable "Start in same directory as current session" for session to test
2. run `cd ~`
3. run `pwd` and verify location is /home/USER
3. Click new tab

OBSERVED RESULT
New session is in /var/home/USER, also tab title in /var/home/USER

EXPECTED RESULT
New session should be in /var/USER, which tab titles should be ~


SOFTWARE/OS VERSIONS
Linux Distro: Fedora Kinoite 40
KDE Plasma Version: 6.0.4
KDE Frameworks Version: 6.1.0 
Qt Version: 6.7.0
Comment 1 Timothée Ravier 2024-05-05 12:40:54 UTC
This looks a lot like https://pagure.io/fedora-kde/SIG/issue/159 and is not a bug in Konsole.

Is this only for the home folder or any other symlinks?
Comment 2 Ty Smith 2024-05-05 15:42:52 UTC
tested this with another symlink (limited to root folders to test in becaues of atomic distro)


sudo mkdir /var/test
ln -s /var/test /home/USER/test
cd /home/USER/test
title currently shows ~/test
click new tab
title, prompt, and pwd show /var/test


Also verified that $HOME is set to /home/USER
Comment 3 Timothée Ravier 2024-05-06 15:21:14 UTC
Home directories are in `/var/home/foo` on Fedora Kinoite.

Can you try editing the `/etc/passwd` entry for your user and setting its home dir to `/var/home/foo`?
Comment 4 Ty Smith 2024-05-06 16:06:14 UTC
"Home directories are in `/var/home/foo` on Fedora Kinoite."

This is true, but it also symlinks to /home/foo automatically since most things expect that. It even defaults to setting users home to the symlink in /etc/passwd.  

"Can you try editing the `/etc/passwd` entry for your user and setting its home dir to `/var/home/foo`?"
I did try this with a user that home it set to /var/*, saw no difference in the behavior of the Konsole issue reported.

When you select "start in current directory" in profiles, it goes to to source folder, not to the symlink the user was in when they initated the flow. Have tested outside of home altogether. ie, /var/test -> /etc/test
Comment 5 Jonathan S 2024-08-27 22:44:57 UTC
I've found this bug ticket while searching for existing tickets for something similar that I have observed on Fedora Kinoite 40.

My home directory in /etc/passwd and $HOME are both set to "/home/jonathan", but when I launch Konsole, the initial directory is /var/home/jonathan with a prompt of:

jonathan@xps:/var/home/jonathan$

If I do a "cd ~", it changes my present working directory to /home/jonathan and the prompt shows:

jonathan@xps:~$ 

If I switch to a TTY console and log in, my initial directory is /home/jonathan and the prompt is:

jonathan@xps:~$

Interestingly, if I go into the configuration of my Konsole profile, the "Initial directory" has "/home/jonathan" in a placeholder text light grey font (presumably loaded from /etc/passwd or $HOME ?), but if I click in there and replace this placeholder text with the same value of "home/jonathan" and relaunch Konsole, my initial directory works as expected (ie. it is /home/jonathan and the prompt is "jonathan@xps:~$").

So, it seems that Konsole is not handling the default value of "Initial directory" until it is explicitly set (to the same value).

Apologies if this isn't the same issue as described in the bug report!
Comment 6 Jonathan S 2024-08-28 02:41:56 UTC
Please ignore my previous comment. I misread the linked Fedora KDE SIG bug.