[pcre-dev] [Bug 1022] New: Utter failure: linking and tests

Góra strony
Delete this message
Autor: Volker Borchert
Data:  
Dla: pcre-dev
Temat: [pcre-dev] [Bug 1022] New: Utter failure: linking and tests
------- You are receiving this mail because: -------
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=1022
           Summary: Utter failure: linking and tests
           Product: PCRE
           Version: 8.10
          Platform: Sun
        OS/Version: SunOS
            Status: NEW
          Severity: bug
          Priority: low
         Component: Code
        AssignedTo: ph10@???
        ReportedBy: v.borchert@???
                CC: pcre-dev@???



configure properly recognizes SunOS4's lack of strerror(),strtoul(),memmove()
but code does not honor the settings. Apparent workaround:

--- - Wed Sep 22 12:53:05 2010
+++ pcregrep.c Wed Sep 22 12:46:49 2010
@@ -64,12 +64,11 @@
#endif

#include "pcre.h"
+#include "pcre_internal.h"

#define FALSE 0
#define TRUE 1

-typedef int BOOL;
-
#define MAX_PATTERN_COUNT 100
#define OFFSET_SIZE 99

@@ -547,6 +546,34 @@


 /*************************************************
+*          Read number from string               *
+*************************************************/
+
+/* We don't use strtoul() because SunOS4 doesn't have it. Rather than mess
+around with conditional compilation, just do the job by hand. It is only used
+for unpicking arguments, so just keep it simple.
+
+Arguments:
+  str           string to be converted
+  endptr        where to put the end pointer
+
+Returns:        the unsigned long
+*/
+
+static int
+get_value(char *str, char **endptr)
+{
+int result = 0;
+while(*str != 0 && isspace(*str)) str++;
+while (isdigit(*str)) result = result * 10 + (int)(*str++ - '0');
+*endptr = str;
+return(result);
+}
+
+
+
+
+/*************************************************
 *            Read one line of input              *
 *************************************************/


@@ -2199,7 +2226,7 @@
   else
     {
     char *endptr;
-    int n = strtoul(option_data, &endptr, 10);
+    int n = get_value(option_data, &endptr);
     if (*endptr != 0)
       {
       if (longop)


--- - Wed Sep 22 12:53:41 2010
+++ pcretest.c Wed Sep 22 12:26:20 2010
@@ -516,6 +516,28 @@



+#ifndef HAVE_STRERROR
+/*************************************************
+*     Provide strerror() for non-ANSI libraries  *
+*************************************************/
+
+/* Some old-fashioned systems still around (e.g. SunOS4) don't have strerror()
+in their libraries, but can provide the same facility by this simple
+alternative function. */
+
+extern int   sys_nerr;
+extern char *sys_errlist[];
+
+char *
+strerror(int n)
+{
+if (n < 0 || n >= sys_nerr) return "unknown error number";
+return sys_errlist[n];
+}
+#endif /* HAVE_STRERROR */
+
+
+
 /*************************************************
 *        Read or extend an input line            *
 *************************************************/


With these everything compiles and links. But then, tests fail completely:

gmake check-TESTS
gmake[1]: Entering directory `/tools/pcre-8.10/sparc-sun-sunos4.1.4'
FAIL: pcrecpp_unittest
FAIL: pcre_scanner_unittest
FAIL: pcre_stringpiece_unittest

PCRE C library tests
PCRE version 8.10 2010-06-25

Test 1: main functionality (Perl 5.8, 5.10, 5.11 compatible)
../RunTest: 27249 Memory fault
FAIL: RunTest

Testing pcregrep
pcregrep version 8.10 2010-06-25
../RunGrepTest: 27525 Memory fault
../RunGrepTest: 27878 Memory fault
../RunGrepTest: 27927 Memory fault
../RunGrepTest: 27942 Memory fault
../RunGrepTest: 28002 Memory fault
--- ../testdata/grepoutput      Fri Aug 14 18:38:06 2009
+++ testtry     Wed Sep 22 12:48:53 2010
@@ -87,7 +87,6 @@
 ---------------------------- Test 14 -----------------------------
 ./testdata/grepinputx:To pat or not to pat, that is the question.
 ---------------------------- Test 15 -----------------------------
-pcregrep: Error in command-line regex at offset 4: nothing to repeat
 ---------------------------- Test 16 -----------------------------
 pcregrep: Failed to open ./testdata/nonexistfile: No such file or directory
 ---------------------------- Test 17 -----------------------------
@@ -358,7 +357,6 @@
 pcregrep: pcre_exec() error -8 while matching this text:
 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 ---------------------------- Test 38 ------------------------------
-This line contains a binary zero here >< for testing.
 ---------------------------- Test 39 ------------------------------
 This is a line before the binary zero.
 This line contains a binary zero here >< for testing.
@@ -366,11 +364,7 @@
 This line contains a binary zero here >< for testing.
 This is a line after the binary zero.
 ---------------------------- Test 41 ------------------------------
-before the binary zero
-after the binary zero
 ---------------------------- Test 41 ------------------------------
-./testdata/grepinput:595:before the binary zero
-./testdata/grepinput:597:after the binary zero
 ---------------------------- Test 42 ------------------------------
 595:before
 595:zero
@@ -388,7 +382,6 @@
 596:binary
 597:binary
 ---------------------------- Test 45 ------------------------------
-pcregrep: Error in 2nd command-line regex at offset 9: missing )
 ---------------------------- Test 46 ------------------------------
 AB.VE
 ---------------------------- Test 47 ------------------------------
FAIL: RunGrepTest
===================
5 of 5 tests failed
===================
gmake[1]: *** [check-TESTS] Error 1
gmake[1]: Leaving directory `/tools/pcre-8.10/sparc-sun-sunos4.1.4'
gmake: *** [check-am] Error 2



--
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email