Repository navigation
kubevirt-cdi Makefile defines test: twice, so make warns on every invocation and one rule is dead #4157
Description
packages/system/kubevirt-cdi/Makefile defines test: twice, at lines 9 and 18. GNU make takes the last definition, discards the first, and warns on every invocation in that directory:
warning: overriding commands for target 'test'
warning: ignoring old commands for target 'test'
Both recipes are helm unittest ., so nothing behaves differently today. What is wrong is the shape: one of the two rules is dead, and the warning is printed by every developer and every CI run that enters this package.
How it got there is worth recording, because it is not a mistake either author could have caught alone. The target arrived from 0418577f5, which added it together with a comment explaining that hack/package.mk defines no test target and the sweep skips a package whose make -n test does not resolve. Then #4102 appended a second one, having been written against a tree where the first did not exist yet. Neither diff conflicts with the other, because they touch different lines of the same file, so git merged them silently and make is the first thing that notices.
The fix is deleting one of the two blocks. Keep the one carrying the rationale comment, since that comment is the reason a reader will not delete the target again later.
Swept, and it is the only one
Every packages/**/Makefile on main was checked for a target defined more than once. This is the only real instance.
Two other files matched the first pass and are not defects: packages/system/kamaji/charts/kamaji/Makefile and packages/system/kamaji/charts/kamaji-crds/Makefile open with
docs: HELMDOCS_VERSION := v1.8.1
docs: dockerThe first line is a target-specific variable assignment, which shares the docs: prefix with the rule below it without being a second rule. Both files are vendored upstream charts under charts/ in any case. Worth naming here so the next person running this sweep does not re-derive it, and so the pattern is not "written to match" a hit that was never a defect.
The general shape still deserves attention even though the sweep is clean: two changes that each add a missing target to the same package will always merge without conflict and always produce this, because they touch different lines. Nothing in CI notices, since make's warning does not change the exit status. If that is worth guarding, the guard belongs with the existing invariant that checks a package ships a runnable test target, not as a separate check.
Activity
fix(cdi): stop make update from deleting first-party templates (#4097)
fix(cdi): pin the CDI release kubevirt-cdi is reconciled against and …