NetBSD Problem Report #51957
From www@NetBSD.org Tue Feb 7 01:56:52 2017
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 "Postmaster NetBSD.org" (verified OK))
by mollari.NetBSD.org (Postfix) with ESMTPS id 9C5A27A1FB
for <gnats-bugs@gnats.NetBSD.org>; Tue, 7 Feb 2017 01:56:52 +0000 (UTC)
Message-Id: <20170207015651.9F1827A289@mollari.NetBSD.org>
Date: Tue, 7 Feb 2017 01:56:51 +0000 (UTC)
From: yaneurabeya@gmail.com
Reply-To: yaneurabeya@gmail.com
To: gnats-bugs@NetBSD.org
Subject: hsearch_r on NetBSD has opposite behavior compared to Linux
X-Send-Pr-Version: www-1.0
>Number: 51957
>Category: bin
>Synopsis: hsearch_r on NetBSD has opposite behavior compared to Linux
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Feb 07 02:00:00 +0000 2017
>Last-Modified: Tue Feb 07 03:05:00 +0000 2017
>Originator: Ngie Cooper
>Release: 7.x
>Organization:
>Environment:
n/a
>Description:
The lib/libc/stdlib/t_hsearch.c:nonexistent testcase tests hsearch_r to make sure it fails when creating a hash search table, then checks to make sure that a proper error is returned when looking for a non-ENTER'ed key.
The error code behavior on NetBSD is opposite of Linux. The Linux behavior seems more consistent with standard expectations for lib call return codes, but at the very least I figured it should be documented. From https://linux.die.net/man/3/hsearch_r :
On success, hsearch() returns a pointer to an entry in the hash table. hsearch() returns NULL on error, that is, if action is ENTER and the hash table is full, or action is FIND and item cannot be found in the hash table. hsearch_r() returns nonzero on success, and 0 on error.
>How-To-Repeat:
>Fix:
>Audit-Trail:
From: "Ngie Cooper (yaneurabeya)" <yaneurabeya@gmail.com>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: bin/51957: hsearch_r on NetBSD has opposite behavior compared to Linux
Date: Mon, 6 Feb 2017 19:01:37 -0800
--Apple-Mail=_79B52236-2A45-4731-925C-008E37F77093
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
charset=us-ascii
Hi,
I opened up a companion bug for this on the FreeBSD side because =
it seems that the current implementation matches Linux and the =
documentation matches NetBSD, behavior wise: =
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D216872 .
Thank you!
-Ngie
--Apple-Mail=_79B52236-2A45-4731-925C-008E37F77093
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename=signature.asc
Content-Type: application/pgp-signature;
name=signature.asc
Content-Description: Message signed with OpenPGP using GPGMail
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - https://gpgtools.org
iQIcBAEBCgAGBQJYmTiUAAoJEPWDqSZpMIYV3ZcQAIWqA92MCdAUssJ6VMyHKlI/
VG6iXkwXuhLMYHmb7oO7cHM9e3SUAjwVWuZBZjTvDbcE/am6Sjn9Fz9TSHBU61Jz
PxV04Ys9XrhU8y6wSuTWlenHaYW24rB+JQKDglxfz2tPDNrSOt1Fl0cF0LHrSA/t
a3AeOVUo2l0Q6Z4L4f+IsdFweexnQcS+rykMxaUtapFvIu2Z7lb3oaDYMP2lGHxq
8hFCOLuR8ZOOkOJp/7jx317VuSJ2237imI/+Q9yVtPosgJry6JuG0hMDWtZKVX0Q
LHjicCb28O/f2cJ5hNytPinHQa/KTrzvKTIfojBvQsFAg2wWQi6DMTFs572ylEmo
50ROmJe0NErMuLRLopAvATOT26YyilxxUKXVCk+MczmTXSvuxl2Utm6+0HP6YI3W
DmkvD+FI4Bu4L3S1K0VfC+j5OGFAjgcFNbcVog/HYLi5tUzMAojH0qZtdS+CbmYU
ar3U59VSom8dZTDSdvJNDsL3TTk3tkijZsZm8zO0sgCEFSNx3uiq4FNjBnz7ErLI
a/aKnH7dtedXKDJ7jHc9h856NABUa41WOu61WO7K3OyNpa1ExpM0iENZm8HbIJvH
gk0moslkJDxtimRwATlDogDp4Z4ZGVxoMPWLKw5oM1dcQoN/ZzVp03XJde4GUKDT
VVZ4sGuwdd9Gvg5JQENj
=7sbg
-----END PGP SIGNATURE-----
--Apple-Mail=_79B52236-2A45-4731-925C-008E37F77093--
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.