diff options
Diffstat (limited to 'debian')
-rw-r--r-- | debian/changelog | 7 | ||||
-rw-r--r-- | debian/patches/Correct-timezone-symlinks-when-using-BACKWARD-backward-PA.patch | 74 | ||||
-rw-r--r-- | debian/patches/series | 2 | ||||
-rw-r--r-- | debian/patches/ziguard.awk-Move-link-to-link-feature-from-vanguard-to-ma.patch | 39 | ||||
-rwxr-xr-x | debian/tests/python | 29 |
5 files changed, 111 insertions, 40 deletions
diff --git a/debian/changelog b/debian/changelog index 8aacfe5..8c23774 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +tzdata (2024a-3) unstable; urgency=medium + + * Avoid timezones being symlinks to symlinks to avoid breaking C++20 standard + expectation (LP: #2062522) + + -- Benjamin Drung <bdrung@debian.org> Fri, 19 Apr 2024 21:38:15 +0200 + tzdata (2024a-2~progress7.99u1) graograman-backports; urgency=medium * Uploading to graograman-backports, remaining changes: diff --git a/debian/patches/Correct-timezone-symlinks-when-using-BACKWARD-backward-PA.patch b/debian/patches/Correct-timezone-symlinks-when-using-BACKWARD-backward-PA.patch new file mode 100644 index 0000000..b8e9fa5 --- /dev/null +++ b/debian/patches/Correct-timezone-symlinks-when-using-BACKWARD-backward-PA.patch @@ -0,0 +1,74 @@ +From: Benjamin Drung <benjamin.drung@canonical.com> +Date: Wed, 3 Apr 2024 15:14:50 +0200 +Subject: Correct timezone symlinks when using BACKWARD=backward + PACKRATDATA=backzone + +When using BACKWARD=backward PACKRATDATA=backzone the symlinks might +point to the incorrect file (e.g. Africa/Asmera points to Africa/Nairobi +instead of Africa/Asmara). + +Move the link to link feature from vanguard to main dataform to produce +correct symlink (e.g. Africa/Asmera -> Africa/Asmara) in this case. Drop +those link from `backward` that would cause symlinks to symlinks. + +See https://bugs.launchpad.net/ubuntu/+source/tzdata/+bug/2062522 + +Forwarded: https://mm.icann.org/pipermail/tz/2024-April/058853.html +--- + backward | 6 +++--- + ziguard.awk | 4 ++-- + 2 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/backward b/backward +index 65c711b..08c95b1 100644 +--- a/backward ++++ b/backward +@@ -30,7 +30,7 @@ + # Pre-1993 naming conventions + + # Link TARGET LINK-NAME #= TARGET1 +-Link Australia/Sydney Australia/ACT #= Australia/Canberra ++Link Australia/Sydney Australia/ACT + Link Australia/Lord_Howe Australia/LHI + Link Australia/Sydney Australia/NSW + Link Australia/Darwin Australia/North +@@ -40,7 +40,7 @@ Link Australia/Hobart Australia/Tasmania + Link Australia/Melbourne Australia/Victoria + Link Australia/Perth Australia/West + Link Australia/Broken_Hill Australia/Yancowinna +-Link America/Rio_Branco Brazil/Acre #= America/Porto_Acre ++Link America/Rio_Branco Brazil/Acre + Link America/Noronha Brazil/DeNoronha + Link America/Sao_Paulo Brazil/East + Link America/Manaus Brazil/West +@@ -101,7 +101,7 @@ Link America/Mazatlan Mexico/BajaSur + Link America/Mexico_City Mexico/General + Link Pacific/Auckland NZ + Link Pacific/Chatham NZ-CHAT +-Link America/Denver Navajo #= America/Shiprock ++Link America/Denver Navajo + Link Asia/Shanghai PRC + Link Europe/Warsaw Poland + Link Europe/Lisbon Portugal +diff --git a/ziguard.awk b/ziguard.awk +index 7a3404f..f6b8d24 100644 +--- a/ziguard.awk ++++ b/ziguard.awk +@@ -340,7 +340,7 @@ function make_linkline(oldline, target, linkname, oldtarget, comment, \ + return "Link\t" target "\t" replsuffix comment + } + +-/^Link/ && $4 == "#=" && DATAFORM == "vanguard" { ++/^Link/ && $4 == "#=" && (DATAFORM != "rearguard") { + $0 = make_linkline($0, $5, $3, $2) + } + +@@ -378,7 +378,7 @@ function cut_link_chains_short( \ + } + + END { +- if (DATAFORM != "vanguard") { ++ if (DATAFORM == "rearguard") { + cut_link_chains_short() + } + for (i = 1; i <= NR; i++) diff --git a/debian/patches/series b/debian/patches/series index c9692cd..c81fc0c 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1 +1 @@ -ziguard.awk-Move-link-to-link-feature-from-vanguard-to-ma.patch +Correct-timezone-symlinks-when-using-BACKWARD-backward-PA.patch diff --git a/debian/patches/ziguard.awk-Move-link-to-link-feature-from-vanguard-to-ma.patch b/debian/patches/ziguard.awk-Move-link-to-link-feature-from-vanguard-to-ma.patch deleted file mode 100644 index e788c38..0000000 --- a/debian/patches/ziguard.awk-Move-link-to-link-feature-from-vanguard-to-ma.patch +++ /dev/null @@ -1,39 +0,0 @@ -From: Benjamin Drung <benjamin.drung@canonical.com> -Date: Wed, 3 Apr 2024 15:14:50 +0200 -Subject: ziguard.awk: Move link to link feature from vanguard to main - dataform - -When using BACKWARD=backward PACKRATDATA=backzone the symlinks might -point to the incorrect file (e.g. Africa/Asmera points to Africa/Nairobi -instead of Africa/Asmara). - -Move the link to link feature from vanguard to main dataform to produce -correct symlink (e.g. Africa/Asmera -> Africa/Asmara) in this case. - -Forwarded: https://mm.icann.org/pipermail/tz/2024-April/058853.html ---- - ziguard.awk | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/ziguard.awk b/ziguard.awk -index 7a3404f..f6b8d24 100644 ---- a/ziguard.awk -+++ b/ziguard.awk -@@ -340,7 +340,7 @@ function make_linkline(oldline, target, linkname, oldtarget, comment, \ - return "Link\t" target "\t" replsuffix comment - } - --/^Link/ && $4 == "#=" && DATAFORM == "vanguard" { -+/^Link/ && $4 == "#=" && (DATAFORM != "rearguard") { - $0 = make_linkline($0, $5, $3, $2) - } - -@@ -378,7 +378,7 @@ function cut_link_chains_short( \ - } - - END { -- if (DATAFORM != "vanguard") { -+ if (DATAFORM == "rearguard") { - cut_link_chains_short() - } - for (i = 1; i <= NR; i++) diff --git a/debian/tests/python b/debian/tests/python index 25044a9..bc4db3e 100755 --- a/debian/tests/python +++ b/debian/tests/python @@ -28,6 +28,12 @@ def read_backwards_links(backwards_file: pathlib.Path) -> dict[str, str]: return backwards_links +def read_link(link: pathlib.Path) -> pathlib.Path: + """Return the absolute path to which the symbolic link points.""" + destination = link.parent / link.readlink() + return pathlib.Path(os.path.normpath(destination)) + + class TestZoneinfo(unittest.TestCase): """Test timezones using Python's zoneinfo module.""" @@ -132,6 +138,28 @@ class TestZoneinfo(unittest.TestCase): future = now + datetime.timedelta(days=30 * 6) self._assert_equal_zones_at_date(future, tz_link, tz_target) + def assert_not_symlink_to_symlink(self, timezone_path: pathlib.Path) -> None: + """Assert that the timezone is not a symlink to another symlink.""" + if not timezone_path.is_symlink(): + return + destination = read_link(timezone_path) + if not destination.is_symlink(): + return + self.fail( + f"Symlink to symlink found: {timezone_path} -> {destination}" + f" -> {read_link(destination)}" + ) + + def test_no_symlinks_to_symlinks(self) -> None: + """Check that no timezone is a symlink to another symlink.""" + for timezone in sorted(zoneinfo.available_timezones()): + if timezone == "localtime": + continue + with self.subTest(timezone): + for tzpath in zoneinfo.TZPATH: + timezone_path = pathlib.Path(tzpath) / timezone + self.assert_not_symlink_to_symlink(timezone_path) + def test_timezones(self) -> None: """Test all zones to load, have a name, and have a reasonable offset.""" for zone in zoneinfo.available_timezones(): @@ -168,6 +196,7 @@ class TestZoneinfo(unittest.TestCase): date = datetime.datetime(2024, 3, 2, tzinfo=tzinfo) self.assertEqual(self._hours(date.utcoffset()), 5) + def main() -> None: """Run unit tests in verbose mode.""" argv = sys.argv.copy() |