RPM

nested lua expansions not supported

Bug #635855 reported by Jeff Johnson
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
RPM
Triaged
Low
Unassigned
Fedora
Fix Released
Medium

Bug Description

tracker

Tags: fedora lua macros
Revision history for this message
In , Carl (carl-redhat-bugs) wrote :

Description of problem:

Nested lua expansions in an RPM spec file don't appear to work. From what I can tell (also by peeking at the RPM sources) the print buffer for lua expansions is not preserved between nested lua invocations.

Version-Release number of selected component (if applicable):

rpm-4.6.0-1.fc10.x86_64 (also affects F9 rpm)

How reproducible:

Always (see attach spec)

Steps to Reproduce:
1. download the attached spec file
2. rpmbuild --nodeps -bs *.spec
3. rpm -qp --requires *.src.rpm

Actual results:

Expected results:

Additional info:

I guess the workaround is to never nest lua expansions, but it can be tricky if other rpm macros are defined in terms of them...

Revision history for this message
In , Carl (carl-redhat-bugs) wrote :

Created attachment 335592
spec file with lua scripts

Revision history for this message
In , Jeff (jeff-redhat-bugs) wrote :

(aside)
Nested lua expansions actually "work" @rpm5.org.

Here's your foo.spec with %trace added:
  0< # this statement stumbles (print buffer is mis-directed)
  1> %{expand:%{lua:
  foo = rpm.expand("%__foo")
  print("BuildRequires: " .. foo .. "-devel" .. "\n")
}}^
  2> %{lua:
  foo = rpm.expand("%__foo")
  print("BuildRequires: " .. foo .. "-devel" .. "\n")
}^
  1> %__foo^
  2> %{lua:
  print("foo")
}^
  1< foo
  0< foo
  1< BuildRequires: foo-devel
  1< BuildRequires: foo-devel
  0< BuildRequires: foo-devel

But the fundamental issue for RPM is
    Is there any need for multiple nested lua invocations in RPM
    coordinated through a print buffer?

E.g. the embedded lua interpreter is (by intent) persistent so that
variables can be shared between invocations.

OTOH, the expectation here is that the print buffer be specifcally tied
to each nested invocation, i.e. unshared. That isn't a suprising expectation,
just not what was/is implemented with embedded lua.

Its conceivable to have lua invocations behave either with globally
shared state, or with independent nested invocations, dependent
on how invoked. The analogue in shell is {} vs () nesting, commands within
{} are executed by the current interpreter, () nests an interpreter when needed.

But that just brings me full circle to
    Is there really any need for this level of complexity to generate
        BuildRequires: foo-devel

Revision history for this message
In , Bug (bug-redhat-bugs) wrote :

This message is a reminder that Fedora 10 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 10. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora
'version' of '10'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version prior to Fedora 10's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that
we may not be able to fix it before Fedora 10 is end of life. If you
would still like to see this bug fixed and are able to reproduce it
against a later version of Fedora please change the 'version' of this
bug to the applicable version. If you are unable to change the version,
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

The process we are following is described here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Jeff Johnson (n3npq)
tags: added: fedora lua
Changed in rpm:
status: New → Triaged
importance: Undecided → Low
Jeff Johnson (n3npq)
tags: added: macros
Revision history for this message
In , Panu (panu-redhat-bugs) wrote :

FWIW, support for nested Lua macros has now been added upstream.

Revision history for this message
In , Panu (panu-redhat-bugs) wrote :

Nested lua macros are supported in rpm >= 4.9.1, in rawhide now.

Changed in fedora:
importance: Unknown → Medium
status: Unknown → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related blueprints

Remote bug watches

Bug watches keep track of this bug in other bug trackers.