Closed xfzv closed 1 year ago
Can you backup the .mozilla
directory somewhere, then delete it and launch Firefox without writing profiles.ini
with chezmoi? I'm curious to see what it looks like.
Can you run chezmoi execute-template '{{ mozillaInstallHash "/opt/firefox" }}'
on gentoo and provide the result?
The profile ID for the path /opt/firefox
should be 06AFDA46A1A8AD48
. I have no idea why the zero is being removed, though I feel like that might be causing the issue. If it is, I'm not entirely sure that chezmoi or MozillaInstallHash are at fault here.
Can you backup the
.mozilla
directory somewhere, then delete it and launch Firefox without writingprofiles.ini
with chezmoi? I'm curious to see what it looks like.
[Profile1]
Name=default
IsRelative=1
Path=961hs9qt.default
Default=1
[Profile0]
Name=default-release
IsRelative=1
Path=vqpporu0.default-release
[General]
StartWithLastProfile=1
Version=2
[Install6AFDA46A1A8AD48]
Default=vqpporu0.default-release
Locked=1
Can you run
chezmoi execute-template '{{ mozillaInstallHash "/opt/firefox" }}'
on gentoo and provide the result?
❯ chezmoi execute-template '{{ mozillaInstallHash "/opt/firefox" }}'
06AFDA46A1A8AD48%
The profile ID for the path
/opt/firefox
should be06AFDA46A1A8AD48
. I have no idea why the zero is being removed, though I feel like that might be causing the issue. If it is, I'm not entirely sure that chezmoi or MozillaInstallHash are at fault here.
I don't have any issue with my Arch Linux profile after more testing.
I'll move back to www-client/firefox
for now and see what happens.
Note that, as a work around, you can use a template function to remove leading zeros:
{{- $releaseId = mozillaInstallHash "/opt/firefox" | replaceAllRegex "^0+" "" -}}
Note that, as a work around, you can use a template function to remove leading zeros:
{{- $releaseId = mozillaInstallHash "/opt/firefox" | replaceAllRegex "^0+" "" -}}
Thank you, I've just tried this and it does the trick!
I removed everything in ~/.mozilla/firefox
except my profile directory, edited profiles.ini.tmpl
with your suggested change and run chezmoi apply
. I launched/closed Firefox and ran chezmoi apply
multiple times, all good.
I don't understand why the leading zero is being removed either. Is this a Firefox issue then?
Feel free to close in this case.
I don't understand why the leading zero is being removed either. Is this a Firefox issue then?
I suspect that Firefox has (maybe unintentionally) changed its behavior here, but @bradenhilton is the expert.
@twpayne
❯ chezmoi execute-template '{{ mozillaInstallHash "C:\\Program Files\\aaa" }}'
0C5C3528386AC660
I just installed Firefox on my laptop to C:\Program Files\aaa
, and the profiles.ini
says the hash is C5C3528386AC660
, so I think the package needs updating.
I can't recall if a path's hash can have a length above 16.
Is it possible to have Sprintf
treat the length as a max length, rather than a fixed length? Or should we just keep it as is and manually trim the zeroes post hash generation?
Is it possible to have
Sprintf
treat the length as a max length, rather than a fixed length?
Probably, but having a max length normally truncates the end of the string, whereas here we want remove bytes from the start of the string.
From your investigation, I agree that we should update the mozillainstallhash package.
I think we get the max length of 16 for free from the format code itself, so I can revert the fixed length as a quick fix, but for a more proper fix I'll have to see if I can find what exactly Mozilla is doing with the hash. Might take a while though as the code base is huge.
I'll add tests for some known good paths and hashes also, instead of just hashing "Hello world"
.
Would you like me to add you as a collaborator as well, @twpayne? No expectations ever.
This all sounds great!
Would you like me to add you as a collaborator as well, @twpayne? No expectations ever.
Yes, happy to help!
Describe the bug
I use Gentoo. I recently switched from
www-client/firefox
towww-client/firefox-bin
and have the following issue ever since.I'm using
mozillaInstallHash
variable in myprofiles.ini.tmpl
to get the hash value for my profile (on Gentoo,www-client/firefox-bin
installs to/opt/firefox
so I made myprofiles.ini
a template as I'm also using Arch Linux on the same machine).~/dotfiles/dot_mozilla/firefox/profiles.ini.tmpl
:To reproduce
~/.mozilla/firefox
but the profile directory (~/.mozilla/firefox/default-release
in my case)chezmoi apply
~/.mozilla/firefox/profiles.ini
content:~/.mozilla/firefox
~/.mozilla/firefox/profiles.ini
content is then updated with the following:Note the missing "0" at the beginning of the freshly created profile hash (not sure why).
Alternatively, if I first run
firefox-bin -P
and select my profile in the list instead of directly launching Firefox, it starts my profile fine, but just once. After launching Firefox,~/.mozilla/firefox/profiles.ini
content is also updated with the following:Expected behavior
profiles.ini
isn't modified after closing Firefox and no new profile is created.Output of command with the
--verbose
flagOutput of
chezmoi doctor
Additional context
I didn't have the issue before with
www-client/firefox
.Here are the two Gentoo ebuilds for reference:
Thanks in advance for any suggestion.