On 21/02/10 13:43, jema...@gnu.org wrote:

Hi.

Just another little patch to avoid some of the sc_* rules to freeze if
the filtering of VC_LIST_EXCEPT gives an empty string (for example,
'make sc_error_exit_success' freezes if there are not source files in
${srcdir}/).

I found this problem due to the bazaar issue in vc-list-files.


2010-02-21  Jose E. Marchesi<jema...@gnu.org>

        * top/maint.mk (sc_error_exit_success): Apply the rule only if the
        filtering of VC_LIST_EXCEPT is not empty.  Otherwise the main grep
        freezes waiting for data in the standard input.
        (sc_makefile_TAB_only_indentation): Likewise.
        (sc_makefile_path_separator_check): Likewise.
        (sc_m4_quote_check): Likewise.

diff --git a/top/maint.mk b/top/maint.mk
index 7d84b6c..11afe6b 100644
--- a/top/maint.mk
+++ b/top/maint.mk
@@ -217,9 +217,13 @@ sc_prohibit_magic_number_exit:
  # Using EXIT_SUCCESS as the first argument to error is misleading,
  # since when that parameter is 0, error does not exit.  Use `0' instead.
  sc_error_exit_success:
-       @grep -nE 'error \(EXIT_SUCCESS,'                               \
-           $$($(VC_LIST_EXCEPT) | grep -E '\.[chly]$$')&&              \
-         { echo '$(ME): found error (EXIT_SUCCESS' 1>&2; exit 1; } || :
+       @if $(VC_LIST_EXCEPT) | grep -E '\.[chly]$$'>  /dev/null; then  \
+         grep -nE 'error \(EXIT_SUCCESS,'                              \
+               $$($(VC_LIST_EXCEPT) | grep -E '\.[chly]$$')&&          \
+         { echo '$(ME): found error (EXIT_SUCCESS'                     \
+               1>&2; exit 1; } || :;                                    \
+       else :;                                                         \
+       fi

Would it be better to just add /dev/null as a parameter to grep?
I.E. like:

        @grep -nE 'error \(EXIT_SUCCESS,'                               \
            $$($(VC_LIST_EXCEPT) /dev/null | grep -E '\.[chly]$$')&&    \
          { echo '$(ME): found error (EXIT_SUCCESS' 1>&2; exit 1; } || :

cheers,
Pádraig.


Reply via email to