Bug 261469

Summary: shells/zsh: Fails to run running`setopt rematchpcre`: failed to load module `zsh/pcre': Cannot open "/usr/local/lib/zsh/5.8/zsh/pcre.so"
Product: Ports & Packages Reporter: Steven Bakker <sb>
Component: Individual Port(s)Assignee: Baptiste Daroussin <bapt>
Status: Open ---    
Severity: Affects Some People CC: fernape
Priority: --- Keywords: needs-qa, regression
Version: LatestFlags: fernape: maintainer-feedback? (bapt)
koobs: merge-quarterly?
Hardware: amd64   
OS: Any   

Description Steven Bakker 2022-01-25 16:55:52 UTC
On FreeBSD 12.3-RELEASE, zsh-5.8; when I type "setopt rematchpcre" I get the message:

    failed to load module `zsh/pcre': Cannot open "/usr/local/lib/zsh/5.8/zsh/pcre.so"
    -pcre-match not available for regex

When I run "man zshmodules", though, the "zsh/pcre" module is mentioned.

This seems to be a regression.
Comment 1 Baptiste Daroussin freebsd_committer freebsd_triage 2022-08-23 13:52:19 UTC
this is not a regression, the pcre option is off by default since its introduction in 2007.

am I missing something?
Comment 2 Steven Bakker 2022-08-26 09:19:24 UTC
The "pcre" option is indeed turned off by default in the shell, hence my attempt to enable it through "setopt rematchpcre".

IIRC, in either FreeBSD 11 or 10, this worked correctly, i.e. the shell option was turned off by default, but the pcre.so extension was installed and available by giving the "setopt rematchpcre" command.

It looks as if the zsh was previously configured/compiled with "--enable-pcre", but this configuration flag was left off for the 12.3 build. Hence, not only is the pcre module not turned on by default (which is not a problem), it is now *impossible* to turn it on explicitly (which *is* a problem).

Hope this clarifies the issue.
Comment 3 Baptiste Daroussin freebsd_committer freebsd_triage 2022-08-31 14:52:55 UTC
It is not built by default aka not available at all in the default package one has to rebuild with the PCRE option set on at build time.

If if rebuild with PCRE on
zmodload zsh/pcre
setopt rematchpcre

works as expected.

I have looked at the history and I never activated at all the build of the pcre support for the last 10 years, so I am suprised it somehow worked for you in earlier version of FreeBSD