diff options
author | Jim Meyering <meyering@redhat.com> | 2012-07-03 20:14:56 +0200 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2012-07-03 20:14:56 +0200 |
commit | 74427c76d7be2a5522a8d24e29bfa63c299dbbce (patch) | |
tree | ef69c5898e0c27c075f1ee7165b99d247e73d99b | |
parent | fc895b0772c80dfcb099325788478b965bae2196 (diff) | |
download | coreutils-74427c76d7be2a5522a8d24e29bfa63c299dbbce.tar.xz |
maint: add syntax-check rule to help avoid misuse of EXIT_FAILURE
* cfg.mk (sc_some_programs_must_avoid_exit_failure): New rule,
to help us avoid using EXIT_FAILURE in programs like sort, ls, nohup,
timeout, env, etc. that use different exit codes in many cases.
-rw-r--r-- | cfg.mk | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -319,6 +319,16 @@ sc_prohibit_test_backticks: halt='use $$(...), not `...` in tests/' \ $(_sc_search_regexp) +# Programs like sort, ls, expr use PROG_FAILURE in place of EXIT_FAILURE. +# Others, use the EXIT_CANCELED, EXIT_ENOENT, etc. macros defined in system.h. +# In those programs, ensure that EXIT_FAILURE is not used by mistake. +sc_some_programs_must_avoid_exit_failure: + @grep -nw EXIT_FAILURE \ + $$(git grep -El '[^T]_FAILURE|EXIT_CANCELED' src) \ + | grep -vE '= EXIT_FAILURE|exit \(.* \?' | grep . \ + && { echo '$(ME): do not use EXIT_FAILURE in the above' \ + 1>&2; exit 1; } || : + # Exempt the contents of any usage function from the following. _continued_string_col_1 = \ s/^usage .*?\n}//ms;/\\\n\w/ and print ("$$ARGV\n"),$$e=1;END{$$e||=0;exit $$e} |