Re: What is the status and USP of the Lua rex extension?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


On 1/5/19 8:38 AM, Tim Landscheidt wrote:

with Fedora 28's RPM, I was looking at to mangle some strings.  It
took some experimentation to find that the actually working
syntax is:

| [tim@passepartout ~]$ rpm --eval '%{lua: local re = rex.newPOSIX("abc"); if re:match("abcdef") then print("Matched") else print("Not matched"); end}'
| Matched
| [tim@passepartout ~]$ rpm --eval '%{lua: local re = rex.newPOSIX("abc"); if re:match("acdef") then print("Matched") else print("Not matched"); end}'
| Not matched
| [tim@passepartout ~]$

However, taking as ref-
erence, there does not seem to be a way to access more use-
ful functions like rex.sub(), nor do PCRE regular expres-
sions seem to be available ("attempt to call a nil value
(field 'newPCRE')").

It's just never been built with PCRE support, probably to avoid adding an external dependency (in rpm you'll want to minimize those) The others are probably (much) newer additions, the rexlib embedded in rpm is rather antiquated, from 2003 or so.

Even more confusing, Lua's internal string module seems to
provide most of what is needed (with a slightly different

| [tim@passepartout ~]$ rpm --eval '%{lua: print(string.match("abcdef", "abc"));}'
| abc
| [tim@passepartout ~]$

So what is the status of and advantage to use the rex exten-
sion over the internal string module?  In Fedora's spec
files, rex does not seem to be used once, but string quite a

The status is that ... it's there. This is probably the first time I've ever seen anybody even ask anything about it. Maybe there was more of a difference back in the days of Lua 5.0, dunno.

	- Panu -

Rpm-list mailing list

[Index of Archives]     [RPM Ecosystem]     [Linux Kernel]     [Red Hat Install]     [PAM]     [Red Hat Watch]     [Red Hat Development]     [Red Hat]     [Gimp]     [Yosemite News]     [IETF Discussion]

  Powered by Linux