Closed Bug 1817701 Opened 2 years ago Closed 2 years ago

No daylight savings with Firefox snap when /etc/localtime is a regular file

Categories

(Firefox Build System :: Third Party Packaging, defect)

Firefox 110
x86_64
Linux
defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: mozbugs, Unassigned)

References

(Blocks 2 open bugs, )

Details

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

Steps to reproduce:

In Xubuntu 22.04 I used time-admin to set the timezone to Australia/Sydney. I started Firefox, using the snap version 110.0-3. I noticed that the time reported by the browser was incorrect. It was off by one hour, as if daylight savings time was not in effect.

I installed Firefox nightly but was not able to reproduce the problem. I suspect that it is specific to the snap package.

I discovered that the problem only occurs if /etc/localtime is a regular file. time-admin uses system-tools-backends to set the timezone, which contains the Perl code:

unlink $localtime;  # Important, since it might be a symlink.

&Utils::Report::enter ();
$res = copy ($tz, $localtime);
&Utils::Report::leave ();

Arguably this is the wrong way to update the timezone, since man localtime(5) says that /etc/localtime should be a symlink. But it is old code, with a copyright date of 2000-2001, and is apparently widely used.

To reproduce, make /etc/localtime be a regular file:

sudo rm /etc/localtime
sudo cp /usr/share/zoneinfo/Australia/Sydney /etc/localtime

Start firefox from the snap, and in the console, type

new Date()

Actual results:

Date Mon Feb 20 2023 11:26:19 GMT+1000 (GMT+10:00)

Expected results:

Date Mon Feb 20 2023 12:26:19 GMT+1100 (GMT+11:00)

The Bugbug bot thinks this bug should belong to the 'Core::Widget: Gtk' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Widget: Gtk
Product: Firefox → Core

The libc in the container is 2.31-0ubuntu9.9 from the "core20" snap. The libc in the host is 2.35-0ubuntu3.1. When /etc/localtime is a regular file, it is copied into the container and read by libc 2.31. Evidently libc 2.31 has a limited ability to read zoneinfo files made by libc 2.35.

Using a more recent libc would probably fix it.

Component: Widget: Gtk → Third Party Packaging
OS: Unspecified → Linux
Product: Core → Firefox Build System
Hardware: Unspecified → x86_64

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

For more information, please visit auto_nag documentation.

Flags: needinfo?(lissyx+mozillians)
Flags: needinfo?(lissyx+mozillians)

Amin, there's an upstream patch, can you have a look ?

Flags: needinfo?(bandali)

Note that the real upstream is https://system-tools-backends.freedesktop.org/ , which hasn't had a release or a commit to its git repo since 2009. It's not used by Gnome anymore, but it's still used by Xubuntu (Xfce). The Debian package has been updated more recently, with a patch added in 2016. I filed my bug against the Ubuntu package because forcing Firefox users to use Snap is an Ubuntu decision, Debian is not doing that.

Thanks, the patch has been applied. Though, based on the above descriptions, this issue might be mitigated with our upcoming switch from core20 to core22 for the Firefox snap anyway.

Flags: needinfo?(bandali)

Thanks all, I'm going to mark this as fixed now since the patch was applied. Please reopen if the issue persists

Status: UNCONFIRMED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.