Subject: bug#51058: xdg-open wrong path in qt based applications (links wont be open)

From: "Hamzeh Nasajpour" <[email-masked]>
Date: Wed, 06 Oct 2021 15:20:11 +0330

I have an issue with opening the links in Qt based applications, like `lxqt-panel`, `qterminal` and I think all of the Qt based application. I mean, I can't open the `file:///home/hamzeh/` in these applications. I get the following error:

```
Launch failed (/gnu/store/bi4m86lripz4fhhi4c34ylg5ckxsrqzs-xdg-utils-1.1.3/bin/xdg-open ....)
```

As you can see, it wants to run `xdg-open` from `/gnu/store/bi4m86lripz4fhhi4c34ylg5ckxsrqzs-xdg-utils-1.1.3/` path and this path isn't available. This `xdg-open` path has patched here: https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/qt.scm?id=f868ed2a75b55400107b80fcc1e41dcfb6b3c28c#n447  So all of the application that are using `QDesktopServices::openUrl()` have this issue, since this path has filled with wrong value in the `qtbase` package.

Also the `xdg-utils` is installed but in the different path, the correct and current installed path is:

```
/gnu/store/0zdclmgw5gnpifwb7jyrmplrk13wp0yz-xdg-utils-1.1.3/
```

The workaround is installing the `xdg-utils` manually, but it's a temporary solution since after running the `guix gc`, again I'll face with this issue.

Some details:

1. In the fresh install I have the `xdg-utils` in the store at this path:

```
$ ll /gnu/store/ | grep xdg-utils
dr-xr-xr-x    4 root          root             4096 Jan  1  1970 0zdclmgw5gnpifwb7jyrmplrk13wp0yz-xdg-utils-1.1.3/
```
and I can't open the links in Qt applications.

2. After installing the `xdg-utils` manually, two `xdg-utils` paths were added to store:
```
$ ll /gnu/store/ | grep xdg-utils
dr-xr-xr-x    4 root          root             4096 Jan  1  1970 0zdclmgw5gnpifwb7jyrmplrk13wp0yz-xdg-utils-1.1.3/
-r--r--r--    2 root          root             1120 Jan  1  1970 35m23zhgbc4rrjrf36dag9abx7r6fnji-xdg-utils-1.1.3-guile-builder
dr-xr-xr-x    4 root          root             4096 Jan  1  1970 3g26il93p23p4fcg1hfn797n4blqh0f6-xdg-utils-1.1.3/
dr-xr-xr-x    4 root          root             4096 Jan  1  1970 bi4m86lripz4fhhi4c34ylg5ckxsrqzs-xdg-utils-1.1.3/
-r--r--r--    2 root          root             3739 Jan  1  1970 makz45834k44dg1x1h1v91nqib41wd91-xdg-utils-1.1.3.drv
-r--r--r--    2 root          root             5706 Jan  1  1970 mix35kkjk3prj2kwi96qx74biwqbmxx7-xdg-utils-1.1.3-guile-builder
-r--r--r--    2 root          root             1269 Jan  1  1970 sz8s218fxvq8hr1ikn4m8g1z3ydbprbs-xdg-utils-1.1.3.drv
-r--r--r--    2 root          root              909 Jan  1  1970 zbvwka7a27baz22w8k78jyjkrqaxcc4v-xdg-utils-1.1.3.tar.gz.drv
```
there is no issue with opening the links at this state.

3. After running the `guix gc` the `xdg-utils` path are:
```
$ ll /gnu/store/ | grep xdg-utils
dr-xr-xr-x    4 root          root             4096 Jan  1  1970 0zdclmgw5gnpifwb7jyrmplrk13wp0yz-xdg-utils-1.1.3/
-r--r--r--    2 root          root             1120 Jan  1  1970 35m23zhgbc4rrjrf36dag9abx7r6fnji-xdg-utils-1.1.3-guile-builder
dr-xr-xr-x    4 root          root             4096 Jan  1  1970 3g26il93p23p4fcg1hfn797n4blqh0f6-xdg-utils-1.1.3/
-r--r--r--    2 root          root             3739 Jan  1  1970 makz45834k44dg1x1h1v91nqib41wd91-xdg-utils-1.1.3.drv
-r--r--r--    2 root          root             5706 Jan  1  1970 mix35kkjk3prj2kwi96qx74biwqbmxx7-xdg-utils-1.1.3-guile-builder
-r--r--r--    2 root          root             1269 Jan  1  1970 sz8s218fxvq8hr1ikn4m8g1z3ydbprbs-xdg-utils-1.1.3.drv
-r--r--r--    2 root          root              909 Jan  1  1970 zbvwka7a27baz22w8k78jyjkrqaxcc4v-xdg-utils-1.1.3.tar.gz.drv
```

And in this state, again, there is an issue with opening the links:
```
Launch failed (/gnu/store/bi4m86lripz4fhhi4c34ylg5ckxsrqzs-xdg-utils-1.1.3/bin/xdg-open ....)
```

And again I can install `xdg-utils`, it cause to adding `bi4m86lripz4fhhi4c34ylg5ckxsrqzs-xdg-utils-1.1.3/` to store and the issue will be fixed but after each `guix gc`, again I have the issue.

(1). I need to fix the issue permanently and also without installing `xdg-utils` manually. How?    

(2). Seems that `qtbase` are referring to a wrong path (`bi4m86lripz4fhhi4c34ylg5ckxsrqzs-xdg-utils-1.1.3/`) here: https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/qt.scm?id=f868ed2a75b55400107b80fcc1e41dcfb6b3c28c#n447    
Why? and where does this wrong path come from?

(3) Why after installing the `xdg-utils` I have those new paths in my store? And why after `guix gc` they will be deleted?

Regards,

--

Hamzeh Nasajpour
PantherX Team