Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

firefox gets wrong timezone on NixOS #238025

Closed
sg-qwt opened this issue Jun 16, 2023 · 17 comments · Fixed by #254791
Closed

firefox gets wrong timezone on NixOS #238025

sg-qwt opened this issue Jun 16, 2023 · 17 comments · Fixed by #254791

Comments

@sg-qwt
Copy link
Contributor

sg-qwt commented Jun 16, 2023

firefox doesn't have correct timezone on NixOS

Steps To Reproduce

Steps to reproduce the behavior:

  1. NixOS has correctly set timezone with time.timeZone = "Asia/Shanghai"

  2. run date and timedatectl all return correct timezone

  3. open Chromium and test timezone with https://webbrowsertools.com/timezone/ timezone is correct

  4. open Firefox and test timezone with https://webbrowsertools.com/timezone/ timezone is wrong, in my case it shows GMT-0500 (Central Daylight Time)
    (doesn't matter if it's firefox or firefox-beta, privacy.resistFingerprinting is false)

  5. run firefox with TZ set works, eg TZ=Asia/Shanghai /nix/store/pnm2qqfwpg7gqvybp2p0cghci3nm94my-firefox-114.0b7/bin/firefox, visit https://webbrowsertools.com/timezone/ and timezone is correct now

  6. my observation is Firefox needs TZ explicit set, which NixOS doesn't

Additional context

Possibly related to #23053

@ralismark
Copy link
Contributor

ralismark commented Jun 17, 2023

Had the same issue, I noticed it from discord and facebook showing times in UTC. Setting TZ=:/etc/localtime also fixed this.

I suspect this is a recent (last few weeks) issue, since I feel like it was fine before. I might try bisect it later tonight.

@vcunat
Copy link
Member

vcunat commented Jun 20, 2023

I can't reproduce the issue in firefox on current nixpkgs master (f891c1c), at least when running NixOS 23.05. ($TZ is not set when I start up shell.) EDIT: I'm GMT+2 now.

@kirillrdy
Copy link
Member

I can reproduce using that commit

git checkout f891c1c65e31a7ebebb57cbedb3a63d0012146c1
nix-build -A firefox
./result/bin/firefox https://webbrowsertools.com/timezone

image

@kirillrdy
Copy link
Member

works if sandbox is disabled

MOZ_DISABLE_CONTENT_SANDBOX=1 ./result/bin/firefox https://webbrowsertools.com/timezone/

@mobsenpai
Copy link

mobsenpai commented Jun 21, 2023

Set the TZ = "${config.time.timeZone}"; environment variable

@mobsenpai
Copy link

mobsenpai commented Jun 22, 2023

Set the TZ = "${config.time.timeZone}"; environment variable

I can just manually set this but knowing that It worked in the previous update my mind just don't allow me to add another line to my config, so for now until they add it in the browser or soemthing I will just launch firefox using TZ=mytimezone firefox

@kirillrdy
Copy link
Member

with firefox 115 timezone issue is back ... I guess until we hear back from upstream workaround is to set TZ

@sg-qwt
Copy link
Contributor Author

sg-qwt commented Jul 8, 2023

with firefox 115 timezone issue is back ... I guess until we hear back from upstream workaround is to set TZ

(if (lib.versionAtLeast version "115") then icu else icu72)
115 is not pinned with icu72.

https://bugzilla.mozilla.org/show_bug.cgi?id=1839287
@mweinelt Until upstream fixes the issue(I doubt that's gonna be any time soon), shall we just pin icu72 for every firefox on-wards or forget about icu72 and create a TZ wrapper instead?

@kirillrdy
Copy link
Member

pinned

firefox 115 requires icu73, so it's either TZ=":/etc/localtime" or wait for upstream

@S-NA
Copy link
Contributor

S-NA commented Jul 20, 2023

If it is a sandbox issue, would not using security.sandbox.content.read_path_whitelist in about:config be a workaround to this? I cannot reproduce the issue for some reason to test.

@kirillrdy
Copy link
Member

kirillrdy commented Jul 20, 2023

If it is a sandbox issue, would not using security.sandbox.content.read_path_whitelist in about:config be a workaround to this? I cannot reproduce the issue for some reason to test.

for read_path_whitelist ? can we set it programmatically ?

as for reproducing the issue, I have nixos-rebuild build-vm --flake github:kirillrdy/dotfiles/firefox#tsutenkaku that you can try if you wish

setting MOZ_DISABLE_CONTENT_SANDBOX=1 fixes the issue, hence why I am confident its sandbox related

but whats strange is

  1. there are a few people that can not reproduce the issue
  2. when i run with MOZ_SANDBOX_LOGGING=1
    I get
Sandbox: Recording mapping /nix/store/lyw3dwzv3wpvklmm5ky3zw3zxvx3nmvs-tzdata-2023c/share/zoneinfo/Australia/Melbourne -> /etc/localtime
Sandbox: Recording mapping /etc/zoneinfo/Australia/Melbourne -> /etc/localtime
Sandbox: Recording mapping /nix/store/lyw3dwzv3wpvklmm5ky3zw3zxvx3nmvs-tzdata-2023c/share/zoneinfo/Australia/Melbourne -> /etc/localtime

so maybe some sort of (reliable 🤣 ) race condition, hopefully upstream can shine some light on the issue

@ralismark
Copy link
Contributor

If it is a sandbox issue, would not using security.sandbox.content.read_path_whitelist in about:config be a workaround to this? I cannot reproduce the issue for some reason to test.

setting security.sandbox.content.read_path_whitelist to /etc/localtime,/etc/static/zoneinfo,/etc/static/zoneinfo/,/etc/zoneinfo,/etc/zoneinfo/,/nix/store/jhgh02lyizd1kyl71brvc01ygsmgi40a-tzdata-2023c/share/zoneinfo/,/nix/store/jhgh02lyizd1kyl71brvc01ygsmgi40a-tzdata-2023c/share/zoneinfo,/nix/store/9sv16r56wlhx39ms050ksi2axc1i5zn2-etc/etc,/nix/store/9sv16r56wlhx39ms050ksi2axc1i5zn2-etc/etc/ (basically, every single path that should be relevant) still shows the wrong timezone on https://webbrowsertools.com/timezone/

@mateusvmv
Copy link

Workaround, setting the TZ environment variable:

{ pkgs, ... }:
let
        patched-firefox = pkgs.symlinkJoin {
                name= "patched-firefox";
                paths = [ pkgs.firefox ];
                buildInputs = [ pkgs.makeWrapper ];
                postBuild = ''
                        wrapProgram "$out/bin/firefox" --set TZ /etc/localtime
                '';
        };
in
{
        home.packages = with pkgs; [
                patched-firefox
        ];
}

@mobsenpai
Copy link

Wth it's still not done yet?

@mweinelt
Copy link
Member

https://bugzilla.mozilla.org/show_bug.cgi?id=1848615

wontfix in 116, affected for 117/118, so an upstream fix will likely arrive in a 117 point release. Firefox 117.0 is due early next week.

@kirillrdy
Copy link
Member

kirillrdy commented Aug 30, 2023

looks like it will be fixed in 119118

BWbwchen added a commit to BWbwchen/nix-config that referenced this issue Sep 11, 2023
By set the `TZ` environment variable manually.

ref: NixOS/nixpkgs#238025 (comment)

Signed-off-by: Bo-Wei Chen(BWbwchen) <tim.chenbw@gmail.com>
@mweinelt
Copy link
Member

Fix targeted for 117.0.1.

@mweinelt mweinelt linked a pull request Sep 12, 2023 that will close this issue
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants