• Andrew Gierth's avatar
    Prefer timezone name "UTC" over alternative spellings. · e3846a00
    Andrew Gierth authored
    tzdb 2019a made "UCT" a link to the "UTC" zone rather than a separate
    zone with its own abbreviation. Unfortunately, our code for choosing a
    timezone in initdb has an arbitrary preference for names earlier in
    the alphabet, and so it would choose the spelling "UCT" over "UTC"
    when the system is running on a UTC zone.
    
    Commit 23bd3cec was backpatched in order to address this issue, but
    that code helps only when /etc/localtime exists as a symlink, and does
    nothing to help on systems where /etc/localtime is a copy of a zone
    file (as is the standard setup on FreeBSD and probably some other
    platforms too) or when /etc/localtime is simply absent (giving UTC as
    the default).
    
    Accordingly, add a preference for the spelling "UTC", such that if
    multiple zone names have equally good content matches, we prefer that
    name before applying the existing arbitrary rules. Also add a slightly
    lower preference for "Etc/UTC"; lower because that preserves the
    previous behaviour of choosing the shorter name, but letting us still
    choose "Etc/UTC" over "Etc/UCT" when both exist but "UTC" does
    not (not common, but I've seen it happen).
    
    Backpatch all the way, because the tzdb change that sparked this issue
    is in those branches too.
    e3846a00
findtimezone.c 43.8 KB