In 2014, Paul updated the documentation for 'open' to mention that
NetBSD and FreeBSD set errno differently than specified by POSIX for:

    open ("symlink", O_NOFOLLOW ...)

Today, I found that git's test suite failed on NetBSD 10.0 because of
this [1]. And just confirmed this is still the case on FreeBSD 14.2. I
have updated the documentation with this information.

I don't really see a benefit to differing from POSIX here, but it is
documented in the man pages so I assume it was intentional. I'll see if
I can find any discussion about it before opening bug reports.

Collin

[1] 
https://public-inbox.org/git/xmqqtt62sdv9.fsf@gitster.g/T/#m2b7272f1f07fe2bf65787cfe9bfaec6230cf5749

>From c0c646e29fbda0a6eadd6012d8ed1eb33b6c3968 Mon Sep 17 00:00:00 2001
From: Collin Funk <collin.fu...@gmail.com>
Date: Fri, 2 May 2025 20:33:56 -0700
Subject: [PATCH] doc: Update documentation for 'open' errno discrepancies.

* doc/posix-functions/open.texi: Document that NetBSD 10.0 and FreeBSD
14.2 set errno differently than POSIX specifies for
'open ("symlink", O_NOFOLLOW ...)'.
---
 ChangeLog                     | 7 +++++++
 doc/posix-functions/open.texi | 4 ++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0810642297..c33aae4a7a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2025-05-02  Collin Funk  <collin.fu...@gmail.com>
+
+	doc: Update documentation for 'open' errno discrepancies.
+	* doc/posix-functions/open.texi: Document that NetBSD 10.0 and FreeBSD
+	14.2 set errno differently than POSIX specifies for
+	'open ("symlink", O_NOFOLLOW ...)'.
+
 2025-05-02  Bruno Haible  <br...@clisp.org>
 
 	vc-mtime: Make it work with git versions < 2.28.
diff --git a/doc/posix-functions/open.texi b/doc/posix-functions/open.texi
index dccadae8c9..a7e83e4f49 100644
--- a/doc/posix-functions/open.texi
+++ b/doc/posix-functions/open.texi
@@ -60,12 +60,12 @@ @node open
 @code{open ("symlink", O_NOFOLLOW ...)} fails with @code{errno} set to
 @code{EMLINK} instead of the POSIX-required @code{ELOOP} on some
 platforms:
-FreeBSD 10.1.
+FreeBSD 14.2.
 @item
 @code{open ("symlink", O_NOFOLLOW ...)} fails with @code{errno} set to
 @code{EFTYPE} instead of the POSIX-required @code{ELOOP} on some
 platforms:
-NetBSD 6.1.
+NetBSD 10.0.
 @item
 On Windows, this function returns a file handle in @code{O_TEXT} mode by
 default; this means that it translates @code{'\n'} to CR/LF by default.  Use the
-- 
2.49.0

Reply via email to