Solved Timezone lost on upgrade to 13.2

So there's this weird code in install_zoneinfo_file():
Code:
        if (lstat(path_localtime, &sb) < 0) {
                /* Nothing there yet... */
                copymode = 1;
        } else if (S_ISLNK(sb.st_mode))
                copymode = 0;
        else
                copymode = 1;

As I read it, "if /etc/localtime exists and it's symlink, use symlink", and it dates back to ancient times with no explanation what could install the symlink originally.

Same weird logic is in bsdconfig (/usr/src/usr.sbin/bsdconfig/timezone/share/zones.subr):
Code:
        if [ -L "$_PATH_LOCALTIME" ]; then
                copymode=
        elif [ ! -e "$_PATH_LOCALTIME" ]; then
                # Nothing there yet...
                copymode=1
        else
                copymode=1
        fi

This still does not provide any hints why there would be a symlink originally.
 
yuripv79 it's a hint after all. Maybe some older bsdinstall version did it? Maybe I even did it myself when "fixing" something and don't remember? This installation lived for quite a few releases 😉

Could be possible that triggering this behavior of "losing" the timezone only works when it is a symlink...
 
So there's this weird code in install_zoneinfo_file():
Code:
        if (lstat(path_localtime, &sb) < 0) {
                /* Nothing there yet... */
                copymode = 1;
        } else if (S_ISLNK(sb.st_mode))
                copymode = 0;
        else
                copymode = 1;

As I read it, "if /etc/localtime exists and it's symlink, use symlink", and it dates back to ancient times with no explanation what could install the symlink originally.

How ancient? If it comes from the days of Jordan's sysinstall we'd be talking mid nineties ...

Same weird logic is in bsdconfig (/usr/src/usr.sbin/bsdconfig/timezone/share/zones.subr):
Code:
        if [ -L "$_PATH_LOCALTIME" ]; then
                copymode=
        elif [ ! -e "$_PATH_LOCALTIME" ]; then
                # Nothing there yet...
                copymode=1
        else
                copymode=1
        fi

Odd for Devin not to have dropped that redundant 'elif' clause in this rendering of the tzsetup.c code, having already leveraged 'test -L' checking both existence and being a symlink.

Anyway, it appears to mirror tzsetup functionality after that.

This still does not provide any hints why there would be a symlink originally.

Some old codger will know.

The other odd thing is that the existing symlink isn't checked to point anywhere sensible, it's just replaced.

None of which helps zirias@ unless he has older backups of /etc?
 
The other odd thing is that the existing symlink isn't checked to point anywhere sensible, it's just replaced.

Ah, unless the idea was to enable using a custom zoneinfo file, located elsewhere, for some user-defined purpose or test?

Then running tzsetup (or bsdconfig timezone) will reset the link to your usual zone, but leave the 'use symlink' mechanism in place?

Wild speculation, I admit ..
 
None of which helps zirias@ unless he has older backups of /etc?
I still have my old, 13.1 boot environment, so at least I can confirm it was a symlink before the upgrade:
Code:
nexus# bectl mount 13.1 /mnt/tmpdev 
Successfully mounted 13.1 at /mnt/tmpdev
nexus# ls -l /mnt/tmpdev/etc/localtime 
lrwxr-xr-x  1 root  wheel  33 19 Feb. 10:14 /mnt/tmpdev/etc/localtime -> /usr/share/zoneinfo/Europe/Berlin

It still doesn't explain why the timezone was broken after upgrade :-/ judging from the code posted above, by the time I ran tzsetup to fix the problem, it must still have been a symlink. To me, it remains a bit mysterious.

The other machines I upgraded had a copy in /etc/localtime and there were no issues (and the file actually changed), so somehow the upgrade process handled it correctly. Is this also done by etcupdate? :-/
 
Back
Top