bugGNU Octave - Bugs: bug #64172, PCRE flags are not set correctly...

 
 

bug #64172: PCRE flags are not set correctly if PCRE2 is partially available, and PCRE is fully available.

Submitter:  Ali Zahraee <dexores>
Submitted:  Tue 09 May 2023 05:19:56 PM UTC
   
 
Category:  Configuration and Build System Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Build Failure
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  8.3.0 Planned Release:  8.3.0
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 16 May 2023 12:40:25 PM UTC, comment #3: 

Thank you for testing the changes.

Closing report as fixed.

Markus Mützel <mmuetzel>
Group Member
Tue 16 May 2023 12:37:12 PM UTC, comment #2: 

Thanks.
I tested the fix on my system, and it's working fine.

I thought initially that the configure script should be modified, so that correct macros are set up in config.h. But after seeing your fix, I realized there's no need for that really.


comment #1:

> Thank you for reporting this issue.
>
> I pushed a change here to the stable branch which should avoid the compilation error:
> http://hg.savannah.gnu.org/hgweb/octave/rev/d313e8ece0b8
>
> It should be part of the next bug fix release.
>
> Marking as ready for test.
>

Ali Zahraee <dexores>
Sat 13 May 2023 11:59:48 AM UTC, comment #1: 

Thank you for reporting this issue.

I pushed a change here to the stable branch which should avoid the compilation error:
http://hg.savannah.gnu.org/hgweb/octave/rev/d313e8ece0b8

It should be part of the next bug fix release.

Marking as ready for test.

Markus Mützel <mmuetzel>
Group Member
Tue 09 May 2023 05:19:56 PM UTC, original submission:  

On my system, I have an incomplete installation of PCRE2. So pcre2.h is available, but pcre2 libraries are not completely available.
I also have a complete installation of PCRE, including pcre.h and the libraries. The output from configure says:


checking for pcre2.h... yes
checking for pcre2_compile_8 in -lpcre2... no
checking for pcre.h... yes
checking for pcre_compile in -lpcre... yes


This results in a misconfiguration of macros in config.h, like this:


/* Define to 1 if PCRE is available. */
#define HAVE_PCRE 1

/* Define to 1 if PCRE2 is available. */
/* #undef HAVE_PCRE2 */

/* Define to 1 if you have the <pcre2.h> header file. */
#define HAVE_PCRE2_H 1

/* Define to 1 if you have the <pcre2/pcre2.h> header file. */
/* #undef HAVE_PCRE2_PCRE2_H */

/* Define to 1 if you have the <pcre.h> header file. */
#define HAVE_PCRE_H 1

/* Define to 1 if you have the <pcre/pcre.h> header file. */
/* #undef HAVE_PCRE_PCRE_H */


This results in the build to fail:



../liboctave/util/lo-regexp.cc:74:9: error: ‘pcre’ does not name a type
   74 | typedef pcre octave_pcre_code;
      |         ^~~~
../liboctave/util/lo-regexp.cc:76:42: error: ‘pcre_free’ was not declared in this scope
   76 | void (*octave_pcre_code_free) (void *) = pcre_free;
      |                                          ^~~~~~~~~
../liboctave/util/lo-regexp.cc:91:33: error: ‘octave_pcre_code’ does not name a type
   91 | octave_pcre_pattern_info (const octave_pcre_code *code, int what, void *where)
      |                                 ^~~~~~~~~~~~~~~~
../liboctave/util/lo-regexp.cc: In function ‘int octave_pcre_pattern_info(const int*, int, void*)’:
../liboctave/util/lo-regexp.cc:96:10: error: ‘pcre_fullinfo’ was not declared in this scope
   96 |   return pcre_fullinfo (code, nullptr, what, where);
      |          ^~~~~~~~~~~~~
../liboctave/util/lo-regexp.cc: In member function ‘void octave::regexp::free()’:
../liboctave/util/lo-regexp.cc:117:38: error: ‘octave_pcre_code’ does not name a type
  117 |   octave_pcre_code_free (static_cast<octave_pcre_code *> (m_code));
      |                                      ^~~~~~~~~~~~~~~~
../liboctave/util/lo-regexp.cc:117:55: error: expected ‘>’ before ‘*’ token
  117 |   octave_pcre_code_free (static_cast<octave_pcre_code *> (m_code));
      |                                                       ^
