On 8/8/24 00:35, Sean C. Farley wrote:
On Thu, 1 Aug 2024, Ed Maste wrote:

The branch stable/14 has been updated by emaste:

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

commit fc43a1b6842afa806dfd7ba48de5bece63d04456
Author:     Ed Maste <[email protected]>
AuthorDate: 2022-10-14 16:44:35 +0000
Commit:     Ed Maste <[email protected]>
CommitDate: 2024-08-01 15:11:45 +0000

    tzsetup: symlink /etc/localtime instead of copying

    Using a symlink means that new timezone data (installed by an errata
    update, say) will be usable without having to be copied again.

    Reviewed by:    bapt, kevans, philip
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D37005

    (cherry picked from commit 5e16809c953f4cd19fadb1767469dec319de0353)

I ran across an issue with this when using "etcupdate -D" to update a
jail from the host.  "tzsetup -r -C /tmp/chroot", as called by
etcupdate, prepends the path of the chroot to the link which breaks
things inside the jail.

For example, if you run the following:
mkdir -p /tmp/chroot/etc
mkdir -p /tmp/chroot/usr/share
mkdir -p /tmp/chroot/var/db
ln -s /usr/share/misc /tmp/chroot/usr/share/misc
ln -s /usr/share/zoneinfo /tmp/chroot/usr/share/zoneinfo
cp /var/db/zoneinfo /tmp/chroot/var/db/.
tzsetup -C /tmp/chroot -r

The result will be the following:
/tmp/chroot/etc/localtime@ -> 
/tmp/chroot//usr/share/zoneinfo/America/Indiana/Indianapolis

Hmm, we also intentionally moved away from symlinks to copying many years ago.
We added /var/db/zoneinfo so that tzsetup -r would know which file to copy
into /etc after we moved away from the symlink I thought?

It looks like tzsetup switched to copying by default longer ago than I
remembered though in 1996 (commit c78cc02b89f6f5e562e5cf93d54faaa1bd79dfef),
though that replaced an older change that switched from copying to
symbolic links (2d71a1f121460406695c914b4f35e2e365010855).  Presumably though
-r shouldn't do anything if /etc/localtime is a symlink?  I thought the only
reason it was added was due to using copies:

commit ada5f18a1b161e4fd99966444f85ca51d5a3fd8a
Author: Edwin Groothuis <[email protected]>
Date:   Tue Oct 20 06:54:31 2009 +0000

    Instead of having to know which timezone was picked last time, you
    now can run "tzsetup -r" which will reinstall the last choice. This
    data is recorded in /var/db/zoneinfo.
MFC after: 1 week

Notes:
    svn path=/head/; revision=198267


--
John Baldwin


Reply via email to