Re: [pcre-dev] Release candidate for 10.10

Kezdőlap
Üzenet törlése
Szerző: Petr Pisar
Dátum:  
Címzett: pcre-dev
Tárgy: Re: [pcre-dev] Release candidate for 10.10
On Fri, Feb 20, 2015 at 03:54:20PM +0100, Petr Pisar wrote:
> On Fri, Feb 20, 2015 at 12:26:21PM +0000, ph10@??? wrote:
> > I have put a release candidate for PCRE2 release 10.10 on the FTP site:
> >
> I'm giving a try to this release for the first time of PCRE2, and I experience
> a test failure on 32-bit PowerPC:

[...]
> First, it should report strerror(errno) on failure. It would help more than
> -1 return value.
>
> Second, the issue maybe is that I set hard limit to 10 MB (on some platform
> like PPC), while the RunTest script can call pcre2test wiht -S 16 arguments
> leading to requsting 16 MB of soft limit which is bigger than my 10-MB hard
> limit and that could cause the failure (setrlimit(2) returns EINVAL in this
> case).
>

Indeed, it was caused by the hard limit beeing smaller than soft limit which
pcre2test tried to test. Attached patch improved the error message:

FAIL: RunTest
=============
PCRE2 C library tests using test data from ./testdata
PCRE2 version 10.10-RC1 2015-02-20
---- Testing 8-bit library ----
Test 0: Unchecked pcre2test argument tests (to improve coverage)
OK
Test 1: Main non-UTF, non-UCP functionality (compatible with Perl >= 5.10)
OK
OK with JIT
Test 2: API, errors, internals, and non-Perl stuff (excluding UTF-8)
pcre2test: limitting stack size (soft=16777216, hard=10485760) failed: Invalid argument

I'm not sure how much printing the limits is portable, but it works for me on
x86_64 and 32-bit PowerPC GNU/Linux. (The type cast there is needed, otherwise
big endian systems will try to access different memory and will segfault. Bash
has it's own procedure for formating these values, but I don't think it's
worth to put it into pcre2test.)

After unsetting the hard stack limit, the tests pass on all my platforms.
I will post detailed results in another e-mail.

-- Petr

From 19a04364f135c8b735442d008fcf18e13d389fe0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@???>
Date: Fri, 20 Feb 2015 16:09:53 +0100
Subject: [PATCH] pcre2test: Report strlimit() failure with details
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Petr Písař <ppisar@???>

diff --git a/src/pcre2test.c b/src/pcre2test.c
index c6619cc..a48d44b 100644
--- a/src/pcre2test.c
+++ b/src/pcre2test.c
@@ -62,6 +62,7 @@ it references only the enabled library functions. */
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
+#include <stdint.h>
 #include <time.h>
 #include <locale.h>
 #include <errno.h>
@@ -6460,7 +6461,9 @@ while (argc > 1 && argv[op][0] == '-' && argv[op][1] != 0)
     rc = setrlimit(RLIMIT_STACK, &rlim);
     if (rc != 0)
       {
-      fprintf(stderr, "pcre2test: setrlimit() failed with error %d\n", rc);
+      fprintf(stderr, "pcre2test: limitting stack size (soft=%ju, hard=%ju)"
+        " failed: %s\n", (uintmax_t) rlim.rlim_cur, (uintmax_t)rlim.rlim_max,
+        strerror(errno));
       exit(1);
       }
     op++;
-- 
2.1.0