NetBSD Problem Report #51832

From www@NetBSD.org  Thu Jan 12 06:04:24 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 ACE277A16D
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 12 Jan 2017 06:04:24 +0000 (UTC)
Message-Id: <20170112060423.8E7677A2B4@mollari.NetBSD.org>
Date: Thu, 12 Jan 2017 06:04:23 +0000 (UTC)
From: yaneurabeya@gmail.com
Reply-To: yaneurabeya@gmail.com
To: gnats-bugs@NetBSD.org
Subject: [PATCH] tests/lib/libc/regex: various fixes
X-Send-Pr-Version: www-1.0

>Number:         51832
>Category:       bin
>Synopsis:       [PATCH] tests/lib/libc/regex: various fixes
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jan 12 06:05:00 +0000 2017
>Closed-Date:    Sun Jan 15 18:58:52 +0000 2017
>Last-Modified:  Sun Jan 15 18:58:52 +0000 2017
>Originator:     Ngie Cooper
>Release:        7.0.2
>Organization:
>Environment:
n/a
>Description:
Fix the following issues in tests/lib/libc/regex/:

t_exhaust.c: make the test case more robust.

- Limit memory to 64MB.
- Require 64MB on the test host.
- Sort headers.

t_regex_att.c: use ATF_CHECK_STREQ_MSG instead of ATF_REQUIRE_STREQ_MSG, so all errors with t_regex_att could be captured by the tester.
>How-To-Repeat:

>Fix:

>Release-Note:

>Audit-Trail:
From: "Ngie Cooper (yaneurabeya)" <yaneurabeya@gmail.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: bin/51832: [PATCH] tests/lib/libc/regex: various fixes
Date: Wed, 11 Jan 2017 22:05:30 -0800

 --Apple-Mail=_D113D9B1-C3DF-41C0-B6F4-E1D7D91117D9
 Content-Transfer-Encoding: 7bit
 Content-Type: text/plain;
 	charset=us-ascii

 Patch attached.
 -Ngie

 --Apple-Mail=_D113D9B1-C3DF-41C0-B6F4-E1D7D91117D9
 Content-Disposition: attachment;
 	filename=lib-libc-regex-various-fixes.patch
 Content-Type: application/octet-stream;
 	x-unix-mode=0644;
 	name="lib-libc-regex-various-fixes.patch"
 Content-Transfer-Encoding: 7bit

 Index: regex/debug.c
 ===================================================================
 RCS file: /cvsroot/src/tests/lib/libc/regex/debug.c,v
 retrieving revision 1.2
 diff -u -r1.2 debug.c
 --- regex/debug.c	10 Oct 2011 04:32:41 -0000	1.2
 +++ regex/debug.c	12 Jan 2017 05:53:17 -0000
 @@ -26,14 +26,15 @@
   * POSSIBILITY OF SUCH DAMAGE.
   */

 +#include <sys/types.h>
  #include <ctype.h>
  #include <limits.h>
  #include <regex.h>
  #include <stdio.h>
  #include <stdlib.h>
  #include <string.h>
 -
 -#include <sys/types.h>
 +#include <wchar.h>
 +#include <wctype.h>

  /* Don't sort these! */
  #include "utils.h"
 Index: regex/t_exhaust.c
 ===================================================================
 RCS file: /cvsroot/src/tests/lib/libc/regex/t_exhaust.c,v
 retrieving revision 1.7
 diff -u -r1.7 t_exhaust.c
 --- regex/t_exhaust.c	16 Nov 2011 18:37:31 -0000	1.7
 +++ regex/t_exhaust.c	12 Jan 2017 05:53:17 -0000
 @@ -39,12 +39,13 @@
  #include <sys/cdefs.h>
  __RCSID("$NetBSD: t_exhaust.c,v 1.7 2011/11/16 18:37:31 christos Exp $");

 -#include <stdio.h>
 +#include <sys/resource.h>
 +#include <atf-c.h>
 +#include <err.h>
  #include <regex.h>
 -#include <string.h>
 +#include <stdio.h>
  #include <stdlib.h>
 -#include <err.h>
 -#include <atf-c.h>
 +#include <string.h>

  #ifndef REGEX_MAXSIZE
  #define REGEX_MAXSIZE	9999
 @@ -176,14 +177,17 @@
  	    " crash, but return a proper error code");
  	// libtre needs it.
  	atf_tc_set_md_var(tc, "timeout", "600");
 -	atf_tc_set_md_var(tc, "require.memory", "120M");
 +	atf_tc_set_md_var(tc, "require.memory", "64M");
  }

  ATF_TC_BODY(regcomp_too_big, tc)
  {
  	regex_t re;
 +	struct rlimit limit;
  	int e;

 +	limit.rlim_cur = limit.rlim_max = 64 * 1024 * 1024;
 +	ATF_REQUIRE(setrlimit(RLIMIT_VMEM, &limit) != -1);
  	for (size_t i = 0; i < __arraycount(tests); i++) {
  		char *d = (*tests[i].pattern)(REGEX_MAXSIZE);
  		e = regcomp(&re, d, tests[i].type);
 Index: regex/t_regex_att.c
 ===================================================================
 RCS file: /cvsroot/src/tests/lib/libc/regex/t_regex_att.c,v
 retrieving revision 1.1
 diff -u -r1.1 t_regex_att.c
 --- regex/t_regex_att.c	24 Aug 2012 20:24:40 -0000	1.1
 +++ regex/t_regex_att.c	12 Jan 2017 05:53:17 -0000
 @@ -374,7 +374,7 @@
  		    " cur=%d, max=%zu", res, l, len - off);
  		off += l;
  	}
 -	ATF_REQUIRE_STREQ_MSG(res, matches, " at line %zu", lineno);
 +	ATF_CHECK_STREQ_MSG(res, matches, " at line %zu", lineno);
  	free(res);
  }


 --Apple-Mail=_D113D9B1-C3DF-41C0-B6F4-E1D7D91117D9--

