From 8b146d6547ee5cf8049a7566efd75cd1df8314e7 Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Thu, 15 Jan 2026 13:56:07 +0000 Subject: Fix timezone::ntp_servers() when it is called more than once. The old implementation of get_ntp_server_tree() would add entries to %timezone for each leaf node it visited. So if ntp_servers() was called a second time, it would list those spurious entries. Fixed by stopping recursion immediately when a leaf node was found. --- perl-install/NEWS | 2 ++ perl-install/install/NEWS | 2 ++ perl-install/timezone.pm | 15 +++++++-------- 3 files changed, 11 insertions(+), 8 deletions(-) (limited to 'perl-install') diff --git a/perl-install/NEWS b/perl-install/NEWS index ff37b81f6..69d5f401b 100644 --- a/perl-install/NEWS +++ b/perl-install/NEWS @@ -1,3 +1,5 @@ +- fix timezone::ntp_servers() to return the correct list when called + more than once - drakclock: use UTC instead of GMT in dialogue (mga#6056) Version 18.71 - 5 January 2026 diff --git a/perl-install/install/NEWS b/perl-install/install/NEWS index e2760be8c..a67d460fb 100644 --- a/perl-install/install/NEWS +++ b/perl-install/install/NEWS @@ -1,3 +1,5 @@ +- fix incorrect timezone list when configureTimezone() is called more + than once - ask for user's timezone at the start of installation and correct the system clock accordingly (mga#34909) diff --git a/perl-install/timezone.pm b/perl-install/timezone.pm index faf769054..a18914755 100644 --- a/perl-install/timezone.pm +++ b/perl-install/timezone.pm @@ -150,14 +150,13 @@ our %ntp_servers; sub get_ntp_server_tree { my ($zone) = @_; map { - $ntp_servers{$zone}{$_} => ( - exists $ntp_servers{$_} ? - $zone ? - translate($_) . "|" . N("All servers") : - N("All servers") : - translate($zone) . "|" . translate($_) - ), - get_ntp_server_tree($_); + my $key = $ntp_servers{$zone}{$_}; + if (exists $ntp_servers{$_}) { + ( $key => $zone ? translate($_) . "|" . N("All servers") : N("All servers"), + get_ntp_server_tree($_) ); + } else { + ( $key => translate($zone) . "|" . translate($_) ); + } } keys %{$ntp_servers{$zone}}; } -- cgit v1.2.1