Bug 236874 - [installer] The country Cyprus in timezone settings is in wrong continent.
Summary: [installer] The country Cyprus in timezone settings is in wrong continent.
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Many People
Assignee: Ed Maste
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-03-29 10:09 UTC by Christos Petrou
Modified: 2024-01-22 14:26 UTC (History)
3 users (show)

See Also:
emaste: mfc-stable13-


Attachments
Cyprus in the list. (89.10 KB, image/png)
2019-03-29 10:09 UTC, Christos Petrou
no flags Details
0001-tzsetup-add-support-for-countries-in-two-continents.patch (3.45 KB, patch)
2023-07-27 16:13 UTC, Pierre Pronchery
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Christos Petrou 2019-03-29 10:09:35 UTC
Created attachment 203238 [details]
Cyprus in the list.

Hello,

I am from Cyprus and when i went to choose my country it was not in Europe where it should be located but instead it was in Asia. All people in Cyprus expect to find Cyprus in Europe as we are a European Nation and we are also in the European Union.

Could you please move Cyprus from Asia section to Europe section.
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2019-05-25 05:10:20 UTC
Reclassify.
Comment 2 Pierre Pronchery 2023-07-27 12:47:37 UTC
I have just investigated this a bit now, and found that FreeBSD is not directly responsible for this behaviour. There is a catch and possible solution however.

First, what the installer really does is call tzsetup(8) from the installation step `time` (as in the script in `src/bsdinstall/scripts/time`). This in turn calls tzsetup from within the newly installed system, with chroot(8):

```sh
 33 # Select timezone
 34 chroot $BSDINSTALL_CHROOT tzsetup
```

So this bug should really be filed to tzsetup(8), where the `src/usr.sbin/tzsetup/baseline` file effectively lists Cyprus in Asia. However, the `baseline` file is generated from the database in `src/contrib/zone1970.tab`, which comes from outside the project.