From: "Ngie Cooper (yaneurabeya)" <yaneurabeya@gmail.com>
To: gnats-bugs@NetBSD.org
Cc: gnats-admin@netbsd.org,
 netbsd-bugs@netbsd.org
Subject: Re: bin/51832: [PATCH] tests/lib/libc/regex: various fixes
Date: Fri, 13 Jan 2017 16:46:21 -0800

 > On Jan 11, 2017, at 10:10 PM, Ngie Cooper (yaneurabeya) =
 <yaneurabeya@gmail.com> wrote:
 >=20
 > The following reply was made to PR bin/51832; it has been noted by =
 GNATS.
 >=20
 > From: "Ngie Cooper (yaneurabeya)" <yaneurabeya@gmail.com>
 > To: gnats-bugs@NetBSD.org
 > Cc:=20
 > Subject: Re: bin/51832: [PATCH] tests/lib/libc/regex: various fixes
 > Date: Wed, 11 Jan 2017 22:05:30 -0800
 >=20
 > --Apple-Mail=3D_D113D9B1-C3DF-41C0-B6F4-E1D7D91117D9
 > Content-Transfer-Encoding: 7bit
 > Content-Type: text/plain;
 > 	charset=3Dus-ascii
 >=20
 > Patch attached.
 > -Ngie


 Hi,
 	I noticed this patch hasn=E2=80=99t been committed yet =E2=80=94 =
 is there an issue with my proposed change?
 Thanks!
 -Ngie=

From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/51832 CVS commit: src/tests/lib/libc/regex
Date: Fri, 13 Jan 2017 19:50:56 -0500

 Module Name:	src
 Committed By:	christos
 Date:		Sat Jan 14 00:50:56 UTC 2017

 Modified Files:
 	src/tests/lib/libc/regex: debug.c t_exhaust.c t_regex_att.c

 Log Message:
 PR/51832: Ngie Cooper:
 - limit memory to 64M
 - error msg fixes
 - includes fixes


 To generate a diff of this commit:
 cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/regex/debug.c
 cvs rdiff -u -r1.7 -r1.8 src/tests/lib/libc/regex/t_exhaust.c
 cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/regex/t_regex_att.c

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

From: christos@zoulas.com (Christos Zoulas)
To: gnats-bugs@NetBSD.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, 
	yaneurabeya@gmail.com
Cc: 
Subject: Re: bin/51832: [PATCH] tests/lib/libc/regex: various fixes
Date: Fri, 13 Jan 2017 19:52:03 -0500

 On Jan 14, 12:50am, yaneurabeya@gmail.com ("Ngie Cooper (yaneurabeya)") wrote:
 -- Subject: Re: bin/51832: [PATCH] tests/lib/libc/regex: various fixes

 |  Hi,
 |  	I noticed this patch hasn=E2=80=99t been committed yet =E2=80=94 =
 |  is there an issue with my proposed change?

 Missed, it. Committed. FYI I fixed the h_hmacros.h mess everywhere by
 adding it in a single place on the top Makefile. You might want to do
 the same.

 christos

From: "Ngie Cooper (yaneurabeya)" <yaneurabeya@gmail.com>
To: gnats-bugs@NetBSD.org
Cc: gnats-admin@netbsd.org,
 netbsd-bugs@netbsd.org
Subject: Re: bin/51832: [PATCH] tests/lib/libc/regex: various fixes
Date: Fri, 13 Jan 2017 16:55:58 -0800

 > On Jan 13, 2017, at 4:55 PM, Christos Zoulas <christos@zoulas.com> =
 wrote:
 >=20
 > The following reply was made to PR bin/51832; it has been noted by =
 GNATS.
 >=20
 > From: christos@zoulas.com (Christos Zoulas)
 > To: gnats-bugs@NetBSD.org, gnats-admin@netbsd.org, =
 netbsd-bugs@netbsd.org,=20
 > 	yaneurabeya@gmail.com
 > Cc:=20
 > Subject: Re: bin/51832: [PATCH] tests/lib/libc/regex: various fixes
 > Date: Fri, 13 Jan 2017 19:52:03 -0500
 >=20
 > On Jan 14, 12:50am, yaneurabeya@gmail.com ("Ngie Cooper =
 (yaneurabeya)") wrote:
 > -- Subject: Re: bin/51832: [PATCH] tests/lib/libc/regex: various fixes
 >=20
 > |  Hi,
 > |  	I noticed this patch hasn=3DE2=3D80=3D99t been committed yet =
 =3DE2=3D80=3D94 =3D
 > |  is there an issue with my proposed change?
 >=20
 > Missed, it. Committed. FYI I fixed the h_hmacros.h mess everywhere by
 > adding it in a single place on the top Makefile. You might want to do
 > the same.

 Thank you =E2=80=94 I=E2=80=99ll do that!
 -Ngie=

State-Changed-From-To: open->closed
State-Changed-By: snj@NetBSD.org
State-Changed-When: Sun, 15 Jan 2017 18:58:52 +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.