bug-coreutils
[Top][All Lists]
Advanced

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

bug#36739: [PATCH] maint: fix issues in syntax-check


From: Akim Demaille
Subject: bug#36739: [PATCH] maint: fix issues in syntax-check
Date: Sat, 20 Jul 2019 09:27:54 +0200

Hi!

I was trying to reproduce some error in gnulib's syntax-check, and faced a few 
issues.

My builddirs are in a separate tree, with symlinks from the src tree to them.  
So running git from builddir will never work.

There are other errors, that I was not addressed.

error_quotes
env.c:337:                                     " error at: %s"), str);
ls.c:2780:                          _("error canonicalizing %s"), name);
ls.c:3199:                          _("error canonicalizing %s"), full_name);
maint.mk: Use quote() for error string arguments


Cheers!

From dd4e813ab7ee3a8d9d27ca8f5eb874f991fff9b8 Mon Sep 17 00:00:00 2001
From: Akim Demaille <address@hidden>
Date: Sat, 20 Jul 2019 09:04:00 +0200
Subject: [PATCH] maint: fix issues in syntax-check

* cfg.mk (sc_prohibit_colon_redirection): Don't expect `|` to denote
the pipe character in git grep.
(sc_tests_executable)
(sc_case_insensitive_file_names)
(sc_some_programs_must_avoid_exit_failure)
(sc_prohibit_test_background_without_cleanup_)
(sc_prohibit_test_calls_print_ver_with_irrelevant_argument)
(sc_prohibit_test_ulimit_without_require_)
(sc_prohibit_test_background_without_cleanup_)
(sc_THANKS_in_duplicates)
*sc_prohibit_test_calls_print_ver_with_irrelevant_argument):
Don't expect builddir to be a descendant of srcdir.
(sc_strftime_check): Don't check file size against 0 when "N\nq\n" was
already put in the file.
* THANKS.in: Remove me.
---
 THANKS.in |  1 -
 cfg.mk    | 39 ++++++++++++++++++++++-----------------
 2 files changed, 22 insertions(+), 18 deletions(-)

diff --git a/THANKS.in b/THANKS.in
index 02b8ada1c..23b089754 100644
--- a/THANKS.in
+++ b/THANKS.in
@@ -25,7 +25,6 @@ Adam Klein                          address@hidden
 Adam Sampson                        address@hidden
 Adrian Bunk                         address@hidden
 AIDA Shinra                         address@hidden
-Akim Demaille                       address@hidden
 Alain Magloire                      address@hidden
 Alan Iwi                            address@hidden
 Alan Jenkins                        address@hidden
diff --git a/cfg.mk b/cfg.mk
index b0b758dd5..b589b40e3 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -121,6 +121,7 @@ sc_tests_list_consistency:
 # Ensure that all version-controlled test scripts are executable.
 sc_tests_executable:
        @set -o noglob 2>/dev/null || set -f;                              \
+       cd $(srcdir);                                                      \
        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/; }      \
@@ -138,8 +139,8 @@ sc_ensure_gl_diffs_apply_cleanly:
 
 # Avoid :>file which doesn't propagate errors
 sc_prohibit_colon_redirection:
-       @cd $(srcdir)/tests && GIT_PAGER= git grep -n ': *>.*||' \
-         && { echo '$(ME): '"The leading colon in :> will hide errors" 1>&2; \
+       @cd $(srcdir)/tests && GIT_PAGER= git grep -En ': *>.*\|\|'     \
+         && { echo '$(ME): '"The leading colon in :> will hide errors" >&2; \
               exit 1; }  \
          || :
 
@@ -407,7 +408,7 @@ check-programs-vs-x:
 
 # 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 . && \
+       @git -C $(srcdir) ls-files | sort -f | src/uniq -Di | grep . && \
          { echo "$(ME): the above file(s) conflict on case insensitive" \
          " file systems" 1>&2; exit 1; } || :
 
@@ -445,20 +446,22 @@ sc_prohibit_stat_macro_address:
 # Ensure that date's --help output stays in sync with the info
 # documentation for GNU strftime.  The only exception is %N and %q,
 # which date accepts but GNU strftime does not.
+#
+# "info foo" fails with error, but not "info foo >/dev/null".
 extract_char = sed 's/^[^%][^%]*%\(.\).*/\1/'
 sc_strftime_check:
        @if test -f $(srcdir)/src/date.c; then                          \
-         grep '^  %.  ' $(srcdir)/src/date.c | sort                    \
-           | $(extract_char) > $@-src;                                 \
-         { echo N; echo q;                                             \
-           info libc date calendar format 2>/dev/null                  \
-             | grep "^ *['\`]%.'$$"| $(extract_char); }| sort >$@-info;\
-         if test $$(stat --format %s $@-info) != 2; then               \
+         if info libc date calendar format 2>/dev/null |               \
+               grep "^ *['\`]%.'$$" >$@-tmp; then                      \
+           { echo N; echo q; $(extract_char) $@-tmp; }| sort           \
+             >$@-info;                                                 \
+           grep '^  %.  ' $(srcdir)/src/date.c | sort                  \
+             | $(extract_char) > $@-src;                               \
            diff -u $@-src $@-info || exit 1;                           \
          else                                                          \
            echo '$(ME): skipping $@: libc info not installed' 1>&2;    \
          fi;                                                           \
-         rm -f $@-src $@-info;                                         \
+         rm -f $@-info $@-src $@-tmp;                                  \
        fi
 
 # Indent only with spaces.
@@ -608,7 +611,8 @@ sc_prohibit_expr_unsigned:
 # 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                                          \
+       @cd $(srcdir)                                                   \
+       && grep -nw EXIT_FAILURE                                        \
            $$(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'     \
@@ -616,22 +620,23 @@ sc_some_programs_must_avoid_exit_failure:
 
 # Ensure that tests call the get_min_ulimit_v_ function if using ulimit -v
 sc_prohibit_test_ulimit_without_require_:
-       @(git grep -l get_min_ulimit_v_ $(srcdir)/tests;                \
-         git grep -l 'ulimit -v' $(srcdir)/tests)                      \
+       @(git -C $(srcdir) grep -l get_min_ulimit_v_ tests;             \
+         git -C $(srcdir) grep -l 'ulimit -v' tests)                   \
          | sort | uniq -u | grep . && { echo "$(ME): the above test(s)"\
          " should match get_min_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)             \
+       @(git -C $(srcdir) grep -El '( &$$|&[^&]*=\$$!)' tests;         \
+         git -C $(srcdir) grep -l 'cleanup_()' 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_ $(srcdir)/tests                         \
+       @cd $(srcdir)                                                   \
+       && git -C  grep -w print_ver_ tests                             \
          | sed 's#:print_ver_##'                                       \
          | { fail=0;                                                   \
              while read file name; do                                  \
@@ -743,7 +748,7 @@ sc_preprocessor_indentation:
 # someone who was initially listed only in THANKS.in later authors a commit,
 # this rule detects that their pair may now be removed from THANKS.in.
 sc_THANKS_in_duplicates:
-       @{ git log --pretty=format:%aN | sort -u;                       \
+       @{ git -C $(srcdir) log --pretty=format:%aN | sort -u;          \
            cut -b-36 $(srcdir)/THANKS.in                               \
              | sed '/^$$/,/^$$/!d;/^$$/d;s/  *$$//'; }                 \
          | sort | uniq -d | grep .                                     \
-- 
2.22.0







reply via email to

[Prev in Thread] Current Thread [Next in Thread]