[Rpm-maint] [rpm-software-management/rpm] RFE: All macro expansion failures should include line numbers for original macro location. (#491)

codonell notifications at github.com
Thu Aug 2 21:15:00 UTC 2018


While developing glibc.spec for Fedora I ran into this issue:
fedpkg srpm
warning: Macro %glibc needs whitespace before body
warning: Macro %glibc needs whitespace before body
Wrote: /mnt/ssd/carlos/fedsrc/glibc-rawhide/glibc-2.28-3.fc29.src.rpm

This was caused by the following line:
1243 # glibc-common:
1244 %define glibc-common_docdir %{glibc_build_sysroot}%{defaultdocdir}/glibc-common

Which used a '-' in a name instead of an underscore, but the error had no line number.

The cause of this is that the expandMacros API contains no line or source file information for any of the macros which are going to be expanded. This appears to be an oversight. Since the API is external I don't know how much can be changed, but it would have been much more helpful to have a line number associated with the failure such that it could be printed to the user.

You basically have to plumb line numbers through:
expandMacros -> doExpandMacros -> expandMacro -> doDefine.

Your best option to avoid ABI issues would be to define rpmExpandMacros2 which takes a rpmSpec structure so you can access the current line number.

Not having the line number available makes debugging harder than it should be.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/491
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20180802/85096fb9/attachment.html>


More information about the Rpm-maint mailing list