[tz] macOS implements Links with file copies?
Deborah Goldsmith
goldsmit at apple.com
Sat Feb 13 00:56:56 UTC 2021
/usr/share/zoneinfo is a soft link:
% ls -l /usr/share/zoneinfo
lrwxr-xr-x 1 root wheel 25 Jan 1 2020 /usr/share/zoneinfo -> /var/db/timezone/zoneinfo
/var/db/timezone/zoneinfo is also a soft link:
% ls -l /var/db/timezone/zoneinfo
lrwxr-xr-x 1 root wheel 38 Feb 8 21:00 /var/db/timezone/zoneinfo -> /var/db/timezone/tz/2021a.1.0/zoneinfo
The reason for two soft links is that /usr/share is (currently) on a read-only volume, so /usr/share/zoneinfo must point at a fixed location.
/var/db/timezone/tz is where over-the-air time zone updates are stored. If there is no OTA time zone update installed, /var/db/timezone/zoneinfo points at /usr/share/zoneinfo.default.
The OTA time zone update distribution machinery does not currently support the preservation of hard links, so when /usr/share/zoneinfo points at an OTA update, there are no hard links. This is a known issue.
All of this is subject to change, of course.
Thanks,
Deborah
> On Feb 12, 2021, at 1:13 PM, Guy Harris <gharris at sonic.net> wrote:
>
> On Feb 12, 2021, at 1:01 PM, Emily Crandall Fleischman <emilycf at mit.edu> wrote:
>
>> It looks like Catalina (10.15.7) uses hard links:
>>
>> $ ls -li /usr/share/zoneinfo.default/US/Pacific /usr/share/zoneinfo.default/America/Los_Angeles
>> 1152921500311900283 -rw-r--r-- 3 root wheel 2819 Nov 9 2019 /usr/share/zoneinfo.default/America/Los_Angeles
>> 1152921500311900283 -rw-r--r-- 3 root wheel 2819 Nov 9 2019 /usr/share/zoneinfo.default/US/Pacific
>
> Depends on where you look:
>
> $ ls -li /usr/share/zoneinfo.default/US/Pacific /usr/share/zoneinfo.default/America/Los_Angeles
> 1152921500311900257 -rw-r--r-- 3 root wheel 2819 Oct 9 2019 /usr/share/zoneinfo.default/America/Los_Angeles
> 1152921500311900257 -rw-r--r-- 3 root wheel 2819 Oct 9 2019 /usr/share/zoneinfo.default/US/Pacific
> $ ls -li /usr/share/zoneinfo/America/Los_Angeles /usr/share/zoneinfo/US/Pacific
> 56302834 -rw-r--r-- 1 root wheel 2819 Oct 21 20:45 /usr/share/zoneinfo/America/Los_Angeles
> 56302650 -rw-r--r-- 1 root wheel 2819 Oct 21 20:45 /usr/share/zoneinfo/US/Pacific
>
> Deborah? Any idea what's going on here? For what it's worth, /usr/share/zoneinfo.default and /usr/share/zoneinfo are on different file systems:
>
> $ df /usr/share/zoneinfo.default
> Filesystem 512-blocks Used Available Capacity iused ifree %iused Mounted on
> /dev/disk1s1 15633066472 21990936 11080851032 1% 488348 78164844012 0% /
> $ df /usr/share/zoneinfo
> Filesystem 512-blocks Used Available Capacity iused ifree %iused Mounted on
> /dev/disk1s2 15633066472 4497237704 11080851032 29% 11077044 78154255316 0% /System/Volumes/Data
>
More information about the tz
mailing list