Oops, almost forgot to reply to this...
On 5/5/20 1:36 PM, Miro Hrončok wrote:
On 05. 05. 20 8:43, Panu Matilainen wrote:
Hmm, OTOH this is a bit questionable: macro primitives can only take arguments in the %{foo:bar} form, so perhaps the non-%{} form actually should fall through silently.
OTOH I'd argue anything that resembles a macro, even if nonexistent, should fail immediately if not used properly. That means people will be forced to stop accidentally using %stuff in their specfiles waiting for the moment somebody creates a macro of that name.
That's a fair point, certainly.
If we want to avoid mass breakage, maybe at least issue a waening.
I'd consider this useful:
warning: unescaped % in line 666: %HH, macro %HH doesn't exists
Very much agreed, I actually looked into this just recently. Some discussion and examples of what gets uncovered: https://github.com/rpm-software-management/rpm/pull/1170
The above PR was limited to only %{foo} form of macros, the %foo form is trickier as the spec spec sections appear macros even though they are not, so covering those needs deeper changes into the whole parsing mechanism.
Anyway, this *will* happen sooner or later, undefined macros are such a common source of (packaging) bugs that there's no excuse for rpm to not warn on them. Just like gcc warns on uninitiazed variables.
As a side note, I don't consider this useful:
warning: extra tokens at the end of %endif directive in line 1073: %endif # with tests
Let's just say you're not alone in that. Sadly we're no closer to having a good or even acceptable solution for that.
- Panu -