summaryrefslogtreecommitdiffstats
path: root/intl/icu-patches/bug-1856428-ICU-22541.diff
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /intl/icu-patches/bug-1856428-ICU-22541.diff
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'intl/icu-patches/bug-1856428-ICU-22541.diff')
-rw-r--r--intl/icu-patches/bug-1856428-ICU-22541.diff39
1 files changed, 39 insertions, 0 deletions
diff --git a/intl/icu-patches/bug-1856428-ICU-22541.diff b/intl/icu-patches/bug-1856428-ICU-22541.diff
new file mode 100644
index 0000000000..64c98c3e10
--- /dev/null
+++ b/intl/icu-patches/bug-1856428-ICU-22541.diff
@@ -0,0 +1,39 @@
+# Fix MacOS 14 default timezone issue
+#
+# ICU bug: https://unicode-org.atlassian.net/browse/ICU-22541
+
+diff --git a/intl/icu/source/common/putil.cpp b/intl/icu/source/common/putil.cpp
+--- a/intl/icu/source/common/putil.cpp
++++ b/intl/icu/source/common/putil.cpp
+@@ -1170,16 +1170,31 @@ uprv_tzname(int n)
+ This is a trick to look at the name of the link to get the Olson ID
+ because the tzfile contents is underspecified.
+ This isn't guaranteed to work because it may not be a symlink.
+ */
+ char *ret = realpath(TZDEFAULT, gTimeZoneBuffer);
+ if (ret != nullptr && uprv_strcmp(TZDEFAULT, gTimeZoneBuffer) != 0) {
+ int32_t tzZoneInfoTailLen = uprv_strlen(TZZONEINFOTAIL);
+ const char *tzZoneInfoTailPtr = uprv_strstr(gTimeZoneBuffer, TZZONEINFOTAIL);
++ // MacOS14 has the realpath as something like
++ // /usr/share/zoneinfo.default/Australia/Melbourne
++ // which will not have "/zoneinfo/" in the path.
++ // Therefore if we fail, we fall back to read the link which is
++ // /var/db/timezone/zoneinfo/Australia/Melbourne
++ // We also fall back to reading the link if the realpath leads to something like
++ // /usr/share/zoneinfo/posixrules
++ if (tzZoneInfoTailPtr == nullptr ||
++ uprv_strcmp(tzZoneInfoTailPtr + tzZoneInfoTailLen, "posixrules") == 0) {
++ ssize_t size = readlink(TZDEFAULT, gTimeZoneBuffer, sizeof(gTimeZoneBuffer)-1);
++ if (size > 0) {
++ gTimeZoneBuffer[size] = 0;
++ tzZoneInfoTailPtr = uprv_strstr(gTimeZoneBuffer, TZZONEINFOTAIL);
++ }
++ }
+ if (tzZoneInfoTailPtr != nullptr) {
+ tzZoneInfoTailPtr += tzZoneInfoTailLen;
+ skipZoneIDPrefix(&tzZoneInfoTailPtr);
+ if (isValidOlsonID(tzZoneInfoTailPtr)) {
+ return (gTimeZoneBufferPtr = tzZoneInfoTailPtr);
+ }
+ }
+ } else {