NetBSD Problem Report #51807

From www@NetBSD.org  Tue Jan 10 09:07:33 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 F1AAB7A26E
	for <gnats-bugs@gnats.NetBSD.org>; Tue, 10 Jan 2017 09:07:32 +0000 (UTC)
Message-Id: <20170110090732.0BAB27A289@mollari.NetBSD.org>
Date: Tue, 10 Jan 2017 09:07:32 +0000 (UTC)
From: yaneurabeya@gmail.com
Reply-To: yaneurabeya@gmail.com
To: gnats-bugs@NetBSD.org
Subject: [PATCH] tests/lib/libc/gen/t_assert: disable core file generation in :assert_false,:assert_true
X-Send-Pr-Version: www-1.0

>Number:         51807
>Category:       bin
>Synopsis:       [PATCH] tests/lib/libc/gen/t_assert: disable core file generation in :assert_false,:assert_true
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jan 10 09:10:00 +0000 2017
>Closed-Date:    Tue Jan 10 18:14:00 +0000 2017
>Last-Modified:  Tue Jan 10 18:14:00 +0000 2017
>Originator:     Ngie Cooper
>Release:        7.0.2
>Organization:
>Environment:
n/a
>Description:
The attached patch disables core file generation via setrlimit in tests/lib/libc/gen/t_assert .

Although kyua would generally clean up this core file, if `kern.corefile` (on FreeBSD -- equivalent to `kern.defcorename`) was modified to be an absolute path, the core file would never be cleaned up. This caused false positives while testing at work, considering that the test only validates the signal being raised, but the core file being present (we have checkers that look for core files and flag any present core files as failures).
>How-To-Repeat:

>Fix:

>Release-Note:

>Audit-Trail:
From: "Ngie Cooper (yaneurabeya)" <yaneurabeya@gmail.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: bin/51807: [PATCH] tests/lib/libc/gen/t_assert: disable core file
 generation in :assert_false,:assert_true
Date: Tue, 10 Jan 2017 01:10:45 -0800

 --Apple-Mail=_D6C5AA5F-EFC8-4714-99A6-3728325141D1
 Content-Transfer-Encoding: 7bit
 Content-Type: text/plain;
 	charset=us-ascii

 Patch attached.

 --Apple-Mail=_D6C5AA5F-EFC8-4714-99A6-3728325141D1
 Content-Disposition: attachment;
 	filename=t_assert-disable-corefile-generation.patch
 Content-Type: application/octet-stream;
 	x-unix-mode=0644;
 	name="t_assert-disable-corefile-generation.patch"
 Content-Transfer-Encoding: 7bit

 Index: t_assert.c
 ===================================================================
 RCS file: /cvsroot/src/tests/lib/libc/gen/t_assert.c,v
 retrieving revision 1.2
 diff -p -u -r1.2 t_assert.c
 --- t_assert.c	14 Jun 2011 05:28:00 -0000	1.2
 +++ t_assert.c	10 Jan 2017 09:02:34 -0000
 @@ -31,6 +31,9 @@
  #include <sys/cdefs.h>
  __RCSID("$NetBSD: t_assert.c,v 1.2 2011/06/14 05:28:00 jruoho Exp $");

 +#include <sys/types.h>
 +#include <sys/resource.h>
 +#include <sys/time.h>
  #include <sys/wait.h>

  #include <assert.h>
 @@ -40,6 +43,17 @@ __RCSID("$NetBSD: t_assert.c,v 1.2 2011/
  #include <string.h>
  #include <unistd.h>

 +static void
 +disable_corefile(void)
 +{
 +	struct rlimit limits;
 +
 +	limits.rlim_cur = 0;
 +	limits.rlim_max = 0;
 +
 +	ATF_REQUIRE(setrlimit(RLIMIT_CORE, &limits) == 0);
 +}
 +
  static void		handler(int);

  static void
 @@ -65,6 +79,7 @@ ATF_TC_BODY(assert_false, tc)

  	if (pid == 0) {

 +		disable_corefile();
  		(void)closefrom(0);
  		(void)memset(&sa, 0, sizeof(struct sigaction));

 @@ -102,6 +117,7 @@ ATF_TC_BODY(assert_true, tc)

  	if (pid == 0) {

 +		disable_corefile();
  		(void)closefrom(0);
  		(void)memset(&sa, 0, sizeof(struct sigaction));


 --Apple-Mail=_D6C5AA5F-EFC8-4714-99A6-3728325141D1--

From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/51807 CVS commit: src/tests/lib/libc/gen
Date: Tue, 10 Jan 2017 10:17:57 -0500

 Module Name:	src
 Committed By:	christos
 Date:		Tue Jan 10 15:17:57 UTC 2017

 Modified Files:
 	src/tests/lib/libc/gen: t_assert.c

 Log Message:
 PR/51807: Ngie Cooper: disable core file generation in :assert_false,
 :assert_true


 To generate a diff of this commit:
 cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/gen/t_assert.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: dholland@NetBSD.org
State-Changed-When: Tue, 10 Jan 2017 18:14:00 +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.