https://bugs.kde.org/show_bug.cgi?id=419144

            Bug ID: 419144
           Summary: kde-open5 fails to open custom mimetypes when
                    ~/.local/share/mime/application is a symlink
           Product: kde-cli-tools
           Version: 5.12.8
          Platform: Ubuntu Packages
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: aleix...@kde.org
          Reporter: nathanielmbea...@gmail.com
  Target Milestone: ---

Created attachment 126968
  --> https://bugs.kde.org/attachment.cgi?id=126968&action=edit
Files to replicate the bug.

SUMMARY
kde-open5 fails with custom mimetypes when ~/.local/share/mime/application is a
symbolic link pointing to the directory containing the mimeinfo files

STEPS TO REPRODUCE

Github repo for this purpose:

https://github.com/nbeaver/kde-custom-mimetype-bug

A zip file with the necessary files is also attached.

Manual steps for completeness:

$ cat fcyzqrpw.desktop 
[Desktop Entry]
Version=1.0
Type=Application
Name=FCYZQRPW handler
Comment=Handles FCYZQRPW files
TryExec=xedit
Exec=xedit %F
MimeType=application/x-fcyzqrpw

$ cat x-fcyzqrpw.xml 
<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info";>
    <mime-type type="application/x-fcyzqrpw">
        <comment>FCYZQRPW file</comment>
        <glob pattern="*.fcyzqrpw"/>
    </mime-type>
</mime-info>

$ cat example.fcyzqrpw 
This is an example fcyzqrpw file.

Commands to install mimetype, symlink the directory, and open the example file:

    xdg-mime install --mode user x-fcyzqrpw.xml
    desktop-file-install --dir=~/.local/share/applications/ fcyzqrpw.desktop
    chmod +x ~/.local/share/applications/fcyzqrpw.desktop
    xdg-mime default fcyzqrpw.desktop application/x-fcyzqrpw
    update-desktop-database ~/.local/share/applications
    update-mime-database ~/.local/share/mime
    mv ~/.local/share/mime/application ~/.local/share/mime/application.real
    ln -s -r ~/.local/share/mime/application.real
~/.local/share/mime/application
    kde-open5 example.fcyzqrpw

OBSERVED RESULT

kde-open5 shows a "Choose Application - KIO Client" window and can't save any
persistent default application.

EXPECTED RESULT

kde-open5 opens the example file in xedit

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Linux onyx 5.3.0-40-generic #32~18.04.1-Ubuntu SMP Mon Feb 3
14:05:59 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
(available in About System)
KDE Plasma Version: 5.12.9
KDE Frameworks Version: 5.44.0
Qt Version: 5.9.5

ADDITIONAL INFORMATION

The example given is intentionally artificial, but this applies to any custom
mimetype. I first noticed it when trying to open Mathematica notebooks in
Dolphin.

It may seem unusual that ~/.local/share/mime/application is a symbolic link,
but this is common for symlink configuration managers such as GNU stow.

https://www.gnu.org/software/stow/

The workaround is simply to dereference the symlink and make
~/.local/share/mime/application and parent directories not be a symlink (i.e.
don't use GNU stow).

Note that other candidates for xdg-open such as gio and exo-open do not suffer
from this bug.

This might ultimately be a bug in frameworks-kio or frameworks-kservice, but
I'm reporting this to kde-cli-tools since it can be be replicated with
kde-open5. (It can also be replicated with Dolphin.)

$ kde-open5 --version
kioclient 5.12.8
$ apt-cache policy kde-cli-tools libkf5kiocore5 libkf5service5
kde-cli-tools:
  Installed: 4:5.12.8-0ubuntu0.1
  Candidate: 4:5.12.8-0ubuntu0.1
  Version table:
 *** 4:5.12.8-0ubuntu0.1 500
        500 http://us.archive.ubuntu.com/ubuntu bionic-updates/universe amd64
Packages
        100 /var/lib/dpkg/status
     4:5.12.4-0ubuntu1 500
        500 http://us.archive.ubuntu.com/ubuntu bionic/universe amd64 Packages
libkf5kiocore5:
  Installed: 5.44.0-0ubuntu1
  Candidate: 5.44.0-0ubuntu1
  Version table:
 *** 5.44.0-0ubuntu1 500
        500 http://us.archive.ubuntu.com/ubuntu bionic/universe amd64 Packages
        100 /var/lib/dpkg/status
libkf5service5:
  Installed: 5.44.0-0ubuntu1
  Candidate: 5.44.0-0ubuntu1
  Version table:
 *** 5.44.0-0ubuntu1 500
        500 http://us.archive.ubuntu.com/ubuntu bionic/universe amd64 Packages
        100 /var/lib/dpkg/status

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to