As it turns out, this "tz database" (https://en.wikipedia.org/wiki/Tz_database) is a public project, and a de facto standard across most major Operating Systems. This is where Cyprus is listed as a part of Asia:

```
CY      +3510+03322     Asia/Nicosia    most of Cyprus
CY      +3507+03357     Asia/Famagusta  Northern Cyprus
```

"Determining the boundaries between the continents is generally a matter of geographical convention" and this is also where the corresponding Wikipedia article situates Cyprus as well (https://en.wikipedia.org/wiki/Boundaries_between_the_continents).

With this in mind, I can see two different ways to go about this issue.

1. As far as I can tell, you are free to ask for the decision to place Cyprus in Asia in the tz database to be reconsidered; after all, Istanbul was placed in Europe (as "Europe/Istanbul") according to this list. This means residents of the Anatolian region of Türkiye have to choose their timezone under "Europe", extending the scope of this issue to them as well.

2. Another way to look at this situation was already envisioned by the maintainers of the tz database: listing some locations in more than one continent (or "area" really). From the `zone1970.tab` file, one can read the following comments:

```
# The next section contains experimental tab-separated comments for
# use by user agents like tzselect that identify continents and oceans.
[...]
# If more than one country code is affected each is listed separated
# by commas, e.g., #@IS,SH<tab>Atlantic/".  If a country code is in
# more than one continent or ocean, each is listed separated by
# commas, e.g., the second column of "#@CY,TR<tab>Asia/,Europe/".
```

And then:

```
#@CY,TR Asia/,Europe/
```

As you can see, this means both Cyprus and Türkiye should effectively be listed in both the Asia and Europe areas. Therefore tzsetup(8) should be taught about these special comments, and reflect them in the selection process. The corresponding timezone will remain known as "Asia/Nicosia" or "Asia/Famagusta" though. (That is, unless it is officially changed as per 1.)
Comment 3 Pierre Pronchery 2023-07-27 16:13:58 UTC
Created attachment 243651 [details]
0001-tzsetup-add-support-for-countries-in-two-continents.patch

This patch adds support for countries to be listed in an extra continent, according to the zone1970.tab file. This only affects Cyprus and Türkiye at the moment.
Comment 4 Jessica Clarke freebsd_committer freebsd_triage 2023-07-28 19:38:47 UTC
Your patch only handles a single extra continent but the file format supports multiple (even if in practice it isn't used).
Comment 5 Pierre Pronchery 2023-07-31 11:02:58 UTC
(In reply to Jessica Clarke from comment #4)

You are absolutely right. I was hoping this was going to be good enough for now, since as per the current geopolitical and tectonic situation, the maximum amount of areas any country is situated in is indeed two as reflected in the file; it only affects Cyprus and Türkiye.

A better solution would probably involve turning this `extra` struct member to a linked list, and thus support countries located in multiple continents.

Let me know if I should revisit this; I am planning on uploading the patch on reviews.freebsd.org in the next few hours.
Comment 6 Pierre Pronchery 2023-08-03 20:39:59 UTC
This is now review D41306; we can gladly iterate reviews and improvements there.
Comment 7 commit-hook freebsd_committer freebsd_triage 2023-10-13 17:25:02 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=914ab28c598c108bcfa5c040cc3056a8e6fc3811

commit 914ab28c598c108bcfa5c040cc3056a8e6fc3811
Author:     Pierre Pronchery <pierre@freebsdfoundation.org>
AuthorDate: 2023-07-27 16:07:22 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2023-10-13 17:23:59 +0000

    tzsetup: add support for countries in two continents

    This supports countries located across multiple continents, as per the
    zone1970.tab file. This only affects Cyprus and Türkiye at the moment.

    PR:             236874
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D41306

 usr.sbin/tzsetup/tzsetup.c | 67 +++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 61 insertions(+), 6 deletions(-)
Comment 8 commit-hook freebsd_committer freebsd_triage 2023-10-16 12:30:33 UTC
A commit in branch stable/14 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=9ef162b2392f34a88fb40b560ef700d0aacadfe1

commit 9ef162b2392f34a88fb40b560ef700d0aacadfe1
Author:     Pierre Pronchery <pierre@freebsdfoundation.org>
AuthorDate: 2023-07-27 16:07:22 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2023-10-16 12:29:46 +0000

    tzsetup: add support for countries in two continents

    This supports countries located across multiple continents, as per the
    zone1970.tab file. This only affects Cyprus and Türkiye at the moment.

    PR:             236874
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D41306

    (cherry picked from commit 914ab28c598c108bcfa5c040cc3056a8e6fc3811)

 usr.sbin/tzsetup/tzsetup.c | 67 +++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 61 insertions(+), 6 deletions(-)
Comment 9 commit-hook freebsd_committer freebsd_triage 2023-10-16 22:48:42 UTC
A commit in branch releng/14.0 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=c886dfb048f9dd97d418c280d2aea1f5f4752d3e

commit c886dfb048f9dd97d418c280d2aea1f5f4752d3e
Author:     Pierre Pronchery <pierre@freebsdfoundation.org>
AuthorDate: 2023-07-27 16:07:22 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2023-10-16 22:47:48 +0000

    tzsetup: add support for countries in two continents

    This supports countries located across multiple continents, as per the
    zone1970.tab file. This only affects Cyprus and Türkiye at the moment.

    PR:             236874
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D41306

    (cherry picked from commit 914ab28c598c108bcfa5c040cc3056a8e6fc3811)
    (cherry picked from commit 9ef162b2392f34a88fb40b560ef700d0aacadfe1)

    Approved by:    re (karels)

 usr.sbin/tzsetup/tzsetup.c | 67 +++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 61 insertions(+), 6 deletions(-)
Comment 10 Mark Linimon freebsd_committer freebsd_triage 2023-12-27 12:07:00 UTC
^Triage: assign to committer that resolved.  Set mfc-stable13 flag as a possible reminder.
Comment 11 Ed Maste freebsd_committer freebsd_triage 2024-01-22 14:26:47 UTC
Thank you for reporting this issue.

The change does not apply cleanly to stable/13 (due to tzsetup rework to use bsddialog). The fix for this issue is thus available only in 14.0 and later.