From ebd82d28f8f10c36f4c377a15879d0b8fb3536cc Mon Sep 17 00:00:00 2001 From: eabdullin Date: Mon, 15 Sep 2025 12:54:10 +0000 Subject: [PATCH] import CS tzdata-2025b-2.el9 --- .gitignore | 4 +- .tzdata.metadata | 4 +- SOURCES/ZoneTest.java | 42 +++++++++++++++ SOURCES/javazic-harden-links.patch | 86 ++++++++++++++++++++++++++++++ SPECS/tzdata.spec | 65 ++++++++++++++++++++-- 5 files changed, 193 insertions(+), 8 deletions(-) create mode 100644 SOURCES/ZoneTest.java create mode 100644 SOURCES/javazic-harden-links.patch diff --git a/.gitignore b/.gitignore index 8b3e0fb..a55cde2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ SOURCES/javazic-1.8-37392f2f5d59.tar.xz SOURCES/javazic.tar.gz -SOURCES/tzcode2024a.tar.gz -SOURCES/tzdata2024a.tar.gz +SOURCES/tzcode2025b.tar.gz +SOURCES/tzdata2025b.tar.gz diff --git a/.tzdata.metadata b/.tzdata.metadata index b4c6e03..1913b75 100644 --- a/.tzdata.metadata +++ b/.tzdata.metadata @@ -1,4 +1,4 @@ 77292e1839952807567570118e01405b405af80c SOURCES/javazic-1.8-37392f2f5d59.tar.xz ee8ad215161cd132e65e2be447b279457158b540 SOURCES/javazic.tar.gz -96c682391618d0f053d70ccb98cd65d969d014cd SOURCES/tzcode2024a.tar.gz -310a281e4551e4e9a11db4f9ceea85a6529af4af SOURCES/tzdata2024a.tar.gz +30ede27ab7d353270714e6eec2eb36b712c53426 SOURCES/tzcode2025b.tar.gz +619f59455fc146b9882a03fb9db2b7a044b5fcd6 SOURCES/tzdata2025b.tar.gz diff --git a/SOURCES/ZoneTest.java b/SOURCES/ZoneTest.java new file mode 100644 index 0000000..e690728 --- /dev/null +++ b/SOURCES/ZoneTest.java @@ -0,0 +1,42 @@ +/* Smoke test to ensure that tzdb.data can be loaded. + Copyright (c) 2024 Red Hat, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . */ + + +import java.time.zone.ZoneRulesProvider; +import java.util.Calendar; +import java.util.GregorianCalendar; +import java.util.Locale; +import java.util.Set; +import java.util.TimeZone; + +public class ZoneTest { + public static void main(String[] args) { + // This is what failed in OpenJDK's build.tools.cldrconverter. + new GregorianCalendar(TimeZone.getTimeZone("America/Los_Angeles"), + Locale.US).get(Calendar.YEAR); + + // In some OpenJDK versions, this exercises a different parser. + Set available = ZoneRulesProvider.getAvailableZoneIds(); + boolean errors = false; + if (available.contains("ROC")) + System.out.println("error: ROC zone is present"); + if (!available.contains("America/New_York")) + System.out.println("error: America/New_York is missing"); + if (errors) + System.exit(1); + } +} + diff --git a/SOURCES/javazic-harden-links.patch b/SOURCES/javazic-harden-links.patch new file mode 100644 index 0000000..0d8d76b --- /dev/null +++ b/SOURCES/javazic-harden-links.patch @@ -0,0 +1,86 @@ +Modified for downstream inclusion in tzdata-java. + +commit 1bc13a1c10a580f84f1b7686c95344ec2633f611 +Author: Florian Weimer +Date: Thu Sep 26 22:37:45 2024 +0000 + + 8340552: Harden TzdbZoneRulesCompiler against missing zone names + + Reviewed-by: andrew, jlu, naoto + +diff -ur tzdata-2024b.orig/javazic-1.8/build/tools/tzdb/TzdbZoneRulesCompiler.java tzdata-2024b/javazic-1.8/build/tools/tzdb/TzdbZoneRulesCompiler.java +--- tzdata-2024b.orig/javazic-1.8/build/tools/tzdb/TzdbZoneRulesCompiler.java 2014-04-22 19:46:49.000000000 +0200 ++++ tzdata-2024b/javazic-1.8/build/tools/tzdb/TzdbZoneRulesCompiler.java 2024-09-20 21:10:12.748483767 +0200 +@@ -248,7 +248,7 @@ + // link version-region-rules + out.writeShort(builtZones.size()); + for (Map.Entry entry : builtZones.entrySet()) { +- int regionIndex = Arrays.binarySearch(regionArray, entry.getKey()); ++ int regionIndex = findRegionIndex(regionArray, entry.getKey()); + int rulesIndex = rulesList.indexOf(entry.getValue()); + out.writeShort(regionIndex); + out.writeShort(rulesIndex); +@@ -256,8 +256,8 @@ + // alias-region + out.writeShort(links.size()); + for (Map.Entry entry : links.entrySet()) { +- int aliasIndex = Arrays.binarySearch(regionArray, entry.getKey()); +- int regionIndex = Arrays.binarySearch(regionArray, entry.getValue()); ++ int aliasIndex = findRegionIndex(regionArray, entry.getKey()); ++ int regionIndex = findRegionIndex(regionArray, entry.getValue()); + out.writeShort(aliasIndex); + out.writeShort(regionIndex); + } +@@ -269,6 +269,14 @@ + } + } + ++ private static int findRegionIndex(String[] regionArray, String region) { ++ int index = Arrays.binarySearch(regionArray, region); ++ if (index < 0) { ++ throw new IllegalArgumentException("Unknown region: " + region); ++ } ++ return index; ++ } ++ + private static final Pattern YEAR = Pattern.compile("(?i)(?min)|(?max)|(?only)|(?[0-9]+)"); + private static final Pattern MONTH = Pattern.compile("(?i)(jan)|(feb)|(mar)|(apr)|(may)|(jun)|(jul)|(aug)|(sep)|(oct)|(nov)|(dec)"); + private static final Matcher DOW = Pattern.compile("(?i)(mon)|(tue)|(wed)|(thu)|(fri)|(sat)|(sun)").matcher(""); +@@ -607,22 +615,20 @@ + } + builtZones.put(aliasId, realRules); + } +- // remove UTC and GMT +- // builtZones.remove("UTC"); +- // builtZones.remove("GMT"); +- // builtZones.remove("GMT0"); +- builtZones.remove("GMT+0"); +- builtZones.remove("GMT-0"); +- links.remove("GMT+0"); +- links.remove("GMT-0"); +- // remove ROC, which is not supported in j.u.tz +- builtZones.remove("ROC"); +- links.remove("ROC"); +- // remove EST, HST and MST. They are supported via +- // the short-id mapping +- builtZones.remove("EST"); +- builtZones.remove("HST"); +- builtZones.remove("MST"); ++ ++ List zonesToRemove = Arrays.asList( ++ // remove UTC and GMT ++ "GMT+0", ++ "GMT-0", ++ // remove ROC, which is not supported in j.u.tz ++ "ROC", ++ // remove EST, HST and MST. They are supported via ++ // the short-id mapping ++ "EST", ++ "HST", ++ "MST"); ++ builtZones.keySet().removeAll(zonesToRemove); ++ links.keySet().removeAll(zonesToRemove); + } + + /** + diff --git a/SPECS/tzdata.spec b/SPECS/tzdata.spec index 4161100..9a470b3 100644 --- a/SPECS/tzdata.spec +++ b/SPECS/tzdata.spec @@ -1,8 +1,8 @@ Summary: Timezone data Name: tzdata -Version: 2024a -%define tzdata_version 2024a -%define tzcode_version 2024a +Version: 2025b +%define tzdata_version 2025b +%define tzcode_version 2025b Release: 2%{?dist} License: Public Domain URL: https://www.iana.org/time-zones @@ -15,6 +15,7 @@ Patch003: 0003-continue-to-ship-posixrules.patch %endif BuildRequires: make +BuildRequires: gcc BuildRequires: gawk, glibc, perl-interpreter BuildRequires: java-devel BuildRequires: glibc-common >= 2.5.90-7 @@ -29,12 +30,14 @@ the world. Summary: Timezone data for Java Source3: javazic.tar.gz Source4: javazic-1.8-37392f2f5d59.tar.xz +Source5: ZoneTest.java Patch100: javazic-fixup.patch Patch101: rebase-01.patch Patch102: rebase-02.patch Patch103: 7090844.patch Patch104: 7133138.patch Patch105: 8051641.patch +Patch106: javazic-harden-links.patch %description java This package contains timezone information for use by Java runtimes. @@ -84,6 +87,7 @@ popd tar xf %{SOURCE4} %patch105 +%patch106 -p1 echo "%{name}%{tzdata_version}" >> VERSION @@ -114,7 +118,7 @@ JAVA_FILES="rearguard/africa rearguard/antarctica rearguard/asia \ # Java 6/7 tzdata pushd javazic -javac -source 1.6 -target 1.6 -classpath . `find . -name \*.java` +javac -classpath . `find . -name \*.java` popd java -classpath javazic/ rht.tools.javazic.Main -V %{version} \ @@ -140,10 +144,30 @@ cp -prd javazi $RPM_BUILD_ROOT%{_datadir}/javazi mkdir -p $RPM_BUILD_ROOT%{_datadir}/javazi-1.8 install -p -m 644 tzdb.dat $RPM_BUILD_ROOT%{_datadir}/javazi-1.8/ +%check +echo ============TESTING=============== +/usr/bin/env LANG=C make -k VALIDATE=':' check && true + +# Create a custom JAVA_HOME, where we can replace tzdb.dat with the +# one just built, for testing. +system_java_home=$(dirname $(readlink -f $(which java)))/.. +mkdir -p java_home +cp -Lr $system_java_home/* java_home/. +for tzdb in $(find java_home -name tzdb.dat) ; do + rm $tzdb + cp $RPM_BUILD_ROOT%{_datadir}/javazi-1.8/tzdb.dat $tzdb +done +# Compile the smoke test and run it. +cp %{SOURCE5} . +javac ZoneTest.java +java_home/bin/java ZoneTest +echo ============END TESTING=========== + %files %{_datadir}/zoneinfo %license LICENSE %doc README +%doc NEWS %doc theory.html %doc tz-link.html %doc tz-art.html @@ -153,6 +177,39 @@ install -p -m 644 tzdb.dat $RPM_BUILD_ROOT%{_datadir}/javazi-1.8/ %{_datadir}/javazi-1.8 %changelog +* Wed Jul 30 2025 Patsy Griffin - 2025b-2 +- Included NEWS file with docs. (RHEL-105043) + +* Mon Mar 24 2025 Patsy Griffin - 2025b-1 +- Update to tzdata-2025b (RHEL-84741) + - Chile's Aysén Region moves from -04/-03 + to -03 year-round, diverging from America/Santiago and + creating a new zone America/Coyhaique. + +* Tue Jan 21 2025 Patsy Griffin - 2025a-1 + Update to tzdata-2025a (RHEL-74308) + - Paraguay is now permanently at -03. This impacts timestamps + starting on 2025-03-22. + - Includes improvements to pre-1991 data for the Philippines. + - Etc/Unknown is now reserved. + +* Fri Dec 06 2024 Patsy Griffin - 2024b-3 +- Don't use -source 1.6 and -target 1.6 with javac. (RHEL-70308) + +* Fri Sep 27 2024 Patsy Griffin - 2024b-2 +- Harden against links to removed zones (RHEL-60063) + +* Wed Sep 11 2024 Patsy Griffin - 2024b-1 +- Update to tzdata-2024b + - Improve historical data for Mexico, Mongolia, and Portugal. + - System V names are now obsolescent. + - The main data form now uses %z. + - The code now conforms to RFC 8536 for early timestamps. + - Support POSIX.1-2024, which removes asctime_r and ctime_r. + - Assume POSIX.2-1992 or later for shell scripts. + - SUPPORT_C89 now defaults to 1. + - Include two upstream patches for month names as in April vs Apr. + * Thu Mar 14 2024 Patsy Griffin - 2024a-2 - Add java patch to fix incorrect calculations for Africa/Casablanca starting in 2027. (RHEL-26860)