<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Or a 8.4 optional/experimental feature, where we would allow to
      build either against libc regex or PCRE2 (and enable PCRE2 only if
      explicitly requested at cmake time).<br>
    </p>
    <div class="moz-cite-prefix">Le 08/06/2024 à 18:23, Lime, Steve D
      (MNIT) a écrit :<br>
    </div>
    <blockquote type="cite"
cite="mid:DM6PR09MB4806D7D97F9BB9A14D73CE04DAC42@DM6PR09MB4806.namprd09.prod.outlook.com">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <meta name="Generator"
        content="Microsoft Word 15 (filtered medium)">
      <!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]-->
      <style>@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}@font-face
        {font-family:Aptos;}@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:12.0pt;
        font-family:"Aptos",sans-serif;}a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        font-size:10.0pt;
        font-family:"Courier New";}span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:"Consolas",serif;}span.EmailStyle21
        {mso-style-type:personal-reply;
        font-family:"Aptos",sans-serif;
        color:windowtext;}.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;
        mso-ligatures:none;}div.WordSection1
        {page:WordSection1;}</style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
      <div class="WordSection1">
        <p class="MsoNormal"><span style="font-size:11.0pt">Maybe a 9.0
            change then? Sounds like the underlying issues should be
            fixed regardless though.<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
        <div>
          <div
style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
            <p class="MsoNormal"><b><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif">
                MapServer-dev
                <a class="moz-txt-link-rfc2396E" href="mailto:mapserver-dev-bounces@lists.osgeo.org"><mapserver-dev-bounces@lists.osgeo.org></a>
                <b>On Behalf Of </b>Even Rouault via MapServer-dev<br>
                <b>Sent:</b> Saturday, June 8, 2024 10:37 AM<br>
                <b>To:</b> Paul Ramsey
                <a class="moz-txt-link-rfc2396E" href="mailto:pramsey@cleverelephant.ca"><pramsey@cleverelephant.ca></a>; Steve Lime
                <a class="moz-txt-link-rfc2396E" href="mailto:sdlime@gmail.com"><sdlime@gmail.com></a><br>
                <b>Cc:</b> MapServer Devs
                <a class="moz-txt-link-rfc2396E" href="mailto:mapserver-dev@lists.osgeo.org"><mapserver-dev@lists.osgeo.org></a><br>
                <b>Subject:</b> Re: [MapServer-dev] GNU Regex
                Replacement?<o:p></o:p></span></p>
          </div>
        </div>
        <p class="MsoNormal"><o:p> </o:p></p>
        <table class="MsoNormalTable" style="width:100.0%" width="100%"
          cellspacing="0" cellpadding="0" border="0" align="left">
          <tbody>
            <tr>
              <td
style="background:#FFC845;padding:5.25pt 1.5pt 5.25pt 1.5pt"><br>
              </td>
              <td
style="width:100.0%;background:#FFF3DD;padding:5.25pt 3.75pt 5.25pt 11.25pt"
                width="100%">
                <div>
                  <div>
                    <p class="MsoNormal"
style="mso-element:frame;mso-element-frame-hspace:2.25pt;mso-element-wrap:around;mso-element-anchor-vertical:paragraph;mso-element-anchor-horizontal:column;mso-height-rule:exactly">
                      <b><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#003865">This
                          message may be from an external email source.</span></b><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#003865"><o:p></o:p></span></p>
                  </div>
                  <div>
                    <p class="MsoNormal"
style="mso-element:frame;mso-element-frame-hspace:2.25pt;mso-element-wrap:around;mso-element-anchor-vertical:paragraph;mso-element-anchor-horizontal:column;mso-height-rule:exactly">
                      <span
