[Rpm-maint] [rpm-software-management/rpm] Arguments are not propagate into global lua macro (Issue #2910)
Vít Ondruch
notifications at github.com
Wed Feb 14 17:19:57 UTC 2024
**Describe the bug**
It seems that global lua macro does not have correctly populated arguments.
**To Reproduce**
This seems to work as expected:
~~~
$ cat newpackage.spec | head -11
%define foo(a:b) %{lua:
if #arg == 0 then
print('no arguments :(')
else
for i = 1, #arg do
print(arg[i])
end
end
}
%{foo bar}
$ rpmbuild -D "_sourceddir ." -D "_srpmdir ." -bs newpackage.spec
error: line 11: Unknown tag: bar
~~~
IOW it outputs `bar` into the .spec file and therefore the rpmbuild fails. So far so good. However:
~~~
$ sed -i "/foo(/ s/define/global/" newpackage.spec
$ cat newpackage.spec | head -11
%global foo(a:b) %{lua:
if #arg == 0 then
print('no arguments :(')
else
for i = 1, #arg do
print(arg[i])
end
end
}
%{foo bar}
$ rpmbuild -D "_sourceddir ." -D "_srpmdir ." -bs newpackage.spec
error: line 11: Unknown tag: no arguments :(
~~~
IOW this evals the `#arg` to zero and prints the `no arguments :(` message from the associated branch.
**Expected behavior**
The `%global` version should either:
1. Behave the same as `%define` and correctly process arguments.
or
2. Should refuse such use.
**Environment**
- OS / Distribution: Fedora Rawhide
- Version: rpm-4.19.1-4.fc40.x86_64
--
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/2910
You are receiving this because you are subscribed to this thread.
Message ID: <rpm-software-management/rpm/issues/2910 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20240214/079543a2/attachment-0001.html>
More information about the Rpm-maint
mailing list