NetBSD Problem Report #3182
Received: (qmail-queue invoked from smtpd); 2 Feb 1997 11:31:21 -0000
Message-Id: <199702021124.MAA00537@quesera.inka.de>
Date: Sun, 2 Feb 1997 12:24:27 +0100 (CET)
From: Klaus Klein <kleink@layla.inka.de>
Reply-To: kleink@layla.inka.de
To: gnats-bugs@gnats.netbsd.org
Subject: waitpid(2) and friends silently ignore invalid `options' values
X-Send-Pr-Version: 3.95
>Number: 3182
>Category: standards
>Synopsis: waitpid(2) and friends silently ignore invalid `options' values
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: gnats-admin
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Feb 02 03:35:00 +0000 1997
>Closed-Date: Thu Feb 06 21:35:52 +0000 1997
>Last-Modified: Fri Oct 28 09:16:01 +0000 2005
>Originator: Klaus Klein
>Release: 970201
>Organization:
private site
>Environment:
System: NetBSD quesera.inka.de 1.2C NetBSD 1.2C (QUESERA) #72: Sun Feb 2 11:27:39 CET 1997 kleink@quesera.inka.de:/usr/src/sys/arch/hp300/compile/QUESERA hp300
>Description:
Given an invalid value as `options' parameter (i.e. 4), waitpid(2), wait4(2)
and wait3(2) do not return with EINVAL set; they just check for "known"
bits set and silently ignore invalid ones.
Though I do not have the POSIX specs for waitpid() at hand to look this up,
I'm under the impression that this is a spec violation, as
i) commercial/"compliant" implementations I've checked do return EINVAL
ii) NIST-PCTS:151-2 requires an "options" value to be specified
upon which EINVAL will be returned
I have no idea why this check is #ifdef'ed out in kern_exit.c:wait4();
apparently it's been so at least since lite2.
>How-To-Repeat:
_Try_ to figure out a value for EINVAL_WAITPID in NIST-PCTS:151-2. :-)
>Fix:
Index: src/lib/libc/sys/wait.2
===================================================================
RCS file: /cvsroot/netbsd/src/lib/libc/sys/wait.2,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.2.1
diff -b -c -r1.1.1.1 -r1.1.1.1.2.1
*** wait.2 1996/12/20 13:21:14 1.1.1.1
--- wait.2 1997/02/02 02:15:16 1.1.1.1.2.1
***************
*** 272,277 ****
--- 272,289 ----
.Dv SA_RESTART
flag set.
.El
+ .Pp
+ Additionally,
+ .Fn wait4 ,
+ .Fn wait3
+ and
+ .Fn waitpid
+ will fail and return immediately if:
+ .Bl -tag -width Er
+ .It Bq Er EINVAL
+ An invalid value was specified for
+ .Fa options .
+ .El
.Sh STANDARDS
The
.Fn wait
Index: src/sys/kern/kern_exit.c
===================================================================
RCS file: /cvsroot/netbsd/src/sys/kern/kern_exit.c,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.2.2
diff -b -c -r1.1.1.1 -r1.1.1.1.2.2
*** kern_exit.c 1996/12/20 13:28:34 1.1.1.1
--- kern_exit.c 1997/02/02 09:48:48 1.1.1.1.2.2
***************
*** 296,305 ****
if (SCARG(uap, pid) == 0)
SCARG(uap, pid) = -q->p_pgid;
- #ifdef notyet
if (SCARG(uap, options) &~ (WUNTRACED|WNOHANG))
return (EINVAL);
! #endif
loop:
nfound = 0;
for (p = q->p_children.lh_first; p != 0; p = p->p_sibling.le_next) {
--- 296,304 ----
if (SCARG(uap, pid) == 0)
SCARG(uap, pid) = -q->p_pgid;
if (SCARG(uap, options) &~ (WUNTRACED|WNOHANG))
return (EINVAL);
!
loop:
nfound = 0;
for (p = q->p_children.lh_first; p != 0; p = p->p_sibling.le_next) {
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed
State-Changed-By: mikel
State-Changed-When: Thu Feb 6 21:35:52 1997
State-Changed-Why:
fixed as requested. I do have a copy of POSIX.1 handy, and it is true
that waitpid() must return EINVAL if the options argument is invalid.
From: Klaus Klein <kleink@layla.inka.de>
To: kleink@quesera.inka.de
Cc: gnats-bugs@NetBSD.ORG, netbsd-bugs@NetBSD.ORG
Subject: Re: standards/3182: waitpid(2) and friends silently ignore invalid
`options' values
Date: Fri, 07 Feb 1997 13:44:31 +0100
> Though I do not have the POSIX specs for waitpid() at hand to look this up,
> I'm under the impression that this is a spec violation, as
> i) commercial/"compliant" implementations I've checked do return EINVAL
> ii) NIST-PCTS:151-2 requires an "options" value to be specified
> upon which EINVAL will be returned
This time I have IEEE Std 1003.1-1988 at hand, and section 3.2.1.4 states:
"[EINVAL] The value of the options argument is not valid."
-klaus
From: Geert Hendrickx <ghen@telenet.be>
To: gnats-bugs@netbsd.org
Cc: jschauma@netmeister.org
Subject: Re: pkg/3182: www/opera should be available for Linux
Date: Fri, 28 Oct 2005 11:15:54 +0200
I would like to see this problem tackled in a more abstract way. Packages
could be marked as BINARY=Linux-i386, and then pkgsrc could automatically
add ONLY_FOR_PLATFORM flags for the platforms that can run those binaries
(either native or emulated).
Opera would then be flagged as BINARY=Linux-i386 FreeBSD-i386 Solaris-sparc
and pkgsrc would pick the binary which "most closely" matches the platform
(e.g. Linux-i386 on NetBSD and OpenBSD, but FreeBSD-i386 on DragonFly, etc).
Such a framework would reduce a lot of mess in the existing Linux-binary
packages, and would also save us a lot of work when a new platform (like
DragonFly) enters the arena, because right now, we have to add it manually
to every (supported) Linux-binary package.
Geert
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.