NetBSD Problem Report #51872

From www@NetBSD.org  Sat Jan 14 07:06:49 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 0D7E47A268
	for <gnats-bugs@gnats.NetBSD.org>; Sat, 14 Jan 2017 07:06:49 +0000 (UTC)
Message-Id: <20170114070647.DF6AD7A2A4@mollari.NetBSD.org>
Date: Sat, 14 Jan 2017 07:06:47 +0000 (UTC)
From: yaneurabeya@gmail.com
Reply-To: yaneurabeya@gmail.com
To: gnats-bugs@NetBSD.org
Subject: [PATCH] tests/lib/librt/t_sem: call sem_unlink after :basic and :child
X-Send-Pr-Version: www-1.0

>Number:         51872
>Category:       bin
>Synopsis:       [PATCH] tests/lib/librt/t_sem: call sem_unlink after :basic and :child
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jan 14 07:10:00 +0000 2017
>Closed-Date:    Sun Jan 15 20:24:27 +0000 2017
>Last-Modified:  Sun Jan 15 20:24:27 +0000 2017
>Originator:     Ngie Cooper
>Release:        7.0.2
>Organization:
>Environment:
n/a
>Description:
Call sem_unlink in the :basic and :child's cleanup routines so the POSIX semaphores don't remain attached to the system after the tests complete if they fail.
>How-To-Repeat:

>Fix:

>Release-Note:

>Audit-Trail:
From: "Ngie Cooper (yaneurabeya)" <yaneurabeya@gmail.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: bin/51872: [PATCH] tests/lib/librt/t_sem: call sem_unlink after
 :basic and :child
Date: Fri, 13 Jan 2017 23:11:23 -0800

 --Apple-Mail=_AAE4D6DB-321E-4849-B5A5-6CC5B50101E7
 Content-Transfer-Encoding: 7bit
 Content-Type: text/plain;
 	charset=us-ascii

 Patch attached.
 -Ngie

 --Apple-Mail=_AAE4D6DB-321E-4849-B5A5-6CC5B50101E7
 Content-Disposition: attachment;
 	filename=t_sem-run-sem_unlink-in-cleanup-routine.patch
 Content-Type: application/octet-stream;
 	x-unix-mode=0644;
 	name="t_sem-run-sem_unlink-in-cleanup-routine.patch"
 Content-Transfer-Encoding: 7bit

 Index: lib/librt/t_sem.c
 ===================================================================
 RCS file: /cvsroot/src/tests/lib/librt/t_sem.c,v
 retrieving revision 1.2
 diff -u -r1.2 t_sem.c
 --- lib/librt/t_sem.c	8 Nov 2010 13:05:49 -0000	1.2
 +++ lib/librt/t_sem.c	14 Jan 2017 07:05:38 -0000
 @@ -72,7 +72,7 @@

  #define NCHILDREN 10

 -ATF_TC(basic);
 +ATF_TC_WITH_CLEANUP(basic);
  ATF_TC_HEAD(basic, tc)
  {
  	atf_tc_set_md_var(tc, "descr", "Checks basic functionality of POSIX "
 @@ -108,8 +108,12 @@
  	ATF_REQUIRE_EQ(sem_close(sem_b), 0);
  	ATF_REQUIRE_EQ(sem_unlink("/sem_b"), 0);
  }
 +ATF_TC_CLEANUP(basic, tc)
 +{
 +	(void)sem_unlink("/sem_b");
 +}

 -ATF_TC(child);
 +ATF_TC_WITH_CLEANUP(child);
  ATF_TC_HEAD(child, tc)
  {
  	atf_tc_set_md_var(tc, "descr", "Checks using semaphores to synchronize "
 @@ -124,7 +128,7 @@

  	pid_t pid;

 -	if (sysconf(_SC_SEMAPHORES) == -1)         
 +	if (sysconf(_SC_SEMAPHORES) == -1)
  		atf_tc_skip("POSIX semaphores not supported");

  	sem_a = sem_open("/sem_a", O_CREAT | O_EXCL, 0644, 0);
 @@ -164,6 +168,10 @@
  	ATF_REQUIRE_EQ(sem_close(sem_a), 0);
  	ATF_REQUIRE_EQ(sem_unlink("/sem_a"), 0);
  }
 +ATF_TC_CLEANUP(child, tc)
 +{
 +	(void)sem_unlink("/sem_a");
 +}

  ATF_TP_ADD_TCS(tp)
  {

 --Apple-Mail=_AAE4D6DB-321E-4849-B5A5-6CC5B50101E7--

From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/51872 CVS commit: src/tests/lib/librt
Date: Sat, 14 Jan 2017 15:58:21 -0500

 Module Name:	src
 Committed By:	christos
 Date:		Sat Jan 14 20:58:21 UTC 2017

 Modified Files:
 	src/tests/lib/librt: t_sem.c

 Log Message:
 PR/51872: Ngie Cooper: call sem_unlink after :basic and :child


 To generate a diff of this commit:
 cvs rdiff -u -r1.2 -r1.3 src/tests/lib/librt/t_sem.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: snj@NetBSD.org
State-Changed-When: Sun, 15 Jan 2017 20:24:27 +0000
State-Changed-Why:
christos committed it. thanks!


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(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.