Re: [FIRST-PATCH] updated the negation STREQ to STRNEQ

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 24.09.2015 15:11, Lasya Venneti wrote:
> Dear Sir,
> The cfg.mk link isn't working for me sir..
> From what I understand Makefile will have the following:
> 
> target: dependency1 dependency2 ...
> [TAB] action1
> [TAB] action2
> 
> Does the syntax-check rule have to be in place of 'actions' in the form of
> a shell command, and then raise an error whenever the shell command returns
> occurrences of the string !STREQ or !STRNEQ ? Request you to please
> elaborate a little.
> 

In libvirt Makefile, there are several targets. Among the usual ones,
like 'all' and 'check', we have 'syntax-check'. In fact, I usually run
all these three at once:

  libvirt.git$ make -j5 all syntax-check check

Now, the syntax-check rule is there to check whether our code obeys with
our code formatting rules (as its name suggests). However, the rules are
stored in cfg.mk. And they are negated, because it works like this: for
every rule, grep with the rule's pattern is run and whenever a non-empty
output is found an error is printed out. For instance, we have:

sc_prohibit_getenv:
	@prohibit='\b(secure_)?getenv *\('			\
	exclude='exempt from syntax-check'			\
	halt='Use virGetEnv{Allow,Block}SUID instead of getenv'	\
	  $(_sc_search_regexp)

So here, we forbid using getenv() or secure_getenv(). Whenever such
function would be used, the error message suggesting using of
virGetEnv..() is printed out. However, there are some exceptions to this
rule: those lines which contains "exempt from syntax-check" (usually to
be found in a comment) are not considered as rule-breaker. Moreover, we
have the following lines in cfg.mk too:

exclude_file_name_regexp--sc_prohibit_getenv = \
  ^tests/.*\.[ch]$$

This tells the syntax-check to not grep over any .c or .h file under
tests/ directory. So getenv() can be used safely there - and in fact it is.

Hopefully, I've explained it enough, so that you can write a simple rule
to forbid !STREQ and !STRNEQ in favour of STRNEQ and STREQ respectively.

Michal

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]