Closed Bug 2007074 Opened 9 months ago Closed 3 months ago

Thunderbird creates an empty "thunderbird" folder in the home directory

Categories

(Toolkit :: Startup and Profile System, defect)

defect
Points:
5

Tracking

()

RESOLVED FIXED
154 Branch
Tracking Status
firefox-esr140 --- unaffected
firefox-esr153 --- wontfix
firefox152 --- wontfix
firefox153 --- wontfix
firefox154 --- fixed

People

(Reporter: contact, Assigned: gerard-majax)

References

(Regression)

Details

(Keywords: regression)

Attachments

(3 files, 1 obsolete file)

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

Steps to reproduce:

I opened Thunderbird (currently 147.0b3).

Actual results:

For the last week or so, opening Thunderbird creates an empty "Thunderbird" folder in my Linux home directory (~).

Expected results:

No folder should be created, as it always been before.

TB146.0.1, OpenSuse Linux
I can confirm this behavior. When deleting the Thunderbird folder in the home directory it will be recreated.
I'm not seeing this on Windows.

Status: UNCONFIRMED → NEW
Component: Untriaged → General
Ever confirmed: true

That's the end of mozregression --app thunderbird --bad 147 --good 146

INFO: No more integration revisions, bisection finished.
INFO: Last good revision: 4c95576f4aaf10be3c779dbcfcccfbcea0d6278c
INFO: First bad revision: 34f7a0ab2366ba11b7b5133dd656d83f34a71db9
INFO: Pushlog:
https://hg.mozilla.org/comm-central/pushloghtml?fromchange=4c95576f4aaf10be3c779dbcfcccfbcea0d6278c&tochange=34f7a0ab2366ba11b7b5133dd656d83f34a71db9

Seems unrelated though. Maybe the second to last step is more helpful:

Narrowed integration regression window from [252560d0, 0628d206] (4 builds) to [4c95576f, 0628d206] (3 builds) (~1 steps left)
INFO: Pushlog:
https://hg.mozilla.org/comm-central/pushloghtml?fromchange=4c95576f4aaf10be3c779dbcfcccfbcea0d6278c&tochange=0628d20688a326abe107d83e9075c86767b98e4a

Well, it is almost certainly something from mozilla-central, so please note down the changesets from there (Thunderbird builds from c-c + m-c)

Attached file mozregression.log —

Attached to full mozregression output. I hope it contains the information you're looking for.

Yeah, surely from bug 259356

Regressed by: xdg-basedir

Yes. It's related to the change upstream. They had a similar issue in bug 2001887

I certainly agree that this was caused by the XDG changes. It was already fixed in Firefox 147.0.1:
https://www.firefox.com/en-US/firefox/147.0.1/releasenotes/

