NetBSD Problem Report #58162

From www@netbsd.org  Wed Apr 17 15:51:41 2024
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 6A3B91A9238
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 17 Apr 2024 15:51:41 +0000 (UTC)
Message-Id: <20240417155140.031901A923A@mollari.NetBSD.org>
Date: Wed, 17 Apr 2024 15:51:40 +0000 (UTC)
From: campbell+netbsd@mumble.net
Reply-To: campbell+netbsd@mumble.net
To: gnats-bugs@NetBSD.org
Subject: close(2) man page doesn't guarantee fd is closed even on EINTR
X-Send-Pr-Version: www-1.0

>Number:         58162
>Category:       kern
>Synopsis:       close(2) man page doesn't guarantee fd is closed even on EINTR
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          doc-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Apr 17 15:55:01 +0000 2024
>Originator:     Taylor R Campbell
>Release:        current, 10, 9, 8
>Organization:
The NetBSD Foundation: close: Interrupted system call
>Environment:
>Description:
The close(2) system call as implemented unconditionally closes the file descriptor, and, if it was the last descriptor for an underlying file, otherwise-unconditionally closes that file.

However, the close(2) man page doesn't guarantee that, and POSIX leaves it unspecified:

https://pubs.opengroup.org/onlinepubs/9699919799/functions/close.html
https://www.daemonology.net/blog/2011-12-17-POSIX-close-is-broken.html

We should commit to this guarantee in the man page, because it is obviously the right thing to do even if POSIX allows insensible implementations.

Same deal with closedir(3): https://pubs.opengroup.org/onlinepubs/9699919799/functions/closedir.html
>How-To-Repeat:
man close
https://man.netbsd.org/close.2

man closedir
https://man.netbsd.org/closedir.3
>Fix:
Yes, please!

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2024 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.