style="font-size:9.0pt;font-family:"Calibri",sans-serif;color:#003865">Do
                        not select links or open attachments unless
                        verified. Report all suspicious emails to
                        Minnesota IT Services Security Operations
                        Center.<o:p></o:p></span></p>
                  </div>
                </div>
              </td>
            </tr>
          </tbody>
        </table>
        <p class="MsoNormal"><o:p> </o:p></p>
        <div class="MsoNormal" style="text-align:center" align="center">
          <hr width="100%" size="2" align="center">
        </div>
        <div>
          <p>UPDATE: msautotest now pass against PCRE2 with a few extra
            fixes.<o:p></o:p></p>
          <p>This was actually quite helpful to uncover 2 underlying
            issues, not related to PCRE2 itself:<o:p></o:p></p>
          <p>- one (likely) wrong default regex with
            ms_map_bad_pattern_default in msCGILoadMap() where escaping
            antislash was missing (probably tolerated by GNU regex , but
            PCRE2 is more picky about that). Easy to fix<o:p></o:p></p>
          <p>- and more embarrassing, our redefined MS_REG_xxxx
            constants in mapregex.h happen to not match the values of
            GNU regex (they might perhaps have matched in earlier times,
            but things have drifted apart since then)... In particular,
            MS_REG_NOSUB = 4 was thus wrongly interpreted as REG_NEWLINE
            = (1 << 2). I loose some extra hair on figuring that
            out. The symptom was in rfc62.map where a query string
            parameter whose value is "foo%0Abar" (foo newline bar)
            happened to validate (with GNU regex) the following
            expression '^[a-z]{1,16}$' whereas it shouldn't have (our
            expected result was incorrect). The value matched because
            msEvalRegex() sets MS_REG_NOSUB which was wrongly
            interpreted as REG_NEWLINE, thus making the caret / dollar
            to apparently match any line instead of the whole string.
            When using PCRE2, the match didn't occur because PCRE2 and
            GNU regex have exactly subtle different semantics regarding
            newline matching (I tried to understand
            <a
href="https://www.pcre.org/current/doc/html/pcre2posix.html#SEC5"
              moz-do-not-send="true" class="moz-txt-link-freetext">https://www.pcre.org/current/doc/html/pcre2posix.html#SEC5</a>,
            but beyond my mastering)<o:p></o:p></p>
          <p>So all in all, it seems PCRE2 could be a viable
            alternative. I would expect "subtle" differences, so any
            mapfile having regular expressions in it that was tested
            with GNU/BSD/POSIX/whatever regex should be carefully
            checked for correct execution if switching to PCRE2<o:p></o:p></p>
          <p>Even<o:p></o:p></p>
          <div>
            <p class="MsoNormal">Le 08/06/2024 à 15:35, Even Rouault via
              MapServer-dev a écrit :<o:p></o:p></p>
          </div>
          <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
            <p>Hi,<o:p></o:p></p>
            <p>my attempt at <a
                href="https://github.com/MapServer/MapServer/pull/7073"
                moz-do-not-send="true" class="moz-txt-link-freetext">https://github.com/MapServer/MapServer/pull/7073</a>
              . It links, but PCRE2 doesn't seem to speak the same regex
              dialect as GNU regex...<o:p></o:p></p>
            <p>Even<o:p></o:p></p>
            <div>
              <p class="MsoNormal">Le 08/06/2024 à 05:31, Paul Ramsey
                via MapServer-dev a écrit :<o:p></o:p></p>
            </div>
            <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
              <p class="MsoNormal">Looks like it was in Centos as far
                back as 7, and is in base Ubuntu. It’s in MacPorts and
                Homebrew. So, fairly common?
                <o:p></o:p></p>
              <div>
                <p class="MsoNormal">P.<o:p></o:p></p>
                <div>
                  <p class="MsoNormal"><br>
                    <br>
                    <o:p></o:p></p>
                  <blockquote
                    style="margin-top:5.0pt;margin-bottom:5.0pt">
                    <div>
                      <p class="MsoNormal">On Jun 7, 2024, at 8:06<span
style="font-family:"Arial",sans-serif"> </span>PM, Steve Lime
                        <a href="mailto:sdlime@gmail.com"
                          moz-do-not-send="true"><sdlime@gmail.com></a>
                        wrote:<o:p></o:p></p>
                    </div>
                    <p class="MsoNormal"><o:p> </o:p></p>
                    <div>
                      <div>
                        <p class="MsoNormal">One would think replacement
                          wouldn’t be that hard. It’s pretty localized
                          in MapServer. Is pcre2 widely available?<o:p></o:p></p>
                      </div>
                      <div>
                        <p class="MsoNormal"><o:p> </o:p></p>
                        <div>
                          <div>
                            <p class="MsoNormal">On Fri, Jun 7, 2024 at
                              2:40<span
style="font-family:"Arial",sans-serif"> </span>PM Paul Ramsey
                              via MapServer-dev <<a
href="mailto:mapserver-dev@lists.osgeo.org" moz-do-not-send="true"
                                class="moz-txt-link-freetext">mapserver-dev@lists.osgeo.org</a>>
                              wrote:<o:p></o:p></p>
                          </div>
                          <blockquote
style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
                            <p class="MsoNormal">We dragged around a
                              dependency on pcre which got updated to
                              pcre2 lately.
                              <br>
                              <br>
                              > On Jun 7, 2024, at 12:38<span
style="font-family:"Arial",sans-serif"> </span>PM, Howard
                              Butler via MapServer-dev <<a
href="mailto:mapserver-dev@lists.osgeo.org" target="_blank"
                                moz-do-not-send="true"
                                class="moz-txt-link-freetext">mapserver-dev@lists.osgeo.org</a>>
                              wrote:<br>
                              > <br>
                              > I was playing around with getting
                              Conda Forge builds of MapServer working,
                              and when I got to Windows, I realized we
                              need the GNU Regex library<br>
                              > <br>
                              > <a
href="https://github.com/conda-forge/mapserver-feedstock/issues/47#issue-2341018003"
                                target="_blank" moz-do-not-send="true"
                                class="moz-txt-link-freetext">
https://github.com/conda-forge/mapserver-feedstock/issues/47#issue-2341018003</a><br>
                              > <br>
                              > It is ancient, not released as a
                              standalone library anymore, and causes
                              anything linking against it to also be GPL
                              (which we're doing in the Windows build
                              situation). Maybe it is not worth the
                              trouble to change anything, but if one
                              were to do so, what should be used in its
                              place?<br>
                              > <br>
                              > Howard<br>
                              >
                              _______________________________________________<br>
                              > MapServer-dev mailing list<br>
                              > <a
href="mailto:MapServer-dev@lists.osgeo.org" target="_blank"
                                moz-do-not-send="true"
                                class="moz-txt-link-freetext">MapServer-dev@lists.osgeo.org</a><br>
                              > <a
href="https://lists.osgeo.org/mailman/listinfo/mapserver-dev"
                                target="_blank" moz-do-not-send="true"
                                class="moz-txt-link-freetext">
https://lists.osgeo.org/mailman/listinfo/mapserver-dev</a><br>
                              <br>
_______________________________________________<br>
                              MapServer-dev mailing list<br>
                              <a
href="mailto:MapServer-dev@lists.osgeo.org" target="_blank"
                                moz-do-not-send="true"
                                class="moz-txt-link-freetext">MapServer-dev@lists.osgeo.org</a><br>
                              <a
href="https://lists.osgeo.org/mailman/listinfo/mapserver-dev"
                                target="_blank" moz-do-not-send="true"
                                class="moz-txt-link-freetext">https://lists.osgeo.org/mailman/listinfo/mapserver-dev</a><o:p></o:p></p>
                          </blockquote>
                        </div>
                      </div>
                    </div>
                  </blockquote>
                </div>
                <p class="MsoNormal"><o:p> </o:p></p>
              </div>
              <p class="MsoNormal"><br>
                <br>
                <o:p></o:p></p>
              <pre>_______________________________________________<o:p></o:p></pre>
              <pre>MapServer-dev mailing list<o:p></o:p></pre>
              <pre><a href="mailto:MapServer-dev@lists.osgeo.org"
              moz-do-not-send="true" class="moz-txt-link-freetext">MapServer-dev@lists.osgeo.org</a><o:p></o:p></pre>
              <pre><a
href="https://lists.osgeo.org/mailman/listinfo/mapserver-dev"
              moz-do-not-send="true" class="moz-txt-link-freetext">https://lists.osgeo.org/mailman/listinfo/mapserver-dev</a><o:p></o:p></pre>
            </blockquote>
            <pre>-- <o:p></o:p></pre>
            <pre><a href="http://www.spatialys.com/"
            moz-do-not-send="true" class="moz-txt-link-freetext">http://www.spatialys.com</a><o:p></o:p></pre>
            <pre>My software is free, but my time generally not.<o:p></o:p></pre>
            <p class="MsoNormal"><br>
              <br>
              <o:p></o:p></p>
            <pre>_______________________________________________<o:p></o:p></pre>
            <pre>MapServer-dev mailing list<o:p></o:p></pre>
            <pre><a href="mailto:MapServer-dev@lists.osgeo.org"
            moz-do-not-send="true" class="moz-txt-link-freetext">MapServer-dev@lists.osgeo.org</a><o:p></o:p></pre>
            <pre><a
href="https://lists.osgeo.org/mailman/listinfo/mapserver-dev"
            moz-do-not-send="true" class="moz-txt-link-freetext">https://lists.osgeo.org/mailman/listinfo/mapserver-dev</a><o:p></o:p></pre>
          </blockquote>
          <pre>-- <o:p></o:p></pre>
          <pre><a href="http://www.spatialys.com/"
          moz-do-not-send="true" class="moz-txt-link-freetext">http://www.spatialys.com</a><o:p></o:p></pre>
          <pre>My software is free, but my time generally not.<o:p></o:p></pre>
        </div>
      </div>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
<a class="moz-txt-link-freetext" href="http://www.spatialys.com">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
  </body>
</html>