Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

open files ignore xdg-mime settings #17064

Closed
13werwolf13 opened this issue Oct 6, 2021 · 8 comments
Closed

open files ignore xdg-mime settings #17064

13werwolf13 opened this issue Oct 6, 2021 · 8 comments

Comments

@13werwolf13
Copy link

Steps to reproduce

  1. send/receive file via telegram
  2. open file from telegram

Expected behaviour

pdf open in okular, text open in kate, etc

Actual behaviour

pdf open in libreoffice, text open in WINE NOTEPAD.EXE!!!
however, if you open from the file manager or any other application, then the files open as expected

Operating system

openSUSE Tumbleweed Plasma

Version of Telegram Desktop

https://build.opensuse.org/package/show/home:Dead_Mozay:telegram/telegram-desktop

Installation source

Other (unofficial) source

Logs

[werwolf@work] ~  
❯ telegram-desktop 

(telegram-desktop:21644): Telegram-WARNING **: 10:00:46.795: Application was built without embedded fonts, this may lead to font issues.
Gtk-Message: 10:00:46.991: Failed to load module "appmenu-gtk-module"
[ALSOFT] (EE) Failed to set real-time priority for thread: Операция не позволена (1)
error: : cannot open
error: : cannot open
error: : cannot open
qt.svg: Error while inflating gzip file: SVG format check failed
qt.gui.icc: fromIccProfile: failed minimal tag size sanity
qt.gui.icc: fromIccProfile: failed minimal tag size sanity
/usr/bin/atom: строка 190: 21721 Недопустимая инструкция                     (стек памяти сброшен на диск) nohup "$ATOM_PATH" --executed-from="$(pwd)" --pid=$$ "$@" > "$ATOM_HOME/nohup.out" 2>&1
Gtk-Message: 10:01:05.540: Failed to load module "appmenu-gtk-module"
[21721:1006/100106.003852:FATAL:gpu_data_manager_impl_private.cc(439)] GPU process isn't usable. Goodbye.
--2021-10-06 10:01:06--  https://atom.io/crash_reports
Распознаётся atom.io (atom.io)… 52.202.168.65, 54.161.241.46, 54.237.133.81, ...
Подключение к atom.io (atom.io)|52.202.168.65|:443... соединение установлено.
HTTP-запрос отправлен. Ожидание ответа… 204 No Content
2021-10-06 10:01:07 (0,00 B/s) - «/dev/fd/4» сохранён [0]


Unexpected crash report id length
Failed to get crash dump id.
Report Id: 
--2021-10-06 10:01:07--  https://atom.io/crash_reports
Распознаётся atom.io (atom.io)… 52.202.168.65, 54.161.241.46, 54.237.133.81, ...
Подключение к atom.io (atom.io)|52.202.168.65|:443... соединение установлено.
HTTP-запрос отправлен. Ожидание ответа… 204 No Content
2021-10-06 10:01:08 (0,00 B/s) - «/dev/fd/4» сохранён [0]


Unexpected crash report id length
Failed to get crash dump id.
Report Id: 
^C
@13werwolf13 13werwolf13 added the bug label Oct 6, 2021
@ilya-fedin
Copy link
Contributor

tdesktop uses glib library that implements XDG specification to open files. If you think it works incorrectly, file a bug for glib.

@13werwolf13
Copy link
Author

13werwolf13 commented Oct 6, 2021

tdesktop uses glib library that implements XDG specification to open files. If you think it works incorrectly, file a bug for glib.

that was my first thought. but I came here because, in fact, the problem turned out to be reproducible only in telegram. I tried a statically compiled binary from a github and the problem repeated there. I think the reason lies somewhere in the code of the telegrams itself.

@ilya-fedin
Copy link
Contributor

ilya-fedin commented Oct 6, 2021

It's reproducible only in Telegram because you don't use non-KDE applications, I guess. Also, as far as I know, openSUSE patches Firefox to use KDE's mime system rather than glib's XDG implementation. Try Firefox build from Mozilla's website and I'm sure you will see the same behavior.

@ilya-fedin
Copy link
Contributor

ilya-fedin commented Oct 6, 2021

I think the reason lies somewhere in the code of the telegrams itself.

I can say that it's impossible. Telegram doesn't impelement any logic to find a program by itself. All is done using glib's GAppInfo.

@ilya-fedin
Copy link
Contributor

ilya-fedin commented Oct 6, 2021

Or try to open a file in any program from flatpak. Portals use glib, too (unless openSUSE patches them as well).

@13werwolf13
Copy link
Author

ok
i'm open issue in glib git
https://gitlab.gnome.org/GNOME/glib/-/issues/2502
maybe this problem can still be solved once and for all

@13werwolf13
Copy link
Author

for newcomers, I will leave a hint on how to temporarily solve the problem:

gio mime MIMETYPE HANDLER

ex:

gio mime text/plain kate

you will have to do it by hand for all the types of files you are interested in until the mazols bring you to the grave.

@Aokromes Aokromes closed this as completed Oct 6, 2021
@ilya-fedin
Copy link
Contributor

ilya-fedin commented Oct 10, 2021

It seems to me the actual bug is in xdg-mime. glib implements XDG spec in the right way, but xdg-mime calls DE-specific binaries for some reason. And, apparently, in KDE, since they violate the XDG spec.
https://gitlab.freedesktop.org/xdg/xdg-utils/-/issues/193

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants