Index | Thread | Search

From:
наб <nabijaczleweli@nabijaczleweli.xyz>
Subject:
[PATCH] link.2: POSIX.1 does not, in fact, mandate file1 to not be a directory
To:
tech@openbsd.org
Date:
Wed, 17 Jul 2024 19:50:40 +0200

Download raw body.

Thread
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