canonical / core-base

The main repository for ubuntu-core base snaps. It contains snaps from core22+.
https://ubuntu.com/core/docs
25 stars 43 forks source link

Chromium-based apps can't read timezone in certain timezone #163

Open peat-psuwit opened 11 months ago

peat-psuwit commented 11 months ago

Step to reproduce:

  1. Setup an Ubuntu Core 22 VM. Then, set timezone to "Asia/Bangkok": sudo timedatectl set-timezone Asia/Bangkok.
  2. Install ubuntu-frame. Then, build and install the Electron version of iot-example-graphical-snap [1].
  3. Start the snap. Go to "View > Toggle Developer Tools". Then, go to "Console" tab and type: new Date().
    • Expected result: the time is 7 hours ahead of UTC, and ends with "GMT+0700 (Indochina Time)".
    • Actual result: the time is in UTC, and ends with "GMT+0000 (GMT)".

I have a full analysis, done under Ubuntu Touch which also use writable-paths system, at [2]. But basically, ICU tries to determine the timezone by reading symlink target of /etc/localtime, which then fails. This isn't failure on its own (it can still understand +07 from GLibC), but then Chromium tries to pass +07 to Zygote process, which ICU can't deserialize back to a timezone falling back to Etc/Unknown.

We can either patch ICU so that it understand /etc/writable redirection (similar to what we've done with systemd), or patch Chromium to correct the passed zone ID (to something like GMT+07) turns out you can't do that because of time zone abbreviation collision (e.g. PST = Pacific Standard Time = Philippines Standard Time). I feel like patching ICU could have a wider effect and would make stuff more functional.

To see the effect of the ICU problem alone, installs wpe-webkit-mir-kiosk instead and run snap set wpe-webkit-mir-kiosk url="https://www.w3schools.com/js/tryit.asp?filename=tryjs_date_current".

[1] https://github.com/MirServer/iot-example-graphical-snap/tree/22/Electron-quick-start [2] https://gitlab.com/ubports/development/core/packaging/qtwebengine/-/issues/15

peat-psuwit commented 10 months ago

Ping the developer.

peat-psuwit commented 9 months ago

Ping the developers.