**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/2...@github.com>
_______________________________________________
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint