Summary: | OSC 7 stopped working to preserve path when creating a new tab | ||
---|---|---|---|
Product: | [Applications] konsole | Reporter: | Gabriel Marcano <gabemarcano> |
Component: | emulation | Assignee: | Konsole Developer <konsole-devel> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | gabemarcano, nate |
Priority: | NOR | Keywords: | regression |
Version: | 22.08.0 | ||
Target Milestone: | --- | ||
Platform: | Gentoo Packages | ||
OS: | Linux | ||
Latest Commit: | https://invent.kde.org/utilities/konsole/commit/252eab8537d8274ed32cb0a008f5d6ce9109908f | Version Fixed In: | 22.08.3 |
Sentry Crash Report: | |||
Attachments: | List of packages updated today |
used to work in 22.04 - doesn't in 22.08 bisect says it is this https://invent.kde.org/utilities/konsole/-/commit/5b5fdb0e32793f5888e3fb915501b07fa80f739a A possibly relevant merge request was started @ https://invent.kde.org/utilities/konsole/-/merge_requests/758 I can confirm that the changes at https://invent.kde.org/utilities/konsole/-/merge_requests/758 do fix the problem for me. To make sure the problem is still on the current release, I tried reproducing the problem without the patch, and I can confirm it is still happening. Applying the patch from the PR makes is such that I cannot reproduce the bug. So, at least from what I can see, it looks like once the PR is merged, this bug report can be closed. Thanks! Git commit 252eab8537d8274ed32cb0a008f5d6ce9109908f by Harald Sitter. Committed on 21/10/2022 at 15:17. Pushed by hindenburg into branch 'release/22.08'. don't lose environment variables the resetting was nonesense, Pty appends _environment on top of the existing environment, so concat the two for potential sandboxing (the ksandbox class will only apply the diff to system environment anyway). once the sandboxing was applied reset the actual process environment to the original variable rather than emptying it, this prevents us from losing variables when outside a sandbox M +3 -3 src/session/Session.cpp https://invent.kde.org/utilities/konsole/commit/252eab8537d8274ed32cb0a008f5d6ce9109908f |
Created attachment 151752 [details] List of packages updated today SUMMARY This may not be a Konsole problem, but I have not been able to track down where the problem originates (it's either in Qt or in KDE dependencies of Konsole or Konsole itself). I have the following on my .bashrc: _osc7 () { printf "\033]7;file://%s%s\033\\" "$HOSTNAME" $(pwd) } PROMPT_COMMAND=_osc7 With this, I was able to create new tabs when in symlinked folders, and the new tab would preserve the path taken to get there in the path shown on bash. As an example, /tmp/foo is an folder, /tmp/bar is a symlink to /tmp/foo: /tmp/foo /tmp/bar -> /tmp/foo If I cd'd to /tmp/bar and then launched a new tab (Ctrl-Shift-T), the current working directory on the new tab would show as /tmp/bar instead of /tmp/foo. This stopped working with the latest update. Now, if I `cd /tmp/bar` and launch a new tab, the new tab shows the current working directory as /tmp/foo. STEPS TO REPRODUCE 1. mkdir /tmp/foo 2. ln -s /tmp/foo /tmp/bar 3. cd /tmp/bar 4. printf "\033]7;file://%s%s\033\\" "$HOSTNAME" $(pwd) 5. launch a new tab in Konsole 6. in the new tab, run pwd OBSERVED RESULT $ pwd /tmp/foo EXPECTED RESULT $ pwd /tmp/bar SOFTWARE/OS VERSIONS Linux: Gentoo Linux (available in About System) KDE Plasma Version: 5.25.4 KDE Frameworks Version: 5.97.0 Qt Version: 5.15.5 ADDITIONAL INFORMATION I spent a couple of hours tracing through Konsole, qtcore, and a couple of KDE framework projects, trying to figure out the culprit. I've ruled out the shell as a problem, as the issue appears whether I use /bin/bash or /bin/sh as the shell for the session. I tried rolling back to an older Konsole release from 2021, and the problem persists... which hints that the problem might be deeper than Konsole. I don't have the knowledge necessary to identify the actual source of the problem, though, so I'm choosing Konsole as the source until something more specific can be found. As far as I can tell through debugging, the QProcessPrivate::execChild call deep in qtcore done by the forked process that spawns the new tab does receive the right directory to change into. As Konsole spawns a bunch of other processes around this time, and they all time out if I take too long stepping through things, I was not able to debug any deeper to see what, if anything, changed the working directory. From what I can tell, though, there doesn't appear to be anything in Konsole to pass the OSC 7 from one tab to the new one. Not sure if that information has a different way to make it from one tab to another. Let me know if you need anything specific, or if there are specific things I can try to help debug this issue. I can build and debug Konsole, as well as any of its dependencies. I can reproduce this on both of my Gentoo systems currently (a desktop and a laptop), and I did confirm this morning that before the updates, OSC 7 was working fine on my desktop. I'm attaching the full list of KDE and QT applications/libraries that I updated today on my desktop, in case it helps. There are a lot of applications there, though.