[libvirt] Syntax check rules broken if 'exclude' is not defined

I noticed that many (most) of the libvirt syntax-check rules were not generating any results, despite me introducing obvious violations.
From my debugging the problem appears to be caused by this commit:
commit 727075d03c670affa68f71313979781f5ba9bbfc Author: Eric Blake <eblake@redhat.com> Date: Thu Mar 1 14:51:31 2012 -0700 maint.mk: add per-line exclusions to prohibitions If I revert the following hunk from maint.mk @@ -258,6 +268,7 @@ define _sc_search_regexp if test -n "$$files"; then \ if test -n "$$prohibit"; then \ grep $$with_grep_options $(_ignore_case) -nE "$$prohibit" $$files \ + | grep -vE "$${exclude-^$$}" \ && { msg="$$halt" $(_sc_say_and_exit) } || :; \ else \ grep $$with_grep_options $(_ignore_case) -LE "$$require" $$files \ then the syntax-check rules work again. It seems that this grep is broken, if a test leaves $exclude undefined, causing it to filter out all results. Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

On 03/29/2012 07:17 AM, Daniel P. Berrange wrote:
I noticed that many (most) of the libvirt syntax-check rules were not generating any results, despite me introducing obvious violations.
From my debugging the problem appears to be caused by this commit:
commit 727075d03c670affa68f71313979781f5ba9bbfc Author: Eric Blake <eblake@redhat.com> Date: Thu Mar 1 14:51:31 2012 -0700
maint.mk: add per-line exclusions to prohibitions
If I revert the following hunk from maint.mk
@@ -258,6 +268,7 @@ define _sc_search_regexp if test -n "$$files"; then \ if test -n "$$prohibit"; then \ grep $$with_grep_options $(_ignore_case) -nE "$$prohibit" $$files \ + | grep -vE "$${exclude-^$$}" \ && { msg="$$halt" $(_sc_say_and_exit) } || :; \ else \ grep $$with_grep_options $(_ignore_case) -LE "$$require" $$files \
then the syntax-check rules work again. It seems that this grep is broken, if a test leaves $exclude undefined, causing it to filter out all results.
I think I figured out why, but I'm still working out how to fix it. cfg.mk is included _before_ maint.mk. Therefore, $_sc_search_regexp) is expanded in cfg.mk prior to the place where maint.mk provides a default definition for $(exclude), so we are getting the wrong thing expanded, which breaks the syntax check rule in cfg.mk. I'll get something working, hopefully later today. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
participants (2)
-
Daniel P. Berrange
-
Eric Blake