Subject: bug#79437: 30.2; world-clock silently and incorrectly parses invalid time zone

From: Eli Zaretskii <[email-masked]>
Date: Sun, 14 Sep 2025 08:24:45 +0300

> From: Jorge P. de Morais Neto <[email-masked]>
> Cc: [email-masked]
> Date: Sat, 13 Sep 2025 20:56:44 -0300
> 
> Hi.  I reply below:
> 
> Em [2025-09-13 sáb 08:05:55-0700], Paul Eggert escreveu:
> 
> > No, as we merely need to check whether the TZ setting matches a time
> > zone file. (This is for the typical case where each named time zone
> > has a file; Android would be different.)
> >
> > Yeah, probably not worth the hassle.
> 
> I am an IT infrastructure analyst and not a software developer, so I am
> unsure whether to opine on the bug's solution, but what "hassle" are you
> talking about?
> 
> A. Development time;
> B. code complexity; or
> C. runtime cost?
> 
> Anyway, I see many possible solutions and workarounds:
> 
> 1. `world-clock' could check the timezone name is valid, and warn in
>    case it is not.

The time display runs from a timer.  Signaling errors from a timer
function is not very useful, and quite annoying.

> 2. custom.el could validate `zoneinfo-style-world-list' when it is set.

How can one do that?  The doc string of world-clock-list says:

  TIMEZONE should be in a format supported by your system.  See the
  documentation of `zoneinfo-style-world-list' and
  `legacy-style-world-list' for two widely used formats.

"Format supported by your system" could be anything defined by Posix
(and potentially non-Posix extensions as well).  According to Posix,
the format of the time-zone definition could be one of these:

     a string of the format "stdoffset[dst[offset][,start[/time],end[/time]]]"
 or:
     the name of a zoneinfo file "Area/Location"
 or:
     :characters (which are "interpreted in implementation-defined manner")

Only the second one can be checked relatively easily by looking in the
directory where the zoneinfo files are installed.  But how does one
validate the other 2 forms?  And how does one know which format iz
used to begin with?

> 3. The docstring of `zoneinfo-style-world-list' and `world-clock' could
>    warn the user about the problem.
> 
> I believe 3 should be implemented in any case.  Ideally it would be
> combined with 1, 2, or preferably both.

We can do 3, sure; done.  The other two "aren't worth the hassle",
IMO.