Re: [PATCH] maint: avoid spurious output if program not present

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

 



On 05/10/2010 02:19 PM, Eric Blake wrote:
> Some shells warn about missing programs before redirection;
> the idiomatic way to silence them is to run the program check
> inside a subshell, with the redirections outside the subshell.
> 
> +++ b/cfg.mk
> @@ -252,7 +252,7 @@ sc_prohibit_trailing_blank_lines:
>  preprocessor_exempt = (remote_(driver|protocol)\.h)$$
>  # Enforce recommended preprocessor indentation style.
>  sc_preprocessor_indentation:
> -	@if (cppi --version >/dev/null 2>&1); then			\
> +	@if (cppi --version) >/dev/null 2>&1; then			\

Offlist, Jim reminded me that cfg.mk is only for developers with nice
environments, where we shouldn't need the subshell at all...

>  	  $(VC_LIST_EXCEPT) | grep '\.[ch]$$'				\
>  	    | grep -vE '$(preprocessor_exempt)' | xargs cppi -a -c	\
>  	    || { echo '$(ME): incorrect preprocessor indentation' 1>&2;	\
> diff --git a/src/Makefile.am b/src/Makefile.am
> index fe33cea..1542ab1 100644
> --- a/src/Makefile.am
> +++ b/src/Makefile.am
> @@ -169,7 +169,7 @@ EXTRA_DIST += remote/remote_protocol.x remote/rpcgen_fix.pl
>  # * remove white space at end of buffer
>  .PHONY: remote_protocol-structs
>  remote_protocol-structs:
> -	$(AM_V_GEN)if pdwtags --help > /dev/null 2>&1; then		\
> +	$(AM_V_GEN)if (pdwtags --help) > /dev/null 2>&1; then		\

But here, not only is Solaris /bin/sh noisy (which we are starting to
care less about these days, because it is so crufty), but so is FreeBSD
8.0 /bin/sh, which is a lot newer.  And since it appears as part of the
user's Makefile, rather than development-specific, it should be silent.

Given that analysis, Jim gave the off-list ACK.

So I've kept the second hunk as-is, modified the first to drop the
subshell altogether, and pushed.

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
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]