Opened 19 years ago

Closed 19 years ago

#5276 closed enhancement (fixed)

RFE: mutt-devel: please add variant to use the GNU regex library

Reported by: hugo@… Owned by: yeled@…
Priority: Normal Milestone:
Component: ports Version: 1.0
Keywords: Cc: yeled@…
Port:

Description

Regular expression support without the GNU regex library is limited.

It would be great to have a variant for the GNU regex library:

variant gnuregex { configure.args-append --enable-regex }

Regards,

Hugo

Attachments (2)

regex.diff (306 bytes) - added by hugo@… 19 years ago.
Diff to enable gnuregex support
portfile.diff (800 bytes) - added by hugo@… 19 years ago.
Patch against version 3 of the Portfile

Download all attachments as: .zip

Change History (14)

comment:1 Changed 19 years ago by hugo@…

severity: normalenhancement

comment:2 Changed 19 years ago by mww@…

Owner: changed from darwinports-bugs@… to mij@…
Summary: mutt-devel: please add variant to use the GNU regex libraryRFE: mutt-devel: please add variant to use the GNU regex library

perhaps supporting gnu-regexp by default would be a good idea just?

comment:3 Changed 19 years ago by hugo@…

I don't see any problem with that.

comment:4 Changed 19 years ago by yeled@…

Status: newassigned

will do.

comment:5 Changed 19 years ago by yeled@…

Resolution: fixed
Status: assignedclosed

comment:6 Changed 19 years ago by hugo@…

Resolution: fixed
Status: closedreopened

I installed the following:

hugo@Oompa-Loompa ~% port installed mutt-devel The following ports are currently installed:

mutt-devel 1.5.11_2+db4+gnuregex+headercache+imap+pop+ssl (active)

It looks like regex support is missing:

hugo@Oompa-Loompa ~% /opt/local/bin/mutt -v | fgrep REGEX +HAVE_REGCOMP -USE_GNU_REGEX

hugo@Oompa-Loompa ~% otool -L /opt/local/bin/mutt /opt/local/bin/mutt:

/usr/lib/libncurses.5.4.dylib (compatibility version 5.4.0, current

version 5.4.0)

/opt/local/lib/libssl.0.9.8.dylib (compatibility version 0.9.8, current

version 0.9.8)

/opt/local/lib/libcrypto.0.9.8.dylib (compatibility version 0.9.8,

current version 0.9.8)

/opt/local/lib/libintl.3.dylib (compatibility version 8.0.0, current

version 8.3.0)

/opt/local/lib/libiconv.2.dylib (compatibility version 6.0.0, current

version 6.0.0)

/opt/local/lib/libdb-4.3.dylib (compatibility version 0.0.0, current

version 0.0.0)

/usr/lib/libmx.A.dylib (compatibility version 1.0.0, current version 92.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version

88.2.1)

I'm wondering if there isn't a weird interaction between the gnuregex port and --with-regex.

Regards,

Hugo

Changed 19 years ago by hugo@…

Attachment: regex.diff added

Diff to enable gnuregex support

comment:7 Changed 19 years ago by yeled@…

Cc: yeled@… added

comment:8 Changed 19 years ago by yeled@…

Owner: changed from mij@… to yeled@…
Status: reopenednew

(In reply to comment #5)

Created an attachment (id=4265) [edit] Diff to enable gnuregex support

Thanks for this.

I'm going to disable the default_variant part of the gnuregex as mutt obviously thinks that the 10.4 regex is fine. And default variants are bad news right now.

I'll add your patch or similar tonight.

To test whether it works or not, try the following as configuration file:

folder-hook a.*?b "set ascii_chars"

Cheers.

comment:9 Changed 19 years ago by yeled@…

I've fixed this and bumped the revision. At least to the point of defining +USE_GNU_REGEX and then hoping the #define picks up gnuregex.h at any rate.

Tell me if you don't agree with the implementation.

one note: your regex is invalid.

<limit>a.*b' or <limit> a.?b'

Changed 19 years ago by hugo@…

Attachment: portfile.diff added

Patch against version 3 of the Portfile

comment:10 Changed 19 years ago by hugo@…

attachments.isobsolete: 01

comment:11 Changed 19 years ago by yeled@…

(In reply to comment #8)

There is an error in your Portfile: the configuration option is --with-regex and not --enable-regex.

oh! thanks. My brain wasn't working today. I even locked myself *in* my house this morning.

Also, you do not need to have both USE_GNU_REGEX defined and have gnuregex.h included.

yeah I just did it for completeness - as I imagined the variable switches output with `mutt -v' came from config.h

If using gnuregex, MUTTLIB should have -lgnuregex added, but that generates bus errors for some reason, so it seems better to use the gnuregex provided by Mutt.

Great. thanks for noting this.

"a.*?b" is a valid regular expression (meaning that the * is not greedy). For "abcb", "ab" will match instead of "abcb". It works if GNU regex support is enabled, and doesn't if it isn't, which is why I requested this variant.

ohhh .. I think i'm letting shell globbing get in the way here. I was thinking:

a = literal . = any char

  • = zero or more of previous char

? = any char (duh!!) b = literal

Therefore, I tweaked your changes to simply test "a.*?b" in configure and let the configure process do the rest, which will result in having USE_GNU_REGEX set.

This is very clever Hugo. Nice work. I will mention it to brendan@… as well.

Thank you for sticking it out with me and getting there in the end :)

comment:12 Changed 19 years ago by yeled@…

Resolution: fixed
Status: newclosed

(In reply to comment #8)

Created an attachment (id=4306) [edit] Patch against version 3 of the Portfile

There is an error in your Portfile: the configuration option is --with-regex and not --enable-regex.

Obviously I'm still not thinking straight. This is a simple fix because mutt enforces the built-in (gnu) _regex.h once we fix the s/enable/with/

So - committing and resolving!

Note: See TracTickets for help on using tickets.