NetBSD Problem Report #54940
From www@netbsd.org Wed Feb 5 02:38:55 2020
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-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 D00C71A9213
for <gnats-bugs@gnats.NetBSD.org>; Wed, 5 Feb 2020 02:38:54 +0000 (UTC)
Message-Id: <20200205023853.DECBE1A924D@mollari.NetBSD.org>
Date: Wed, 5 Feb 2020 02:38:53 +0000 (UTC)
From: kevans@FreeBSD.org
Reply-To: kevans@FreeBSD.org
To: gnats-bugs@NetBSD.org
Subject: O_SEARCH tests: Don't combine O_SEARCH with O_RDWR
X-Send-Pr-Version: www-1.0
>Number: 54940
>Category: misc
>Synopsis: O_SEARCH tests: Don't combine O_SEARCH with O_RDWR
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: misc-bug-people
>State: closed
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Wed Feb 05 02:40:00 +0000 2020
>Closed-Date: Wed Feb 05 17:14:03 +0000 2020
>Last-Modified: Wed Feb 05 17:15:01 +0000 2020
>Originator: Kyle Evans
>Release:
>Organization:
>Environment:
>Description:
In FreeBSD, we've implemented O_SEARCH such that it's mutually exclusive with O_RDWR/O_WRONLY; O_RDONLY is valid based on the premise that one can't tell the difference between O_SEARCH and O_SEARCH|0.
Admittedly, this is a shakey reason, so I would fully understand if NetBSD would prefer to #ifdef this away behind __FreeBSD__ -- but O_SEARCH|O_RDWR isn't defined to do anything meaningful and it's not actually needed in this context (O_RDONLY should ultimately error just as well), so I've opted to just drop O_RDWR here.
>How-To-Repeat:
>Fix:
cvs diff: Diffing tests/lib/libc/c063
Index: tests/lib/libc/c063/t_o_search.c
===================================================================
RCS file: /cvsroot/src/tests/lib/libc/c063/t_o_search.c,v
retrieving revision 1.6
diff -u -r1.6 t_o_search.c
--- tests/lib/libc/c063/t_o_search.c 28 Jan 2020 07:12:08 -0000 1.6
+++ tests/lib/libc/c063/t_o_search.c 5 Feb 2020 02:32:06 -0000
@@ -257,7 +257,7 @@
int fd;
ATF_REQUIRE(mkdir(DIR, 0755) == 0);
- ATF_REQUIRE((dfd = open(FILE, O_CREAT|O_RDWR|O_SEARCH, 0644)) != -1);
+ ATF_REQUIRE((dfd = open(FILE, O_CREAT|O_SEARCH, 0644)) != -1);
ATF_REQUIRE((fd = openat(dfd, BASEFILE, O_RDWR, 0)) == -1);
ATF_REQUIRE(errno == ENOTDIR);
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed
State-Changed-By: martin@NetBSD.org
State-Changed-When: Wed, 05 Feb 2020 17:14:03 +0000
State-Changed-Why:
Patch applied, thanks!
From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/54940 CVS commit: src/tests/lib/libc/c063
Date: Wed, 5 Feb 2020 17:13:24 +0000
Module Name: src
Committed By: martin
Date: Wed Feb 5 17:13:24 UTC 2020
Modified Files:
src/tests/lib/libc/c063: t_o_search.c
Log Message:
PR misc/54940: do not combine O_SEARCH with O_RDWR, from Kyle Evans.
To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/lib/libc/c063/t_o_search.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.