(In reply to Nathan Zachary from comment #8)

It was already fixed in Firefox 147.0.1:

Issue is still present in thunderbird 147.0.1

Present in 145.0 (64-bit) on Arch Linux.

$ cat user-dirs.dirs 
# This file is written by xdg-user-dirs-update
# If you want to change or add directories, just edit the line you're
# interested in. All local changes will be retained on the next run.
# Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped
# homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an
# absolute path. No other format is supported.
# 
XDG_DESKTOP_DIR="$HOME/"
XDG_DOWNLOAD_DIR="$HOME/"
XDG_TEMPLATES_DIR="$HOME/"
XDG_PUBLICSHARE_DIR="$HOME/"
XDG_DOCUMENTS_DIR="$HOME/"
XDG_MUSIC_DIR="$HOME/"
XDG_PICTURES_DIR="$HOME/"
XDG_VIDEOS_DIR="$HOME/"

Present in 147.0.1 (64-bit) on Linux Mint 22.1 based on Ubuntu 24.04

> cat /etc/lsb-release 
DISTRIB_ID=LinuxMint
DISTRIB_RELEASE=22.1
DISTRIB_CODENAME=xia
DISTRIB_DESCRIPTION="Linux Mint 22.1 Xia"

> cat /etc/upstream-release/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=24.04
DISTRIB_CODENAME=noble
DISTRIB_DESCRIPTION="Ubuntu Noble Numbat"

Present in 147.0.1 (64-bit) on NixOS 26.05 (Yarara)

(In reply to Nathan Zachary from comment #8)

I certainly agree that this was caused by the XDG changes. It was already fixed in Firefox 147.0.1:
https://www.firefox.com/en-US/firefox/147.0.1/releasenotes/

I think that was referring to a different issue. Firefox 147 was creating an unneeded ~/.mozilla/extensions folder, which has been fixed in firefox and thunderbird 147.0.1. This issue may also be related to the xdg changes, but it might also not be.

Present in 147.0.2 (64-bit) on openSUSE tumbleweed

Present in 147.0.1 (64-bit) on Arch Linux

(In reply to spamgrinder+mozilla from comment #11)
Still present in 147.0.2 (64-bit). Same system details.

Present in 147.0 on Fedora 43 (in today's upgrade).

funny: TB creates a folder name "Projects" too ... WTF?

The prior logic always evaluated the if statement to true because
target_is_windows was a non-none object.

Assignee: nobody → corey
Status: NEW → ASSIGNED
Target Milestone: --- → 149 Branch

(In reply to Corey Bryant from comment #20)

Created attachment 9546893 [details]
Bug 2007074 - Ensure proper logic for setting MOZ_APP_PROFILE. r=#thunderbuild

The prior logic always evaluated the if statement to true because
target_is_windows was a non-none object.

Without patching we get ~/Thunderbird

With the proposed patch on top of thunderbird-147.0.2, it still creates a ~/thunderbird directory (still wrong directory, but now lower case)

What we should end up with is ~/.thunderbird

Actually... in an ideal world, we would probably end up with ~/.config/thunderbird O:-)

(In reply to Nico from comment #22)

Actually... in an ideal world, we would probably end up with ~/.config/thunderbird O:-)

Or more specifically: $XDG_CONFIG_HOME/thunderbird

Pushed by benc@thunderbird.net:
https://hg.mozilla.org/comm-central/rev/22b7d2988a76
Ensure proper logic for setting MOZ_APP_PROFILE. r=dandarnell

Status: ASSIGNED → RESOLVED
Closed: 7 months ago
Resolution: --- → FIXED
Duplicate of this bug: 2018486

More work is needed to handle empty ~/thunderbird directory

Status: RESOLVED → REOPENED
Keywords: leave-open
Resolution: FIXED → ---
Duplicate of this bug: 2019891

(In reply to jazztickets from comment #23)

(In reply to Nico from comment #22)

Actually... in an ideal world, we would probably end up with ~/.config/thunderbird O:-)

Or more specifically: $XDG_CONFIG_HOME/thunderbird

With a fallback to $HOME/.config.

Thunderbird version 147.0.1 (64-bit) creates $HOME/Thunderbird.

Creating cross-platform directories isn't trivial. My text editor uses the following code, which is still lacking, but never creates a directory in the user's home directory.

https://repo.autonoma.ca/repo/keenwrite/blob/HEAD/src/main/java/com/keenwrite/io/UserDataDir.java

Still an issue in TB 148.03 in Fedora 43.

Still an issue in TB 148.0 in NixOS

Same issue with Thunderbird 148.0 on Manjaro... why does it keep creating a folder in home even after I delete it? is there any temporary workaround?

Component: General → Build Config

(In reply to seven from comment #33)

Same issue with Thunderbird 148.0 on Manjaro... why does it keep creating a folder in home even after I delete it? is there any temporary workaround?

WORKAROUND: Hide the folder.

For those using GNOME, Xfce, Cinnamon, or anything else where the file manager uses GVFS (and this seems to also be recognized by KDE's Dolphin), files and folders can be hidden by listing them in a file named .hidden in the same directory (one name per line). For example:

echo Thunderbird >> ~/.hidden

will make the file manager hide the folder ~/Thunderbird as if it were a dot-dir.

This workaround of the ~/.hidden file doesn't work with PCManFM or PCManFM-qt. It could be that it's a feature of the Desktop Environment and not specifically the file manager, but I can't say with certainty. I'm not using any DE, but rather just a Window Manager. Hopefully, though, this regression will be fixed sooner rather than later so we won't have to use any type of workaround.

(In reply to brian from comment #34)

WORKAROUND: Hide the folder.

In linux as far as I know there's no way to hide a folder or a file unless it starts with a . eg: .Thunderbird instead of Thunderbird, but then a new visible Thunderbird folder will just be recreated on launch again. Ergo the need for this bug report. However... (see below response)

(In reply to grawity from comment #35)

For those using GNOME, Xfce, Cinnamon, or anything else where the file manager uses GVFS (and this seems to also be recognized by KDE's Dolphin), files and folders can be hidden by listing them in a file named .hidden in the same directory (one name per line). For example:

echo Thunderbird >> ~/.hidden

will make the file manager hide the folder ~/Thunderbird as if it were a dot-dir.

YOU SIR are a genius though! I never knew about this! I tried it and it actually worked! 🤠 It's supposed to be a GNOME thing but as you said it works in KDE dolphin too! Thank you so much! 😁👍🏻

With Mozilla Thunderbird 149.0.1 on arch linux, the folder being created is now lower-case thunderbird instead of upper case Thunderbird.

Indeed. and this is much worse than before, as this breaks xdg-email. This is probably a weakness of xdg-email, but the directory in $HOME using the same name as the binary overlap it:

$ LC_ALL=C.UTF-8 xdg-email
awk: warning: command line argument `-' is a directory: skipped
/usr/bin/xdg-email: line 737: /home/casta/thunderbird: Is a directory

(In reply to brianmercer from comment #38)

With Mozilla Thunderbird 149.0.1 on arch linux, the folder being created is now lower-case thunderbird instead of upper case Thunderbird.

Confirming the same on Linux Mint: Thunderbird 149.0.1 (64-bit),Linux Mint 22.1 Xia based on Ubuntu 24.04 Noble

Environment:
OS: Arch Linux (Rolling)
DE: KDE Plasma 6.6.3
Thunderbird Version: 149.0.1 (Development build)
Observed Behavior:
I am confirming that the empty folder recreation bug persists in version 149.0.1. On my system, the application appears to alternate between variants: if I delete ~/Thunderbird, it eventually creates ~/thunderbird (lowercase), or vice versa. Both variants sometimes appear simultaneously after a restart.
This indicates that the directory-handling logic in the 149.x branch is still incorrectly targeting the home root instead of following hidden XDG paths. As an Arch user on the bleeding edge, I can confirm the current patches have not yet resolved this for my environment.

149.0.1 (64-bit)

Arch Linux.

https://wiki.archlinux.org/title/XDG_Base_Directory

This ~/thunderbird (or ~/Thunderbird) directory is always empty, so I'm not sure why it's even needed.

If it's for config, use XDG_CONFIG_HOME. If data, use XDG_DATA_HOME. If runtime info, use XDG_RUNTIME_DIR.

$ cat .config/user-dirs.dirs
XDG_DESKTOP_DIR="$HOME/"
XDG_DOWNLOAD_DIR="$HOME/"
XDG_TEMPLATES_DIR="$HOME/"
XDG_PUBLICSHARE_DIR="$HOME/"
XDG_DOCUMENTS_DIR="$HOME/"
XDG_MUSIC_DIR="$HOME/"
XDG_PICTURES_DIR="$HOME/"
XDG_VIDEOS_DIR="$HOME/"

If you are using any one of those, please let us know which one.

I experience the same bug on Arch Linux + KDE Plasma (but always with ~/thunderbird with a lowercase initial letter) with $XDG_CONFIG_HOME unset (but setting $XDG_CONFIG_HOME to $HOME/.config doesn’t change a thing).

Note that yesterday a weird and tiny stdin.xkm file was created in my home folder , and today an also tiny ta file was created, not sure if it’s related?

I think it is a bug in the crash reporting, this is an example from my strace

3577-wait4(19429, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 19429 <0.047731>
3578---- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=19429, si_uid=1001, si_status=0, si_utime=0, si_stime=1 /* 0.01 s */} ---
3579-close(8<UNIX:[188039->188038]>)         = 0 <0.000029>
3580-close(6<UNIX:[188037->188036]>)         = 0 <0.000107>
3581:access("/home/meowxiik/Thunderbird", F_OK) = -1 ENOENT (No such file or directory) <0.000026>
3582-access("/home/meowxiik/mozilla", F_OK)  = -1 ENOENT (No such file or directory) <0.000025>
3583:mkdir("/home/meowxiik/Thunderbird", 0700) = 0 <0.000204>
3584:access("/home/meowxiik/Thunderbird", F_OK) = 0 <0.000025>
3585-mkdir("/home/meowxiik/.thunderbird", 0700) = -1 EEXIST (File exists) <0.000031>
3586-mkdir("/home/meowxiik/.thunderbird/Crash Reports", 0700) = -1 EEXIST (File exists) <0.000052>
3587-mkdir("/home/meowxiik/.thunderbird/Crash Reports/events", 0700) = -1 EEXIST (File exists) <0.000031>
3588-mkdir("/home/meowxiik/.thunderbird/Crash Reports", 0700) = -1 EEXIST (File exists) <0.000072>

Before accessing ~/.thunderbird, creates the ~/Thunderbird

Just installed the latest version (150.0) on Arch Linux and the bug is still present.

(In reply to Petr B. from comment #45)

Just installed the latest version (150.0) on Arch Linux and the bug is still present.

I confirm.

KDE plasma: 6.6.4
KDE frameworks: 6.25.0
Qt:6.11.0
Kernel: 6.19.14
Wayland

Can confirm it still happens. Small thing, but a bit irksome as I use yazi and can't properly hide it.

Asahi Linux, Fedora 44, Hyprland
Thunderbird 149.0.1
Kernel: 6.19.13-400.asahi.fc44.aarch64+16k aarch64

Same problem but with a small t.

I'm on Fedora 44 Gnome. Thunderbird 149.0.1 installed through Fedora rpm repo.

Guys, EVERYONE has this problem. You don't need to post every os and tb combination, it's a BUILD-IN SELFMADE TB issue.

(In reply to support from comment #49)

Guys, EVERYONE has this problem. You don't need to post every os and tb combination, it's a BUILD-IN SELFMADE TB issue.

What would help then, is to provide visibility on how this bug is taken care of. Thanks.

Here's what happens in 150.0.1. Call path:

main() at comm/mail/app/nsMailApp.cpp:432
do_main() at comm/mail/app/nsMailApp.cpp:236
XRE_main() at toolkit/xre/nsAppRunner.cpp:6317
XREMain::XRE_main() at toolkit/xre/nsAppRunner.cpp:6219
XREMain::XRE_mainStartup() at toolkit/xre/nsAppRunner.cpp:5050
NS_GetToolkitProfileService() at toolkit/profile/nsToolkitProfileService.cpp:2919
nsToolkitProfileService::Init() at toolkit/profile/nsToolkitProfileService.cpp:997
nsXREDirProvider::GetUserAppDataDirectory() at toolkit/xre/nsXREDirProvider.h:64

Unwanted ~/thunderbird directory is created by GetUserDataDirectoryHome() first at line 1262.
Then correct ~/.thunderbird directory is created by EnsureDirectoryExists() at line 1269.

More specifically, unwanted ~/thunderbird is created by:
GetUserDataDirectoryHome() => GetLegacyOrXDGHomePath() => EnsureDirectoryExists() at line 1544.

As a workaround I copied my desktop file and changed the Exec line:
Exec=sh -c 'thunderbird %u & sleep 1; rmdir "$HOME/thunderbird" 2>/dev/null; fg'

I'm looking into this. While a workaround may be possible, we should get Thunderbird onboard for XDG support.

Assignee: corey → mkmelin+mozilla
Component: Build Config → XPCOM
Keywords: leave-open
Product: Thunderbird → Core
Summary: Thunderbird creates an empty "Thunderbird" folder in the home directory → Thunderbird creates an empty "thunderbird" folder in the home directory
Version: Thunderbird 147 → unspecified

(In reply to Magnus Melin [:mkmelin] from comment #53)

I'm looking into this. While a workaround may be possible, we should get Thunderbird onboard for XDG support.

That would be incredibly beautiful! Maybe all of Mozilla would follow? Just dreaming...

(In reply to Magnus Melin [:mkmelin] from comment #53)

I'm looking into this. While a workaround may be possible, we should get Thunderbird onboard for XDG support.

Thanks! That would be great. Meanwhile I'm using Johannes' solution.

Firefox already did. That's why have this bug atm...

(In reply to arto+github from comment #48)

Same problem but with a small t.

I'm on Fedora 44 Gnome. Thunderbird 149.0.1 installed through Fedora rpm repo.

I switched to release channels flatpak which doesn't seem to have the problem.

(In reply to Magnus Melin [:mkmelin] from comment #56)

Firefox already did. That's why have this bug atm...

Awesome! I'm using LibreWolf but didn't even notice. Thanks for your help and work!

Thank you. Just rebuilt thunderbird 150.0.2 with this patch applied :

  • no more empty folder created
  • no loss of configuration

Works for me !

The severity field is not set for this bug.
:nika, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(nika)
Severity: -- → S3
Flags: needinfo?(nika)
See Also: → 735285

fresh install 151.0 on manjaro, official repos, kde plasma
~/thunderbird still being created at every restart of thunderbird

(In reply to Ilja Rogoff from comment #62)

fresh install 151.0 on manjaro, official repos, kde plasma
~/thunderbird still being created at every restart of thunderbird

and still with 152

Points: --- → 5
Attachment #9602072 - Attachment description: WIP: Bug 2007074 - Handle XDG_CONFIG_HOME for profile on Thunderbird → Bug 2007074 - Handle XDG_CONFIG_HOME for profile on Thunderbird r?thinker!,#thunderbird-back-end-reviewers!
Depends on: 2050754
Blocks: 2052209
No longer blocks: tb-maintenance-2026-q2
Pushed by alissy@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/2aca277c9e7c https://hg.mozilla.org/integration/autoland/rev/594eb348a49a Handle XDG_CONFIG_HOME for profile on Thunderbird r=thunderbird-back-end-reviewers,Thinker,babolivier
Status: REOPENED → RESOLVED
Closed: 7 months ago → 3 months ago
Resolution: --- → FIXED
Assignee: mkmelin+mozilla → lissyx+mozillians
Target Milestone: 149 Branch → 154 Branch
Attachment #9588863 - Attachment is obsolete: true

The patch landed in nightly and beta is affected.
:gerard-majax, is this bug important enough to require an uplift?

For more information, please visit BugBot documentation.

Flags: needinfo?(lissyx+mozillians)
Component: XPCOM → Startup and Profile System
Product: Core → Toolkit
QA Whiteboard: [qa-triage-done-c155/b154]

This is dependant on gecko upstream fixes that would not get uplifted

Flags: needinfo?(lissyx+mozillians)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: