"xdg-mime query filetype" fails silently on many filetypes (with fixes I see)

  • Open
  • quality assurance status badge
Details
2 participants
  • Liliana Marie Prikler
  • Sébastien Lerique
Owner
unassigned
Submitted by
Sébastien Lerique
Severity
normal
S
S
Sébastien Lerique wrote on 3 Aug 20:33 +0200
(address . bug-guix@gnu.org)
87y15djw1g.fsf@eauchat.org
Ahoy Guix!

"xdg-mime query filetype a-book.epub" or "whatever.pdf" returns nothing,
which is both puzzling and limiting as it blocks "xdg-open" to work for
many files.

My case was opening pdf or epub files from Emacs, which "xdg-open"
always sends to the browser, whatever my config (instead of e.g. evince
or Foliate).

So debugging shows that:
in ".xdg-mime-real",
(/gnu/store/06ll0ydqsf4bjxwpwsi68dmn2cg0biy6-xdg-utils-1.1.3/bin/xdg-mime
points there),
l.673-684 in "info_gnome()",
even if the "if ... elif ... elif ... fi" fails
(i.e. none of "gio", "gvfs-info", or "gnomevfs-info" are available),
then l.696 "if [ $? -eq 0 ]" gives always true.

Why? I don't know. I guess having a "case ..." instead of "if ... fi"
would solve this.

But the result is "exit_success" gets called whatever the situation, and
xdg-mime often gives no output, which then bugs "xdg-open".

Running this in "guix shell gnome-vfs" solves it, but what should be
done to fix? And how did this not appear earlier? (is xdg* new?)

The options I see are adding the "gnome-vfs" dependency ("gvfs" doesn't
provide "gvfs-info", and "gio" is not a package), or proposing "case"
instead of "if" upstream.

--
Sébastien Lerique
L
L
Liliana Marie Prikler wrote on 4 Aug 11:23 +0200
c8a9b1b5d1e8cfb414ee9ff0d01926f62aeab3b8.camel@gmail.com
Am Samstag, dem 03.08.2024 um 20:33 +0200 schrieb Sébastien Lerique:
Toggle quote (22 lines)
> Ahoy Guix!
>
> "xdg-mime query filetype a-book.epub" or "whatever.pdf" returns
> nothing, which is both puzzling and limiting as it blocks "xdg-open"
> to work for many files.
>
> My case was opening pdf or epub files from Emacs, which "xdg-open"
> always sends to the browser, whatever my config (instead of e.g.
> evince or Foliate).
>
> So debugging shows that:
> in ".xdg-mime-real",
> (/gnu/store/06ll0ydqsf4bjxwpwsi68dmn2cg0biy6-xdg-utils-1.1.3/bin/xdg-
> mime
> points there),
> l.673-684 in "info_gnome()",
> even if the "if ... elif ... elif ... fi" fails
> (i.e. none of "gio", "gvfs-info", or "gnomevfs-info" are available),
> then l.696 "if [ $? -eq 0 ]" gives always true.
>
> Why? I don't know. I guess having a "case ..." instead of "if ... fi"
> would solve this.
Could you prepare a patch to do so? Or has one already been proposed
upstream?

Toggle quote (9 lines)
> But the result is "exit_success" gets called whatever the situation,
> and xdg-mime often gives no output, which then bugs "xdg-open".
>
> Running this in "guix shell gnome-vfs" solves it, but what should be
> done to fix? And how did this not appear earlier? (is xdg* new?)
>
> The options I see are adding the "gnome-vfs" dependency ("gvfs"
> doesn't provide "gvfs-info", and "gio" is not a package), or
> proposing "case" instead of "if" upstream.
Note: In GNOME, prefer `gio open', it's part of glib:bin.
On other desktops, I don't know what the preferred solution would be.

Cheers
S
S
Sébastien Lerique wrote on 9 Aug 11:26 +0200
(name . Liliana Marie Prikler)(address . liliana.prikler@gmail.com)(address . 72448@debbugs.gnu.org)
87wmkq9hcv.fsf@eauchat.org
On 04 Aug 2024 at 11:23, Liliana Marie Prikler <liliana.prikler@gmail.com> wrote:

Toggle quote (6 lines)
>> Why? I don't know. I guess having a "case ..." instead of "if ... fi"
>> would solve this.
> Could you prepare a patch to do so? Or has one already been proposed
> upstream?
>

I can have a look and submit next month I'd say, being a little
underwater currently :)

Toggle quote (7 lines)
>> The options I see are adding the "gnome-vfs" dependency ("gvfs"
>> doesn't provide "gvfs-info", and "gio" is not a package), or
>> proposing "case" instead of "if" upstream.
> Note: In GNOME, prefer `gio open', it's part of glib:bin.
> On other desktops, I don't know what the preferred solution would be.
>

So "gio open" works indeed from the shell, but doomemacs only works
using "gnome-vfs", for a reason I can't figure out yet.

Best
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 72448@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 72448
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch