[snap] I have on clean install some weird folder /home/user/Downloads/firefox.tmp/

Bug #1958813 reported by Jānis Kangarooo
38
This bug affects 5 people
Affects Status Importance Assigned to Milestone
Mozilla Firefox
Fix Released
Unknown
firefox (Ubuntu)
Fix Released
Undecided
Olivier Tilloy
thunderbird (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

I have on clean install some weird folder /home/user/Downloads/firefox.tmp/
Downloads/
└── firefox.tmp
    ├── security_state
    ├── Temp-efca5f30-b773-40f3-afd2-fb29f7ca2d30
    │   └── mesa_shader_cache
    │   ├── 5a
    │   │   └── a12b397653d94da952e9174b48042792d0b5b5
    │   ├── 86
    │   │   └── 658cd26a8a5c083a0d01153d2d26eb349759ce
    │   ├── c2
    │   │   └── 6957f33af79c866d74f0dd37b47ef18e57d431
    │   └── index
    └── tmpaddon

ProblemType: Bug
DistroRelease: Ubuntu 22.04
Package: ubuntu-release-upgrader-core 1:22.04.3
ProcVersionSignature: Ubuntu 5.15.0-17.17-generic 5.15.12
Uname: Linux 5.15.0-17-generic x86_64
ApportVersion: 2.20.11-0ubuntu75
Architecture: amd64
CasperMD5CheckResult: pass
CrashDB: ubuntu
CurrentDesktop: KDE
Date: Mon Jan 24 03:49:13 2022
InstallationDate: Installed on 2022-01-21 (2 days ago)
InstallationMedia: Kubuntu 22.04 LTS "Jammy Jellyfish" - Alpha amd64 (20220121)
PackageArchitecture: all
SourcePackage: ubuntu-release-upgrader
Symptom: dist-upgrade
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
In , Douglas Silva (o-alquimista) wrote :

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

Steps to reproduce:

1. Install Ubuntu 21.10 (impish). It ships with Firefox installed as a Snap that is maintained by Mozilla.
2. Check the ~/Downloads directory, it should be empty
3. Run Firefox.
4. Check the ~/Downloads directory, it should now have an empty directory named "firefox.tmp".

Actual results:

An empty directory is being created at ~/Downloads and I believe this is not the intended behavior. The directory never goes away, it just stays there. If you delete it, it will be recreated when you run Firefox again.

Expected results:

It shouldn't create temporary files in my Downloads directory.

Revision history for this message
In , Release-mgmt-account-bot (release-mgmt-account-bot) wrote :

The [Bugbug](https://github.com/mozilla/bugbug/) bot thinks this bug should belong to the 'Core::Widget: Gtk' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.

Revision history for this message
In , Sygczsjy (sygczsjy) wrote :

User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/91.0

I have observed the same problem. Ubuntu 21.10, default installed Firefox, Snap version 93.0 according to About Firefox.

If the user deletes the directory ~/Downloads/firefox.tmp/ while Firefox is running, Firefox may recreate it at a later point. In some cases the directory is empty. In other cases, it contains temporary files.

My best guess is that it has to do with a change noted in [this thread](https://forum.snapcraft.io/t/xdg-open-not-working-on-firefox/17670/14):

> There’s no `mimeapps.list` file any more, and the `snapcraft.yaml` now sets `GTK_USE_PORTAL=1` in the environment. This causes the GLib APIs to ask `xdg-desktop-portal` to open any files it can’t otherwise find a handler for.
>
> The other change in tip is to set `$TMPDIR` to somewhere other than `/tmp` (specifically, it sets it to `~/Downloads/firefox.tmp`). When Firefox tries to open a file of a type it doesn’t understand, it downloads and saves a copy of it to the temp files directory, and then tries to open that file with its associated handler. This is a problem for snaps, since `/tmp` inside the sandbox is different to `/tmp` outside of the sandbox. Using a different location allows the file to be passed to the helper outside the sandbox.

Revision history for this message
In , Olivier Tilloy (osomon) wrote :

This is actually intended: it was added in https://hg.mozilla.org/mozilla-central/rev/015f42782c5e, to ensure that other snaps can open files downloaded by firefox. See https://forum.snapcraft.io/t/sharing-files-via-tmp/1613 for details.

Revision history for this message
In , Olivier Tilloy (osomon) wrote :

And with https://git.launchpad.net/~mozilla-snaps/+git/firefox-snap/commit/?id=f7022494b8d02835617be47226cd55d455ee84fd I moved the workaround and added a comment to make the intent clearer.

Revision history for this message
In , Sygczsjy (sygczsjy) wrote :

"Downloads" seems like an inelegant place for the firefox tmp dir. Downloads is normally the directory for files the user downloads, whereas software usually stores its temporary files in a hidden directory like `.cache` or `.local/share/`. The effect is that the user's Downloads directory is intruded upon by the seemingly random files like a `mesa_shader_cache` directory. Perhaps the firefox temporary directory could be placed in a less obtrusive location.

Revision history for this message
In , Olivier Tilloy (osomon) wrote :

Of interest, is bug 1710926 : if I set `browser.download.improvements_to_download_panel` to `true`, then files are downloaded to the default Downloads directory, instead of a temporary directory, and the downloads panel is shown, instead of a dialog to ask the user what to do with the file.

Once that setting becomes true by default, we can simply remove the `TMPDIR` hack.

Revision history for this message
Jānis Kangarooo (kangarooo) wrote :
Revision history for this message
Chris Guiver (guiverc) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better, and thank you for all your recent QA testing that I've noted watching #ubuntu-bugs-announce.

You've tagged this on `ubuntu-release-upgrader` which is the tool used to `do-release-upgrade` (or update-manager) to 'bump' you from one release to another. Your installation media was Kubuntu jammy, so it's not possible to use that tool & go anywhere yet.

This bug report has been filed on the wrong package; but I'm unsure of it's a firefox related (install) issue, or kubuntu seed issue (and my last jammy ubuntu install failed so nothing to look at to confirm or provide clues either sorry).

I've changed package to `kubuntu-meta`, and apologies if this is the wrong package which I suspect likely (sorry Rik & other kubuntu team members)

affects: ubuntu-release-upgrader (Ubuntu) → kubuntu-meta (Ubuntu)
Revision history for this message
Paul White (paulw2u) wrote (last edit ):

Not a Kubuntu issue as also seen here on Ubuntu immediately after running the snap version of Firefox for the first time. The directory doesn't seem to reappear after being deleted no matter how many more times Firefox is restarted. Moving issue to the Firefox package.

As the Thunderbird snap creates a thunderbird.tmp directory in ~/Downloads the first time it is run I'll add a thunderbird task.

affects: kubuntu-meta (Ubuntu) → firefox (Ubuntu)
Changed in firefox (Ubuntu):
status: New → Confirmed
Revision history for this message
Paul White (paulw2u) wrote (last edit ):
Revision history for this message
Olivier Tilloy (osomon) wrote :

Yes indeed, the issue is being discussed in that upstream bug.

summary: - I have on clean install some weird folder
+ [snap] I have on clean install some weird folder
/home/user/Downloads/firefox.tmp/
tags: added: snap
Changed in thunderbird (Ubuntu):
status: New → Confirmed
Changed in firefox:
status: Unknown → New
Revision history for this message
In , Bugzilla-7 (bugzilla-7) wrote :

Am suffering from a similar problem, which is that Firefox 99.0.1 running on Ubuntu 22.04 creates $HOME/firefox.tmp and $HOME/snap directories without being asked every time it starts.

Revision history for this message
In , Olivier Tilloy (osomon) wrote :

The `TMPDIR` workaround has been removed with https://github.com/canonical/firefox-snap/commit/250d24a72953fd797a10ec2fe338fcd0fe2491ff in the beta branch.

Revision history for this message
In , Olivier Tilloy (osomon) wrote :

And the change has now been propagated to the stable branch, and released with 101.0.

Changed in firefox (Ubuntu):
status: Confirmed → Fix Released
assignee: nobody → Olivier Tilloy (osomon)
Revision history for this message
Olivier Tilloy (osomon) wrote :

This is now fixed, see the upstream bug report (https://bugzilla.mozilla.org/show_bug.cgi?id=1733750) for details.

Changed in firefox:
status: New → Fix Released
Revision history for this message
Little Girl (littlergirl) wrote (last edit ):

I have no idea why this is listed as "Fix Released" since it's currently still an issue in a fully-updated copy of Kubuntu 22.04 LTS. I agree that this temporary directory should not be being placed into the Downloads directory. It should either be being placed into the directory Snap uses for everything else or into a hidden directory directly in the Home directory so it can follow the conventions used by other default software.

Revision history for this message
Olivier Tilloy (osomon) wrote :

This was fixed in version 101.0 of Firefox, so maybe yours wasn't up-to-date when you checked?
Note that the existing "firefox.tmp" directory under your Downloads folders won't have been deleted by the update, but it's safe to delete it yourself, and it shouldn't re-appear afterwards.

Revision history for this message
Little Girl (littlergirl) wrote :

It was up-to-date when I checked, but I wasn't aware that I could delete the directory and not have it come back. Thank you for letting me know. I just tried it and it worked. Problem solved.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.