From: "Theo de Raadt" Subject: Re: [PATCH] link.2: POSIX.1 does not, in fact, mandate file1 to not be a directory To: =?utf-8?B?0L3QsNCx?= Cc: tech@openbsd.org Date: Wed, 17 Jul 2024 15:58:53 -0600 Your advice is poor. If people write code which tries to do this behaviour, it will not just fail on OpenBSD. It is not an operating system detail. Rather, it is a filesystem detail. Most filesystems were designed around the idea that the directory system is a tree, not a graph. As such they don't allow ANYONE to create links which would turn the tree into a graph. How many filesystems is that? The vast majority. So, it will fail all over the place on 99% of unix systems. So should someone try to wrote any userland code which plays with this? No. Because if they do, they also need an alternative of meeting their goals. It is clear they should always use an alternative means of doing so. Frankly, your proposal is not serious. It is trying to encourage useless flexibility where it is dangerous and unneccessary. The words are fine. наб wrote: > It's just not true (POSIX.1-2024): > 44768 If path1 names a directory, link( ) shall fail unless the process has appropriate privileges and the > 44769 implementation supports using link( ) on directories. > > This has /never/ been true (FIPS 151-1, POSIX.1-1988): > 5. Files and Directories, 5.3 General File Creation., > 5.3.4 Link to a File., 5.3.4.2 Description., para. 3 (p. 91) > The path1 argument shall not name a directory unless the user has appropri- > ate privileges and the implementation supports using link() on directories. > > OpenBSD is allowed to let root make links to directories, > but doesn't. > --- > lib/libc/sys/link.2 | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/lib/libc/sys/link.2 b/lib/libc/sys/link.2 > index a9c241a55..e741b1520 100644 > --- a/lib/libc/sys/link.2 > +++ b/lib/libc/sys/link.2 > @@ -71,7 +71,8 @@ .Sh DESCRIPTION > and > .Fa name2 > must be in the same file system. > -As mandated by POSIX.1 > +On > +.Ox , > .Fa name1 > may not be a directory. > .Pp > -- > 2.39.2