On Wed, Dec 29, 2021 at 2:37 PM Dan Cross <crossd(a)gmail.com> wrote:
The 4.3BSD man page has this gem: "Hard links may
not refer to
directories (unless the proper incantations are supplied) and may not
span file systems." And indeed, a quick look at /usr/src/bin/ln.c on a
VAX running 4.3 shows that it has an undocumented `-f` flag:
presumably the "proper incantation" mentioned in the man page.
On a lark, I decided to check for this on 7th Edition as well. The man
page says, quite clearly: "It is forbidden to link to a directory or
to link across file systems." However, /usr/src/cmd/ln.c has the
undocumented `-f` flag, and if given, will elide checking for whether
the "name1" argument is a directory or not. Looking at the kernel, as
Doug mentioned, one must be the superuser to link a directory.
- Dan C.