../liboctave/util/lo-regexp.cc:117:55: error: expected ‘(’ before ‘*’ token
  117 |   octave_pcre_code_free (static_cast<octave_pcre_code *> (m_code));
      |                                                       ^
      |                                                       (
../liboctave/util/lo-regexp.cc:117:56: error: expected primary-expression before ‘>’ token
  117 |   octave_pcre_code_free (static_cast<octave_pcre_code *> (m_code));
      |                                                        ^
../liboctave/util/lo-regexp.cc: In member function ‘void octave::regexp::compile_internal()’:
../liboctave/util/lo-regexp.cc:77:32: error: ‘PCRE_CASELESS’ was not declared in this scope; did you mean ‘PCRE2_CASELESS’?
   77 | #  define OCTAVE_PCRE_CASELESS PCRE_CASELESS
      |                                ^~~~~~~~~~~~~
../liboctave/util/lo-regexp.cc:282:43: note: in expansion of macro ‘OCTAVE_PCRE_CASELESS’
  282 |     = (  (m_options.case_insensitive () ? OCTAVE_PCRE_CASELESS : 0)
      |                                           ^~~~~~~~~~~~~~~~~~~~
../liboctave/util/lo-regexp.cc:78:30: error: ‘PCRE_DOTALL’ was not declared in this scope; did you mean ‘PCRE2_DOTALL’?
   78 | #  define OCTAVE_PCRE_DOTALL PCRE_DOTALL
      |                              ^~~~~~~~~~~
../liboctave/util/lo-regexp.cc:283:49: note: in expansion of macro ‘OCTAVE_PCRE_DOTALL’
  283 |          | (m_options.dotexceptnewline () ? 0 : OCTAVE_PCRE_DOTALL)
      |                                                 ^~~~~~~~~~~~~~~~~~
../liboctave/util/lo-regexp.cc:79:33: error: ‘PCRE_MULTILINE’ was not declared in this scope; did you mean ‘PCRE2_MULTILINE’?
   79 | #  define OCTAVE_PCRE_MULTILINE PCRE_MULTILINE
      |                                 ^~~~~~~~~~~~~~
../liboctave/util/lo-regexp.cc:284:40: note: in expansion of macro ‘OCTAVE_PCRE_MULTILINE’
  284 |          | (m_options.lineanchors () ? OCTAVE_PCRE_MULTILINE : 0)
      |                                        ^~~~~~~~~~~~~~~~~~~~~
../liboctave/util/lo-regexp.cc:80:32: error: ‘PCRE_EXTENDED’ was not declared in this scope; did you mean ‘PCRE2_EXTENDED’?
   80 | #  define OCTAVE_PCRE_EXTENDED PCRE_EXTENDED
      |                                ^~~~~~~~~~~~~
../liboctave/util/lo-regexp.cc:285:40: note: in expansion of macro ‘OCTAVE_PCRE_EXTENDED’
  285 |          | (m_options.freespacing () ? OCTAVE_PCRE_EXTENDED : 0)
      |                                        ^~~~~~~~~~~~~~~~~~~~
../liboctave/util/lo-regexp.cc:81:27: error: ‘PCRE_UTF8’ was not declared in this scope; did you mean ‘PCRE2_UTF’?
   81 | #  define OCTAVE_PCRE_UTF PCRE_UTF8
      |                           ^~~~~~~~~
../liboctave/util/lo-regexp.cc:286:12: note: in expansion of macro ‘OCTAVE_PCRE_UTF’
  286 |          | OCTAVE_PCRE_UTF);
      |            ^~~~~~~~~~~~~~~
../liboctave/util/lo-regexp.cc:318:12: error: ‘pcre_compile’ was not declared in this scope; did you mean ‘pcre2_compile’?
  318 |   m_code = pcre_compile (buf_str.c_str (), pcre_options,
      |            ^~~~~~~~~~~~
      |            pcre2_compile
../liboctave/util/lo-regexp.cc: In member function ‘octave::regexp::match_data octave::regexp::match(const string&) const’:
../liboctave/util/lo-regexp.cc:346:3: error: ‘octave_pcre_code’ was not declared in this scope; did you mean ‘octave_pcre_code_free’?
  346 |   octave_pcre_code *re = static_cast<octave_pcre_code *> (m_code);
      |   ^~~~~~~~~~~~~~~~
      |   octave_pcre_code_free
../liboctave/util/lo-regexp.cc:346:21: error: ‘re’ was not declared in this scope; did you mean ‘rem’?
  346 |   octave_pcre_code *re = static_cast<octave_pcre_code *> (m_code);
      |                     ^~
      |                     rem
../liboctave/util/lo-regexp.cc:346:38: error: ‘octave_pcre_code’ does not name a type
  346 |   octave_pcre_code *re = static_cast<octave_pcre_code *> (m_code);
      |                                      ^~~~~~~~~~~~~~~~
../liboctave/util/lo-regexp.cc:346:55: error: expected ‘>’ before ‘*’ token
  346 |   octave_pcre_code *re = static_cast<octave_pcre_code *> (m_code);
      |                                                       ^
../liboctave/util/lo-regexp.cc:346:55: error: expected ‘(’ before ‘*’ token
  346 |   octave_pcre_code *re = static_cast<octave_pcre_code *> (m_code);
      |                                                       ^
      |                                                       (
../liboctave/util/lo-regexp.cc:346:56: error: expected primary-expression before ‘>’ token
  346 |   octave_pcre_code *re = static_cast<octave_pcre_code *> (m_code);
      |                                                        ^
../liboctave/util/lo-regexp.cc:346:66: error: expected ‘)’ before ‘;’ token
  346 |   octave_pcre_code *re = static_cast<octave_pcre_code *> (m_code);
      |                                                                  ^
      |                                                                  )
../liboctave/util/lo-regexp.cc:82:41: error: ‘PCRE_INFO_CAPTURECOUNT’ was not declared in this scope; did you mean ‘PCRE2_INFO_CAPTURECOUNT’?
   82 | #  define OCTAVE_PCRE_INFO_CAPTURECOUNT PCRE_INFO_CAPTURECOUNT
      |                                         ^~~~~~~~~~~~~~~~~~~~~~
../liboctave/util/lo-regexp.cc:348:33: note: in expansion of macro ‘OCTAVE_PCRE_INFO_CAPTURECOUNT’
  348 |   octave_pcre_pattern_info (re, OCTAVE_PCRE_INFO_CAPTURECOUNT, &subpatterns);
      |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../liboctave/util/lo-regexp.cc:83:38: error: ‘PCRE_INFO_NAMECOUNT’ was not declared in this scope; did you mean ‘PCRE2_INFO_NAMECOUNT’?
   83 | #  define OCTAVE_PCRE_INFO_NAMECOUNT PCRE_INFO_NAMECOUNT
      |                                      ^~~~~~~~~~~~~~~~~~~
../liboctave/util/lo-regexp.cc:349:33: note: in expansion of macro ‘OCTAVE_PCRE_INFO_NAMECOUNT’
  349 |   octave_pcre_pattern_info (re, OCTAVE_PCRE_INFO_NAMECOUNT, &namecount);
      |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~
../liboctave/util/lo-regexp.cc:84:42: error: ‘PCRE_INFO_NAMEENTRYSIZE’ was not declared in this scope; did you mean ‘PCRE2_INFO_NAMEENTRYSIZE’?
   84 | #  define OCTAVE_PCRE_INFO_NAMEENTRYSIZE PCRE_INFO_NAMEENTRYSIZE
      |                                          ^~~~~~~~~~~~~~~~~~~~~~~
../liboctave/util/lo-regexp.cc:350:33: note: in expansion of macro ‘OCTAVE_PCRE_INFO_NAMEENTRYSIZE’
  350 |   octave_pcre_pattern_info (re, OCTAVE_PCRE_INFO_NAMEENTRYSIZE, &nameentrysize);
      |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../liboctave/util/lo-regexp.cc:85:38: error: ‘PCRE_INFO_NAMETABLE’ was not declared in this scope; did you mean ‘PCRE2_INFO_NAMETABLE’?
   85 | #  define OCTAVE_PCRE_INFO_NAMETABLE PCRE_INFO_NAMETABLE
      |                                      ^~~~~~~~~~~~~~~~~~~
../liboctave/util/lo-regexp.cc:351:33: note: in expansion of macro ‘OCTAVE_PCRE_INFO_NAMETABLE’
  351 |   octave_pcre_pattern_info (re, OCTAVE_PCRE_INFO_NAMETABLE, &nametable);
      |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~
../liboctave/util/lo-regexp.cc:395:32: error: ‘PCRE_NO_UTF8_CHECK’ was not declared in this scope; did you mean ‘PCRE2_NO_UTF_CHECK’?
  395 |                                PCRE_NO_UTF8_CHECK | (idx ? PCRE_NOTBOL : 0),
      |                                ^~~~~~~~~~~~~~~~~~
      |                                PCRE2_NO_UTF_CHECK
../liboctave/util/lo-regexp.cc:395:60: error: ‘PCRE_NOTBOL’ was not declared in this scope; did you mean ‘PCRE2_NOTBOL’?
  395 |                                PCRE_NO_UTF8_CHECK | (idx ? PCRE_NOTBOL : 0),
      |                                                            ^~~~~~~~~~~
      |                                                            PCRE2_NOTBOL
../liboctave/util/lo-regexp.cc:393:21: error: ‘pcre_exec’ was not declared in this scope
  393 |       int matches = pcre_exec (re, nullptr, buffer.c_str (),
      |                     ^~~~~~~~~
../liboctave/util/lo-regexp.cc:398:22: error: ‘PCRE_ERROR_MATCHLIMIT’ was not declared in this scope; did you mean ‘PCRE2_ERROR_MATCHLIMIT’?
  398 |       if (matches == PCRE_ERROR_MATCHLIMIT)
      |                      ^~~~~~~~~~~~~~~~~~~~~
      |                      PCRE2_ERROR_MATCHLIMIT
../liboctave/util/lo-regexp.cc:406:11: error: ‘pcre_extra’ was not declared in this scope
  406 |           pcre_extra pe;
      |           ^~~~~~~~~~
../liboctave/util/lo-regexp.cc:408:24: error: ‘PCRE_CONFIG_MATCH_LIMIT’ was not declared in this scope; did you mean ‘PCRE2_CONFIG_MATCHLIMIT’?
  408 |           pcre_config (PCRE_CONFIG_MATCH_LIMIT,
      |                        ^~~~~~~~~~~~~~~~~~~~~~~
      |                        PCRE2_CONFIG_MATCHLIMIT
../liboctave/util/lo-regexp.cc:409:46: error: ‘pe’ was not declared in this scope
  409 |                        static_cast<void *> (&pe.match_limit));
      |                                              ^~
../liboctave/util/lo-regexp.cc:408:11: error: ‘pcre_config’ was not declared in this scope; did you mean ‘pcre2_config’?
  408 |           pcre_config (PCRE_CONFIG_MATCH_LIMIT,
      |           ^~~~~~~~~~~
      |           pcre2_config
../liboctave/util/lo-regexp.cc:411:22: error: ‘PCRE_EXTRA_MATCH_LIMIT’ was not declared in this scope; did you mean ‘PCRE2_EXTRA_MATCH_LINE’?
  411 |           pe.flags = PCRE_EXTRA_MATCH_LIMIT;
      |                      ^~~~~~~~~~~~~~~~~~~~~~
      |                      PCRE2_EXTRA_MATCH_LINE
../liboctave/util/lo-regexp.cc:428:37: error: ‘PCRE_ERROR_NOMATCH’ was not declared in this scope; did you mean ‘PCRE2_ERROR_NOMATCH’?
  428 |       if (matches < 0 && matches != PCRE_ERROR_NOMATCH)
      |                                     ^~~~~~~~~~~~~~~~~~
      |                                     PCRE2_ERROR_NOMATCH
  CC       liboctave/util/libutil_la-oct-atomic.lo
../liboctave/util/lo-regexp.cc:433:22: error: ‘PCRE_ERROR_NOMATCH’ was not declared in this scope; did you mean ‘PCRE2_ERROR_NOMATCH’?
  433 |       if (matches == PCRE_ERROR_NOMATCH)
      |                      ^~~~~~~~~~~~~~~~~~
      |                      PCRE2_ERROR_NOMATCH
../liboctave/util/lo-regexp.cc:477:24: error: ‘pcre_get_substring_list’ was not declared in this scope; did you mean ‘pcre2_substring_list_get’?
  477 |           int status = pcre_get_substring_list (buffer.c_str (), ovector,
      |                        ^~~~~~~~~~~~~~~~~~~~~~~
      |                        pcre2_substring_list_get
../liboctave/util/lo-regexp.cc:480:25: error: ‘PCRE_ERROR_NOMEMORY’ was not declared in this scope; did you mean ‘PCRE2_ERROR_NOMEMORY’?
  480 |           if (status == PCRE_ERROR_NOMEMORY)
      |                         ^~~~~~~~~~~~~~~~~~~
      |                         PCRE2_ERROR_NOMEMORY
../liboctave/util/lo-regexp.cc:541:11: error: ‘pcre_free_substring_list’ was not declared in this scope
  541 |           pcre_free_substring_list (listptr);
      |           ^~~~~~~~~~~~~~~~~~~~~~~~
  CXX      liboctave/util/libutil_la-oct-base64.lo
make[2]: *** [Makefile:25135: liboctave/util/libutil_la-lo-regexp.lo] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory '/home/a/code/octave/.build'
make[1]: *** [Makefile:27931: all-recursive] Error 1
make[1]: Leaving directory '/home/a/code/octave/.build'
make: *** [Makefile:11108: all] Error 2


As a temperory workaround, commenting out this line in config.h let's compilation to proceed:


#define HAVE_PCRE2_H 1


I had a look at configure.ac, but don't have enough knowledge of autoconfg to fix this.

Ali Zahraee <dexores>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mmuetzel (Posted a comment)
  • -email is unavailable- added by dexores (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only project members can vote.

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-05-16 mmuetzel StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2023-05-13 mmuetzel StatusNone Ready For Test
        Operating SystemGNU/Linux Any
        Fixed ReleaseNone 8.3.0
        Planned ReleaseNone 8.3.0

    Back to the top

    Powered by Savane 3.12