[tz] macOS implements Links with file copies?

Russ Allbery eagle at eyrie.org
Fri Feb 12 21:24:35 UTC 2021


Paul Eggert <eggert at cs.ucla.edu> writes:

> whereas Ubuntu (and I assume Debian) use less-efficient symbolic links:

> $ ls -li /usr/share/zoneinfo/America/Los_Angeles
> /usr/share/zoneinfo/US/Pacific
> 1182409 -rw-r--r-- 1 root root 2836 Jan 27 11:53
> /usr/share/zoneinfo/America/Los_Angeles
> 1206418 lrwxrwxrwx 1 root root   22 Jan 27 11:53
> /usr/share/zoneinfo/US/Pacific -> ../America/Los_Angeles

The decision in Debian (which I assume Ubuntu is just importing) appears
to have been made in 2011:

  * Remove hardlinks to comply with the policy, by replacing identical
    files with symlinks. It also reduces the package size by 38% and
    the installed size by 35%.

I'm not sure what's going on with the package size and installed size,
although it's possible that the proper tar extensions weren't used at the
time to record the files as hard links and they turned into copies in the
tar file and thus on unpack.

The first part of the changelog entry appears to be a (common)
misunderstanding of Debian Policy, which prohibits hard links in source
packages and as conffiles but not for regular files in binary packages.

That said, personally I prefer symlinks to hardlinks as a matter of style.
Hard links on a UNIX system have a very opaque UI with standard tools.
It's apparent (although not exactly obvious; I always forget to check the
link count number) that the contents are shared with another file, but not
which other file or files, something that symlinks make obvious.  The
efficiency difference seems unlikely to matter.

I admit that my bias against hard links is probably influenced from having
spent years working with a file system that didn't support hard links
across directories.

-- 
Russ Allbery (eagle at eyrie.org)             <https://www.eyrie.org/~eagle/>



More information about the tz mailing list