Bug 490966 - kde-open fails to open relative paths outside of the current working directory's children
Summary: kde-open fails to open relative paths outside of the current working director...
Status: RESOLVED FIXED
Alias: None
Product: frameworks-kio
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 6.4.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KIO Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-07-29 09:19 UTC by thibaulltt
Modified: 2024-08-12 13:53 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 thibaulltt 2024-07-29 09:19:33 UTC
SUMMARY
When I'm using the terminal to navigate between LaTeX files (opened in a TUI program) and the output PDF (opened in Okular/firefox), I'm using the `xdg-open` command a lot. However it (and the `kde-open` command it calls underneath) do not accept relative paths that go outside of the current working directory's direct children, no matter the depth.

STEPS TO REPRODUCE
1. Open a terminal, and navigate to any directory, let's say `~/Documents`.
2. Invoke `kde-open .` (or `xdg-open`, it should give the same result). It should open Dolphin/your filesystem browser without issues.
3. Invoke `kde-open ../foo` where foo is any directory under `~` . It should prompt an error message stating the unit is not configured properly and the operation is not permitted.

OBSERVED RESULT
Whenever supplying an "invalid" URI/path, it outputs a message with the following template:

```
kf.kio.gui: Failed to launch process as service: "app-org.kde.dolphin@<hash>.service" "org.freedesktop.DBus.Error.AccessDenied" "Unit app-org.kde.dolphin@<hash>.service failed to load properly, please adjust/correct and reload service manager: Operation not permitted"
Unit app-org.kde.dolphin@<hash>.service failed to load properly, please adjust/correct and reload service manager: Operation not permitted
```

EXPECTED RESULT
It should open the file/directory without issues.

SOFTWARE/OS VERSIONS
Qt Version: 6.7.2
Kernel Version: 6.9.11-200.fc40.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 7840U w/ Radeon 780M Graphics
Memory: 30.7 GiB of RAM
Graphics Processor: AMD Radeon 780M
Manufacturer: Framework
Product Name: Laptop 13 (AMD Ryzen 7040Series)
System Version: A7

ADDITIONAL INFORMATION
- It works perfectly fine if the command `gio open ../problematic/relative/path` is used instead of `[xdg|kde]-open` !
- The workflow defined above worked just fine a few weeks ago. I'm not able to pinpoint it more specifically than that, sorry.
- The commands perform as expected if an absolute path to the "problematic" paths are used instead.
- Since it is mentioned nowhere on the system info, I'm running the KDE spin of Fedora, and the "full" version information of the `kde-cli-tools` package is `6.1.3-2.fc40`.
Comment 1 thibaulltt 2024-07-29 09:21:45 UTC
In the steps to reproduce section, on item 3 it should be noted any path will error out if outside of the child of the CWD. No matter if the thing you're trying to open is a directory or a file.
Comment 2 cwo 2024-07-30 13:10:41 UTC
Works fine here using Tuxedo OS and current git master.

This looks like a permission problem involving dbus. Are you using flatpaks or snaps of any of the involved applications? Is maybe SELinux involved?
Comment 3 thibaulltt 2024-07-31 08:01:22 UTC
I am using a few Flatpak-installed applications, but this problem happens no matter where I instantiate the command from. It happens when using it from WezTerm (installed via Flatpak) and Konsole (installed by-default by the KDE spin of Fedora, not through Flatpak).

As far as I'm aware, I haven't made any modifications to my DBus setup, other then what Fedora provides as default. For SELinux, it seems to be enabled on my machine yes (`sestatus` prints 'Current mode: enforcing') but as explained in my original post, it didn't seem to happen a few weeks ago.
Comment 4 cwo 2024-07-31 18:57:21 UTC
I can reproduce this on base Fedora in a VM, just installation and full upgrades, no other changes.

It doesn't happen on Tuxedo OS with the same version. It might be something Fedora specific, or a kde bug that only appears with newer system packages than what Tuxedo provides. You may want to report a bug on Fedora's bug tacker just in case.
Comment 5 fanzhuyifan 2024-08-03 17:39:43 UTC
When opening relative urls from the parent, I get the error
```
kf.kio.gui: Failed to launch process as service: "app-org.kde.dolphin@5bc014e857b84d0c97016e4c0c9bca8d.service" "org.freedesktop.DBus.Error.InvalidArgs" "WorkingDirectory= expects a normalized path or '~'"
```

I think this is happening due to the recent change in systemd: https://github.com/systemd/systemd/commit/14631951cea807de2d482a430841c604c2040718
Comment 6 Bug Janitor Service 2024-08-03 18:13:21 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kio/-/merge_requests/1679
Comment 7 fanzhuyifan 2024-08-12 13:53:10 UTC
Git commit 851dbcab4e59bac477346160a04faa1861b8ad2a by Yifan Zhu.
Committed on 12/08/2024 at 13:36.
Pushed by fanzhuyifan into branch 'master'.

gui/kprocessrunner: normalize working directory

systemd requires working directory to be normalized since
https://github.com/systemd/systemd/commit/14631951cea807de2d482a430841c604c2040718.

M  +2    -1    src/gui/kprocessrunner.cpp

https://invent.kde.org/frameworks/kio/-/commit/851dbcab4e59bac477346160a04faa1861b8ad2a