'thunderbird.tmp' folder in '~/Download' directory?

Does anyone know what the thunderbird.tmp folder created by Thunderbird in ~/Download is used for?
You can find copies of emails encrypted with GPG, nscopy.tmp, nsemail.eml, data.sig & key.asc files
It is not a temporary directory since the files are not deleted nor after closing Thunderbird or even after a restart.
~/Download is such an unusual place for this kind of file.

Thunderbird 78.4.0
snap 2.47.1+20.10.1
snapd 2.47.1+20.10.1
series 16
ubuntu 20.10
kernel 5.8.0-26-generic

3 Likes

This is a tmp dir to store files you choose to open directly from Thunderbird. The snap can’t use the usual (insecure) /tmp location so had to choose something widely available so other apps can open the files if chosen.

1 Like

Nothing here but GPG encrypted mails, .asc and .key files in this thunderbird.tmp dir.
None of these files have been opened by myself
It was only encrypted mails that were sent
Maybe this is the way to deal with encrypted emails following enigmail shutdown
It reminds me of this:


This thunderbird.tmp folder does not clean itself, weird for a temporary folder

I wish there could be some tmpfs path for storing those temp cruft i.e. under /run/user/$UID.

there is … $XDG_RUNTIME_DIR always points to /run/user/$UID/snap.<snapname>/ … perhaps TMPDIR could be set to point to XDG_RUNTIME_DIR in the environmnt block in snapcraft.yaml …
but that indeed only works if thunderbird actually respects $TMPDIR

[ out of topic, I guess but ] same kind of workaround regarding /tmp should be done in other snap ( gimp for example as some plugins may need /tmp ).

I agree ~/Download is unexpected place.
Why not using using something like ~/snap/app/common/tmp ?

Thx, that should work assuming xdg-portals work in snap now.

Currently it’s done through wrapper script, see https://bazaar.launchpad.net/~ubuntu-desktop/thunderbird/snap/view/head:/tmpdir#L4

Yes it does as shown above.

@kenvandine could you take a look if above idea can be implemented in thunderbird snap? If yes then same thing should be done for ff snap too (plus others facing similar issue).

Maybe another path https://bugs.launchpad.net/ubuntu/+source/chromium-browser/+bug/1903893/comments/9 ?

/run/user/uid/…/…

This is /run/user/$UID/snap.<snapname>/ we talked above.

1 Like

My bad, indeed, that’s exactly what you talked about above !

Can that choice be configurable? My ~/Downloads is a mounted directory, so thunderbird is unusable as snap, due to apparmor policies. I can’t send or save mails.

Run

sudo snap conenct thunderbird:removable-media

This should allow the snap to write on removable-media

1 Like

My home directory has been my “Downloads” directory for the last two decades. So now I have a stupid “thunderbird.tmp” folder (besides the stupid, hard-coded “snap” directory itself).

Do you really want tell me that the snap architecture has no clean or at least somehow configurable strategy for dealing with a few directory paths and for temporary files?

1 Like

Good news! The file which configures this is a script called bin/tmpdir in the Thunderbird snap package. A couple of lines could probably make this configurable. As someone with a couple of decades experience in desktop Linux, and clearly with motivation to fix this, perhaps you could offer a patch to that script, which makes this configurable via an environment variable, or snap set command or similar.

1 Like

Thank you for your reply. I did some internet search and found that many other snaps are also affected by this “design”, most notably Firefox.

There they also had endless debates about $DOWNLOAD/firefox.tmp. It took nearly a year that they finally fixed it somehow and removed exactly the same line as in Thunderbird’s bin/tmpdir:

https://bugzilla.mozilla.org/show_bug.cgi?id=1733750 https://github.com/canonical/firefox-snap/commit/250d24a72953fd797a10ec2fe338fcd0fe2491ff

So I won’t go into this one and I won’t start yet another fruitless discussion about the fundamental difference between a temporary directory and a download directory. And I definitely don’t want to pollute my home directory or any sub-directory (and it’s backups!) with piles of temporary files left behind by some sloppy designed snaps.

Additionally this snap migration also missed to properly move my Thunderbird profile directory correctly, which also took me some time to research and fix. That’s too much for me, so I will simply avoid snap in the future.

1 Like