Re: Ignoring symlinks when recovering time zone identifiers in initdb

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Florian Weimer <fw(at)deneb(dot)enyo(dot)de>
Cc: pgsql-hackers(at)postgresql(dot)org, Andrew Gierth <rhodiumtoad(at)postgresql(dot)org>
Subject: Re: Ignoring symlinks when recovering time zone identifiers in initdb
Date: 2025-09-14 15:55:42
Message-ID: 417903.1757865342@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Florian Weimer <fw(at)deneb(dot)enyo(dot)de> writes:
> There's a story making the rounds that the removal of the
> /usr/share/zoneinfo/US/Pacific etc. in Debian broke installations.
> These identifiers should not be used, but they may get picked by
> initdb if they are shorter than the alternatives.

Ugh. (Fortunately, I don't think fixing this is any harder than
editing the timezone entries in postgresql.conf.)

> The length-based
> tie breaking was introduced in commit e3846a00c2f ("Prefer timezone
> name "UTC" over alternative spellings.").

Just for the record, it's far older than that. Looks like it
dates to 2def4552e from 2004.

> Would it make sense to ignore symbolic links when searching for the
> time zone identifier under /usr/share/zoneinfo in scan_available_timezones?

That seems only vaguely related to the problem. If a distro
arbitrarily decides they can remove some zoneinfo entries,
that's going to break someone. Also, it's common to implement
zone links as hardlinks not symlinks (Red Hat, for one, does
it that way), in which case this heuristic won't help at all.
I'd just as soon not introduce a behavior that will result in
choosing different zone names on different platforms even
when they have logically-equivalent zoneinfo contents.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2025-09-14 16:21:10 Re: Ignoring symlinks when recovering time zone identifiers in initdb
Previous Message Jonathan S. Katz 2025-09-14 13:57:54 Re: PostgreSQL 18 GA press release draft