Open Bug 1985743 Opened 11 months ago Updated 11 months ago

default application to open a file of some MIME type is incorrect under Linux (without a desktop environment) in firejail

Categories

(Core :: Widget: Gtk, defect)

Firefox 142
defect

Tracking

()

UNCONFIRMED

People

(Reporter: vincent-moz, Unassigned)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:142.0) Gecko/20100101 Firefox/142.0

Steps to reproduce:

  1. Click on a link providing a PDF file, e.g. https://bugzilla.mozilla.org/attachment.cgi?id=9371430
  2. [Optional] Choose "Save File".
  3. [Optional] Do step 1 again.

Note: steps 2 and 3 ensure that an old user choice for the application in Firefox is not remembered (this works because after choosing "Save File", Firefox forgets the old choice: see bug 1865109).

Actual results:

Firefox proposes "Inkscape (default)" (which is a very poor choice for PDF).

Expected results:

This is wrong. The default given by my .local/share/applications/mimeapps.list file is xpdf (application/pdf=xpdf.desktop). This is also what xdg-open chooses (strace shows that it uses the mimeapps.list file as expected; well, at least it reads this file).

Note: This is similar to bug 1304650, but I am not using KDE (and not any other desktop environment). There are specific comments about KDE there, so this is not the same bug.

This has occurred at least since Firefox 119 (see bug 1865109).

When testing a bit more, I can reproduce this issue only under firejail. Without firejail, I get "xpdf (default)" as expected.

That said, I don't understand why this has an influence, even in the firefox firejail profile, the default application for application/pdf should be xpdf:

cventin:~> firejail --profile=firefox
[...]
cventin% xdg-mime query default application/pdf
xpdf.desktop
cventin% /usr/bin/firefox.real https://www.vinc17.net/

and when I click on a PDF link, I get "Inkscape (default)".

Summary: default application to open a file of some MIME type is incorrect under Linux (without a desktop environment) → default application to open a file of some MIME type is incorrect under Linux (without a desktop environment) in firejail

I forgot: in the settings, for "Applcations", "Portable Document Format (PDF)" should be first set to "Always ask".

Could you try nightly with the env var MOZ_LOG="HelperAppService:5,GIOService:5,URILoader:5" and attach the log here?

Flags: needinfo?(vincent-moz)

Interesting. I can see

[Parent 920: Main Thread]: D/HelperAppService Getting handler and description from mailcap file '~/.mailcap'

which means that Firefox seems to use the ~/.mailcap file. Indeed, if I copy my file to the sandbox, i.e. containing

application/pdf; xpdf %s; test=test -n "$DISPLAY"; description=Portable Document Format; nametemplate=%s.pdf

this solves the problem.

I don't know whether it is intended to use this file, but this file is not readable with the firefox firejail profile (hence the issue). So it might be a bug in firejail, which could make it readable.

Since xdg-mime and xdg-open use ~/.local/share/applications/mimeapps.list and this file is readable in the firefox firejail profile, I thought that Firefox would have used it. Unfortunately the method used by Firefox to get the default application is not documented in its interface.

Flags: needinfo?(vincent-moz)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: