summaryrefslogtreecommitdiff
path: root/cfg.mk
diff options
context:
space:
mode:
Diffstat (limited to 'cfg.mk')
-rw-r--r--cfg.mk174
1 files changed, 129 insertions, 45 deletions
diff --git a/cfg.mk b/cfg.mk
index 6d96e1b4..29649dcc 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -1,5 +1,5 @@
# Customize maint.mk -*- makefile -*-
-# Copyright (C) 2003-2014 Free Software Foundation, Inc.
+# Copyright (C) 2003-2015 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -45,7 +45,7 @@ export VERBOSE = yes
# 4914152 9e
export XZ_OPT = -8e
-old_NEWS_hash = adf13e9314300d0dff82fa37b247d7db
+old_NEWS_hash = 41e5c3133f5d8947e2ff13aab58fc52b
# Add an exemption for sc_makefile_at_at_check.
_makefile_at_at_check_exceptions = ' && !/^cu_install_prog/ && !/dynamic-dep/'
@@ -61,11 +61,11 @@ sc_dd_O_FLAGS:
perl -nle '/^ +\| (O_\w*)$$/ and print $$1' $(dd); } | sort > $@.1
@{ echo O_NOFOLLOW; perl -nle '/{"[a-z]+",\s*(O_\w+)},/ and print $$1' \
$(dd); } | sort > $@.2
- @diff -u $@.1 $@.2 || diff=1 || diff=; \
+ @diff -u $@.1 $@.2; diff=$$?; \
rm -f $@.1 $@.2; \
- test "$$diff" \
- && { echo '$(ME): $(dd) has inconsistent O_ flag lists'>&2; \
- exit 1; } || :
+ test "$$diff" = 0 \
+ || { echo '$(ME): $(dd) has inconsistent O_ flag lists'>&2; \
+ exit 1; }
# Ensure that dd's definition of LONGEST_SYMBOL stays in sync
# with the strings from the two affected variables.
@@ -74,10 +74,9 @@ sc_dd_max_sym_length:
ifneq ($(wildcard $(dd_c)),)
@len=$$( (sed -n '/conversions\[\] =$$/,/^};/p' $(dd_c);\
sed -n '/flags\[\] =$$/,/^};/p' $(dd_c) ) \
- |sed -n '/"/s/^[^"]*"\([^"]*\)".*/\1/p' \
- | wc --max-line-length); \
+ |sed -n '/"/s/^[^"]*"\([^"]*\)".*/\1/p'| wc -L);\
max=$$(sed -n '/^#define LONGEST_SYMBOL /s///p' $(dd_c) \
- |tr -d '"' | wc --max-line-length); \
+ |tr -d '"' | wc -L); \
if test "$$len" = "$$max"; then :; else \
echo 'dd.c: LONGEST_SYMBOL is not longest' 1>&2; \
exit 1; \
@@ -96,7 +95,8 @@ sc_prohibit_jm_in_m4:
# Ensure that each root-requiring test is run via the "check-root" rule.
sc_root_tests:
@t1=sc-root.expected; t2=sc-root.actual; \
- grep -nl '^ *require_root_$$' `$(VC_LIST) tests` | sort > $$t1; \
+ grep -nl '^ *require_root_$$' `$(VC_LIST) tests` | \
+ sed 's|.*/tests/|tests/|' | sort > $$t1; \
for t in $(all_root_tests); do echo $$t; done | sort > $$t2; \
st=0; diff -u $$t1 $$t2 || st=1; \
rm -f $$t1 $$t2; \
@@ -117,12 +117,22 @@ sc_tests_list_consistency:
# Ensure that all version-controlled test scripts are executable.
sc_tests_executable:
- @test_extensions_rx=`echo $(TEST_EXTENSIONS) \
- | sed -e "s/ / -o -name */g" -e "s/^/-name */"`; \
- find tests/ \( $$test_extensions_rx \) \! -perm -111 -print \
- | sed -e "s/^/$(ME): Please make test executable: /" | grep . \
+ @set -o noglob 2>/dev/null || set -f; \
+ find_ext="-name '' "`printf -- "-o -name *%s " $(TEST_EXTENSIONS)`;\
+ find $(srcdir)/tests/ \( $$find_ext \) \! -perm -u+x -print \
+ | { sed "s|^$(srcdir)/||"; git ls-files $(srcdir)/tests/; } \
+ | sort | uniq -d \
+ | sed -e "s/^/$(ME): Please make test executable: /" | grep . \
&& exit 1; :
+# Ensure all gnulib patches apply cleanly
+sc_ensure_gl_diffs_apply_cleanly:
+ @find $(srcdir)/gl/ -name '*.diff' | while read p; do \
+ patch --fuzz=0 -f -s -d $(srcdir)/gnulib/ -p1 --dry-run < "$$p" >&2 \
+ || { echo "$$p" >&2; echo 'To refresh all gl patches run:' \
+ 'make refresh-gnulib-patches' >&2; exit 1; } \
+ done
+
# Avoid :>file which doesn't propagate errors
sc_prohibit_colon_redirection:
@cd $(srcdir)/tests && GIT_PAGER= git grep -n ': *>.*||' \
@@ -214,14 +224,15 @@ sc_check-I18N-AUTHORS:
'$$(LIBICONV)' 1>&2; exit 1; }; \
done
-# Ensure %j is not used for intmax_t as it's not universally supported.
-# There are issues on HPUX for example. But note that %ju was used between
-# coreutils 8.13 (2011-10) and 8.20 (2012-10) without any reported issue,
-# and the particular issue this check is associated with was for %*jx.
-# So we may be able to relax this restriction soon.
-sc_prohibit-j-printf-format:
- @cd $(srcdir)/src && GIT_PAGER= git grep -n '%[0*]*j[udx]' *.c \
- && { echo '$(ME): Use PRI*MAX instead of %j' 1>&2; exit 1; } \
+# Disallow the C99 printf size specifiers %z and %j as they're not portable.
+# The gnulib printf replacement does support them, however the printf
+# replacement is not currently explicitly depended on by the gnulib error()
+# module for example. Also we use fprintf() in a few places to output simple
+# formats but don't use the gnulib module as it is seen as overkill at present.
+# We'd have to adjust the above gnulib items before disabling this.
+sc_prohibit-c99-printf-format:
+ @cd $(srcdir)/src && GIT_PAGER= git grep -n '%[0*]*[jz][udx]' *.c \
+ && { echo '$(ME): Use PRI*MAX instead of %j or %z' 1>&2; exit 1; } \
|| :
# Ensure the alternative __attribute (keyword) form isn't used as
@@ -239,17 +250,20 @@ sc_prohibit-gl-attributes:
# - the help2man script copied from upstream,
# - tests involving long checksum lines, and
# - the 'pr' test cases.
-LINE_LEN_MAX = 80
FILTER_LONG_LINES = \
- /^[^:]*\.diff:[^:]*:@@ / d; \
- \|^[^:]*man/help2man:| d; \
+ \|^[^:]*man/help2man:| d; \
\|^[^:]*tests/misc/sha[0-9]*sum.*\.pl[-:]| d; \
\|^[^:]*tests/pr/|{ \|^[^:]*tests/pr/pr-tests:| !d; };
sc_long_lines:
- @files=$$($(VC_LIST_EXCEPT)) \
- halt='line(s) with more than $(LINE_LEN_MAX) characters; reindent'; \
+ @wc -L /dev/null >/dev/null 2>/dev/null \
+ || { echo "$@: skipping: wc -L not supported"; exit 0; }; \
+ sed -r 1q /dev/null 2>/dev/null \
+ || { echo "$@: skipping: sed -r not supported"; exit 0; }; \
+ files=$$($(VC_LIST_EXCEPT) | xargs wc -L | sed -rn '/ total$$/d;\
+ s/^ *(8[1-9]|9[0-9]|[0-9]\{3,\}) //p'); \
+ halt='line(s) with more than 80 characters; reindent'; \
for file in $$files; do \
- expand $$file | grep -nE '^.{$(LINE_LEN_MAX)}.' | \
+ expand $$file | grep -nE '^.{80}.' | \
sed -e "s|^|$$file:|" -e '$(FILTER_LONG_LINES)'; \
done | grep . && { msg="$$halt" $(_sc_say_and_exit) } || :
@@ -297,6 +311,12 @@ check-programs-vs-x:
done; \
exit $$status
+# Ensure we can check out on case insensitive file systems
+sc_case_insensitive_file_names: src/uniq
+ @git ls-files | sort -f | src/uniq -Di | grep . && \
+ { echo "$(ME): the above file(s) conflict on case insensitive" \
+ " file systems" 1>&2; exit 1; } || :
+
# Ensure that the end of each release's section is marked by two empty lines.
sc_NEWS_two_empty_lines:
@sed -n 4,/Noteworthy/p $(srcdir)/NEWS \
@@ -337,8 +357,8 @@ sc_strftime_check:
grep '^ %. ' $(srcdir)/src/date.c | sort \
| $(extract_char) > $@-src; \
{ echo N; \
- info libc date calendar format 2>/dev/null|grep '^ `%.'\'\
- | $(extract_char); } | sort > $@-info; \
+ info libc date calendar format 2>/dev/null \
+ | grep "^ *['\`]%.'$$"| $(extract_char); }| sort >$@-info;\
if test $$(stat --format %s $@-info) != 2; then \
diff -u $@-src $@-info || exit 1; \
else \
@@ -353,6 +373,24 @@ sc_prohibit_tab_based_indentation:
halt='TAB in indentation; use only spaces' \
$(_sc_search_regexp)
+# Enforce lowercase 'e' in "I.e.".
+sc_prohibit_uppercase_id_est:
+ @prohibit='I\.E\.' \
+ halt='Uppercase "Id Est" abbreviation; use "I.e.," instead' \
+ $(_sc_search_regexp)
+
+# Enforce double-space before "I.e." at the beginning of a sentence.
+sc_ensure_dblspace_after_dot_before_id_est:
+ @prohibit='\. I\.e\.' \
+ halt='Single space after dot before "i.e."; use ". i.e." instead' \
+ $(_sc_search_regexp)
+
+# Enforce comma after "i.e." (at least before a blank or at EOL).
+sc_ensure_comma_after_id_est:
+ @prohibit='[Ii]\.e\.( |$$)' \
+ halt='Missing comma after "i.e."; use "i.e.," instead' \
+ $(_sc_search_regexp)
+
# The SEE ALSO section of a man page should not be terminated with
# a period. Check the first line after each "SEE ALSO" line in man/*.x:
sc_prohibit_man_see_also_period:
@@ -373,6 +411,17 @@ sc_prohibit_fail_0:
halt='fail=0 initialization' \
$(_sc_search_regexp)
+# Ensure that tests don't use `cmd ... && fail=1` as that hides crashes.
+# The "exclude" expression allows common idioms like `test ... && fail=1`
+# and the 2>... portion allows commands that redirect stderr and so probably
+# independently check its contents and thus detect any crash messages.
+sc_prohibit_and_fail_1:
+ @prohibit='&& fail=1' \
+ exclude='(stat|kill|test |EGREP|grep|env|compare|2> *[^/])' \
+ halt='&& fail=1 detected. Please use: returns_ 1 ... || fail=1' \
+ in_vc_files='^tests/' \
+ $(_sc_search_regexp)
+
# The mode part of a setfacl -m option argument must be three bytes long.
# I.e., an argument of user:bin:rw or user:bin:r will make Solaris 10's
# setfacl reject it with: "Unrecognized character found in mode field".
@@ -435,22 +484,29 @@ sc_prohibit_test_empty:
# 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 . \
+ $$(git grep -El '[^T]_FAILURE|EXIT_CANCELED' $(srcdir)/src) \
+ | grep -vE '= EXIT_FAILURE|return .* \?' | grep . \
&& { echo '$(ME): do not use EXIT_FAILURE in the above' \
1>&2; exit 1; } || :
# Ensure that tests call the require_ulimit_v_ function if using ulimit -v
sc_prohibit_test_ulimit_without_require_:
- @(git grep -l require_ulimit_v_ tests; \
- git grep -l 'ulimit -v' tests) \
+ @(git grep -l require_ulimit_v_ $(srcdir)/tests; \
+ git grep -l 'ulimit -v' $(srcdir)/tests) \
| sort | uniq -u | grep . && { echo "$(ME): the above test(s)"\
" should match require_ulimit_v_ with ulimit -v" 1>&2; exit 1; } || :
+# Ensure that tests call the cleanup_ function if using background processes
+sc_prohibit_test_background_without_cleanup_:
+ @(git grep -El '( &$$|&[^&]*=\$$!)' $(srcdir)/tests; \
+ git grep -l 'cleanup_()' $(srcdir)/tests | sed p) \
+ | sort | uniq -u | grep . && { echo "$(ME): the above test(s)"\
+ " should use cleanup_ for background processes" 1>&2; exit 1; } || :
+
# Ensure that tests call the print_ver_ function for programs which are
# actually used in that test.
sc_prohibit_test_calls_print_ver_with_irrelevant_argument:
- @git grep -w print_ver_ tests \
+ @git grep -w print_ver_ $(srcdir)/tests \
| sed 's#:print_ver_##' \
| { fail=0; \
while read file name; do \
@@ -541,11 +597,9 @@ sc_space_before_open_paren:
# Similar to the gnulib maint.mk rule for sc_prohibit_strcmp
# Use STREQ_LEN or STRPREFIX rather than comparing strncmp == 0, or != 0.
sc_prohibit_strncmp:
- @grep -nE '! *str''ncmp *\(|\<str''ncmp *\(.+\) *[!=]=' \
- $$($(VC_LIST_EXCEPT)) \
- | grep -vE ':# *define STR(N?EQ_LEN|PREFIX)\(' && \
- { echo '$(ME): use STREQ_LEN or STRPREFIX instead of str''ncmp' \
- 1>&2; exit 1; } || :
+ @prohibit='^[^#].*str''ncmp *\(' \
+ halt='use STREQ_LEN or STRPREFIX instead of str''ncmp' \
+ $(_sc_search_regexp)
# Enforce recommended preprocessor indentation style.
sc_preprocessor_indentation:
@@ -565,11 +619,22 @@ sc_preprocessor_indentation:
# this rule detects that their pair may now be removed from THANKS.in.
sc_THANKS_in_duplicates:
@{ git log --pretty=format:%aN | sort -u; \
- cut -b-36 THANKS.in | sed '/^$$/d;s/ *$$//'; } \
+ cut -b-36 $(srcdir)/THANKS.in \
+ | sed '/^$$/,/^$$/!d;/^$$/d;s/ *$$//'; } \
| sort | uniq -d | grep . \
&& { echo '$(ME): remove the above names from THANKS.in' \
1>&2; exit 1; } || :
+# Ensure the contributor list stays sorted. Use our sort as other
+# implementations may result in a different order.
+sc_THANKS_in_sorted: src/sort
+ @sed '/^$$/,/^$$/!d;/^$$/d' $(srcdir)/THANKS.in > $@.1; \
+ LC_ALL=en_US.UTF-8 src/sort -f -k1,1 $@.1 > $@.2
+ @diff -u $@.1 $@.2; diff=$$?; \
+ rm -f $@.1 $@.2; \
+ test "$$diff" = 0 \
+ || { echo '$(ME): THANKS.in is unsorted' 1>&2; exit 1; }
+
# Look for developer diagnostics that are marked for translation.
# This won't find any for which devmsg's format string is on a separate line.
sc_marked_devdiagnostics:
@@ -585,6 +650,21 @@ sc_fs-magic-compare:
&& { echo '$(ME): Constants in src/stat.c should be 4 or 8' \
'upper-case chars' 1>&2; exit 1; } || :
+# Ensure gnulib generated files are ignored
+# TODO: Perhaps augment gnulib-tool to do this in lib/.gitignore?
+sc_gitignore_missing:
+ @{ sed -n '/^\/lib\/.*\.h$$/{p;p}' .gitignore; \
+ find lib -name '*.in*' ! -name '*~' ! -name 'sys_*' | \
+ sed 's|^|/|; s|_\(.*in\.h\)|/\1|; s/\.in//'; } | \
+ sort | uniq -u | grep . && { echo '$(ME): Add above' \
+ 'entries to .gitignore' >&2; exit 1; } || :
+
+# Flag redundant entreis in .gitignore
+sc_gitignore_redundant:
+ @{ grep ^/lib .gitignore; sed 's|^|/lib|' lib/.gitignore; } | \
+ sort | uniq -d | grep . && { echo '$(ME): Remove above' \
+ 'entries from .gitignore' >&2; exit 1; } || :
+
# Override the default Cc: used in generating an announcement.
announcement_Cc_ = $(translation_project_), \
coreutils@gnu.org, coreutils-announce@gnu.org
@@ -603,11 +683,11 @@ exclude_file_name_regexp--sc_bindtextdomain = \
^(gl/.*|lib/euidaccess-stat|src/make-prime-list)\.c$$
exclude_file_name_regexp--sc_trailing_blank = ^(tests/pr/|man/help2man)
exclude_file_name_regexp--sc_system_h_headers = \
- ^src/((system|copy)\.h|libstdbuf\.c|make-prime-list\.c)$$
+ ^src/((system|copy)\.h|make-prime-list\.c)$$
_src = (false|lbracket|ls-(dir|ls|vdir)|tac-pipe|uname-(arch|uname))
exclude_file_name_regexp--sc_require_config_h_first = \
- (^lib/buffer-lcm\.c|src/$(_src)\.c)$$
+ (^lib/buffer-lcm\.c|gl/lib/xdecto.max\.c|src/$(_src)\.c)$$
exclude_file_name_regexp--sc_require_config_h = \
$(exclude_file_name_regexp--sc_require_config_h_first)
@@ -628,7 +708,6 @@ exclude_file_name_regexp--sc_prohibit_atoi_atof = ^lib/euidaccess-stat\.c$$
# longlong.h is maintained elsewhere.
_ll = ^src/longlong\.h$$
exclude_file_name_regexp--sc_useless_cpp_parens = $(_ll)
-exclude_file_name_regexp--sc_long_lines = $(_ll)
exclude_file_name_regexp--sc_space_before_open_paren = $(_ll)
tbi_1 = ^tests/pr/|(^gl/lib/reg.*\.c\.diff|\.mk|^man/help2man)$$
@@ -658,6 +737,11 @@ exclude_file_name_regexp--sc_prohibit_atoi_atof = ^src/make-prime-list\.c$$
# Exception here as we don't want __attribute elided on non GCC
exclude_file_name_regexp--sc_prohibit-gl-attributes = ^src/libstdbuf\.c$$
+exclude_file_name_regexp--sc_prohibit_uppercase_id_est = \.diff$$
+exclude_file_name_regexp--sc_ensure_dblspace_after_dot_before_id_est = \.diff$$
+exclude_file_name_regexp--sc_ensure_comma_after_id_est = \.diff|$(_ll)$$
+exclude_file_name_regexp--sc_long_lines = \.diff$$|$(_ll)
+
# Augment AM_CFLAGS to include our per-directory options:
AM_CFLAGS += $($(@D)_CFLAGS)
@@ -670,7 +754,7 @@ gnulib-tests_CFLAGS = $(GNULIB_TEST_WARN_CFLAGS)
export _gl_TS_headers = $(srcdir)/cfg.mk
_gl_TS_dir = .
_gl_TS_obj_files = src/*.$(OBJEXT)
-_gl_TS_other_headers = src/*.h
+_gl_TS_other_headers = $(srcdir)/src/*.h src/*.h
# Tell the tight_scope rule about an exceptional "extern" variable.
# Normally, the rule would detect its declaration, but that uses a