Hi James,

the attached is a set of patches to avoid various failures from
'make syntax-check'.  They are supposed to be squashed into one
commit, and only left separate to ease the review.

Thanks & have a nice day,
Berny
>From 923c22d27a9467fbe2a8cdf00f4210ccbab672bf Mon Sep 17 00:00:00 2001
From: Bernhard Voelker <m...@bernhard-voelker.de>
Date: Sun, 27 Dec 2015 22:57:47 +0100
Subject: [PATCH 01/10] maint: avoid syntax-check failures

* Makefile.am (gen-ChangeLog): Replace 8 spaces by a tab to avoid
sc_makefile_TAB_only_indentation failure.
---
 Makefile.am | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index af82d54..6d6d83c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -44,7 +44,7 @@ gen-ChangeLog:
 	      && cat $(top_srcdir)/ChangeLog-2013 ;                \
 	    } > $(distdir)/cl-t                                    \
 	      && { rm -f $(distdir)/ChangeLog                      \
-	             && mv $(distdir)/cl-t $(distdir)/ChangeLog; } \
+		     && mv $(distdir)/cl-t $(distdir)/ChangeLog; } \
 	else                                                       \
 	  echo "WARNING: $@: cannot generate ChangeLog since" >&2 && \
 	  echo "$(top_srcdir) has no .git subdirectory" >&2 ;      \
-- 
2.1.4


>From 785fd3bd6d82edd91e29def67c890d47f51fd545 Mon Sep 17 00:00:00 2001
From: Bernhard Voelker <m...@bernhard-voelker.de>
Date: Sun, 27 Dec 2015 23:05:02 +0100
Subject: [PATCH 02/10] maint: avoid syntax-check failures

* po/POTFILES.in: Remove some entries to let sc_po_check pass.
While at it, sort the entries.
---
 po/POTFILES.in | 31 ++-----------------------------
 1 file changed, 2 insertions(+), 29 deletions(-)

diff --git a/po/POTFILES.in b/po/POTFILES.in
index 4783e7c..b90c7ca 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -7,50 +7,23 @@
 
 #Package source files
 find/exec.c
-find/oldfind.c
-find/finddata.c
 find/fstype.c
 find/ftsfind.c
+find/oldfind.c
 find/parser.c
 find/pred.c
 find/print.c
 find/tree.c
 find/util.c
-gl/lib/argmatch.c
-gl/lib/closein.c
-gl/lib/closeout.c
-gl/lib/error.c
-gl/lib/fnmatch_loop.c
-gl/lib/getopt.c
-gl/lib/openat-die.c
-gl/lib/parse-datetime.c
-gl/lib/quotearg.c
-gl/lib/rpmatch.c
-gl/lib/strftime.c
-gl/lib/version-etc.c
-gl/lib/xalloc-die.c
-gl/lib/xstrtol-error.c
-lib/buildcmd.c
-lib/fdleak.c
-lib/findutils-version.c
 lib/buildcmd.c
-lib/dircallback.c
-lib/extendbuf.c
 lib/fdleak.c
 lib/findutils-version.c
-lib/forcefindlib.c
 lib/listfile.c
-lib/printquoted.c
-lib/qmark.c
-lib/regexprops.c
 lib/regextype.c
 lib/safe-atoi.c
-lib/splitstring.c
-lib/test_splitstring.c
-lib/waitpid.c
 locate/bigram.c
 locate/code.c
 locate/frcode.c
 locate/locate.c
 locate/word_io.c
-xargs/xargs.c
\ No newline at end of file
+xargs/xargs.c
-- 
2.1.4


>From 710c51e7e98a6694e108e95f3e1dbc8f41299e76 Mon Sep 17 00:00:00 2001
From: Bernhard Voelker <m...@bernhard-voelker.de>
Date: Sun, 27 Dec 2015 23:08:18 +0100
Subject: [PATCH 03/10] maint: avoid syntax-check failures

* find/print.c (do_fprintf): Remove stray semicolon to let
sc_prohibit_double_semicolon pass.
* find/util.c (digest_mode): Likewise.
---
 find/print.c | 2 +-
 find/util.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/find/print.c b/find/print.c
index 6973426..e4c28ad 100644
--- a/find/print.c
+++ b/find/print.c
@@ -1132,7 +1132,7 @@ do_fprintf (struct format_val *dest,
 
         case 'S':               /* sparseness */
           /* UNTRUSTED, probably unexploitable */
-          checked_fprintf (dest, segment->text, file_sparseness (stat_buf));;
+          checked_fprintf (dest, segment->text, file_sparseness (stat_buf));
           break;
 
         case 't':               /* mtime in `ctime' format */
diff --git a/find/util.c b/find/util.c
index 0560e63..db10323 100644
--- a/find/util.c
+++ b/find/util.c
@@ -728,7 +728,7 @@ digest_mode (mode_t *mode,
       if (leaf)
 	{
 	  state.have_stat = false;
-	  state.have_type = false;;
+	  state.have_type = false;
 	  state.type = 0;
 	}
       else
-- 
2.1.4


>From 2713b1a7819bd44fd2c4e418e132fba69df36999 Mon Sep 17 00:00:00 2001
From: Bernhard Voelker <m...@bernhard-voelker.de>
Date: Sun, 27 Dec 2015 23:10:10 +0100
Subject: [PATCH 04/10] maint: avoid syntax-check failures

* bootstrap.conf: Change comment to let sc_prohibit_doubled_word pass.
---
 bootstrap.conf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bootstrap.conf b/bootstrap.conf
index 5617046..987838a 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -187,7 +187,7 @@ m4_base=gl/m4
 # 'libgnulib' is mentioned in various 'Makefile.am' files.
 gnulib_name=libgnulib
 
-# PO files are checked-in in findutils, don't auto-update.
+# PO files are committed to findutils, don't auto-update.
 SKIP_PO=t
 
 
-- 
2.1.4


>From fe2d1f315698ec549dddd2d27a2e10032e6b4db5 Mon Sep 17 00:00:00 2001
From: Bernhard Voelker <m...@bernhard-voelker.de>
Date: Sun, 27 Dec 2015 23:15:15 +0100
Subject: [PATCH 05/10] maint: avoid syntax-check failures

* build-aux/git-log-fix: Remove empty lines at EOF to let
sc_prohibit_empty_lines_at_EOF pass.
* find/testsuite/Makefile.am: Likewise.
* find/testsuite/sv-34079.sh: Likewise.
* find/testsuite/test_inode.sh: Likewise.
* locate/testsuite/locate.gnu/slocate.exp: Likewise.
---
 build-aux/git-log-fix                   | 1 -
 find/testsuite/Makefile.am              | 2 --
 find/testsuite/sv-34079.sh              | 1 -
 find/testsuite/test_inode.sh            | 3 ---
 locate/testsuite/locate.gnu/slocate.exp | 1 -
 5 files changed, 8 deletions(-)

diff --git a/build-aux/git-log-fix b/build-aux/git-log-fix
index 0447b4a..80628dd 100644
--- a/build-aux/git-log-fix
+++ b/build-aux/git-log-fix
@@ -46,4 +46,3 @@ s,(find),* $1,
 1d6d1afa52f40ad7c776e3ff0d4415409377e6fb
 s/Mark/* po\/POTFILES.in: mark/;
 s/(translation)/$1./
-
diff --git a/find/testsuite/Makefile.am b/find/testsuite/Makefile.am
index fac8f2c..c1369c3 100644
--- a/find/testsuite/Makefile.am
+++ b/find/testsuite/Makefile.am
@@ -281,5 +281,3 @@ configured-testfiles.txt: Makefile
 
 checklists: configured-testfiles.txt Makefile
 	$(PYTHON) $(srcdir)/checklists.py configured-testfiles.txt $(srcdir) config find.gnu find.posix
-
-
diff --git a/find/testsuite/sv-34079.sh b/find/testsuite/sv-34079.sh
index 928a9af..8abbc26 100755
--- a/find/testsuite/sv-34079.sh
+++ b/find/testsuite/sv-34079.sh
@@ -76,4 +76,3 @@ else
     echo "${testname} was not run because" '${RUN_VERY_EXPENSIVE_TESTS}' \
 	"is unset."
 fi
-
diff --git a/find/testsuite/test_inode.sh b/find/testsuite/test_inode.sh
index ea097d8..9c3cb88 100755
--- a/find/testsuite/test_inode.sh
+++ b/find/testsuite/test_inode.sh
@@ -60,6 +60,3 @@ if tmpfile=$(mktemp); then
     fi
     rm -f "${tmpfile}"
 fi
-
-
-
diff --git a/locate/testsuite/locate.gnu/slocate.exp b/locate/testsuite/locate.gnu/slocate.exp
index c36d99d..0d7f0fc 100644
--- a/locate/testsuite/locate.gnu/slocate.exp
+++ b/locate/testsuite/locate.gnu/slocate.exp
@@ -6,4 +6,3 @@ exec touch $tmp/subdia
 exec mkdir $tmp/subdir
 exec touch $tmp/subdir/fred
 locate_start p "--changecwd=. --output=$tmp/locatedb --dbformat=slocate --localpaths=$tmp/subdi*" "--database=$tmp/locatedb -e subdi 2>/dev/null" {}
-
-- 
2.1.4


>From 223c844baaf9b50218db7e9f3d2194f39d069cee Mon Sep 17 00:00:00 2001
From: Bernhard Voelker <m...@bernhard-voelker.de>
Date: Sun, 27 Dec 2015 23:18:03 +0100
Subject: [PATCH 06/10] maint: avoid syntax-check failures

* lib/buildcmd.c: Remove unused include of openat header to let
sc_prohibit_openat_without_use pass.
* lib/listfile.c: Likewise.
---
 lib/buildcmd.c | 1 -
 lib/listfile.c | 1 -
 2 files changed, 2 deletions(-)

diff --git a/lib/buildcmd.c b/lib/buildcmd.c
index 2616ed6..a58f67e 100644
--- a/lib/buildcmd.c
+++ b/lib/buildcmd.c
@@ -24,7 +24,6 @@
 #include <error.h>
 #include <limits.h>
 #include <locale.h>
-#include <openat.h>
 #include <stdbool.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/lib/listfile.c b/lib/listfile.c
index b49523e..01a4ed7 100644
--- a/lib/listfile.c
+++ b/lib/listfile.c
@@ -24,7 +24,6 @@
 #include <fcntl.h>
 #include <grp.h>
 #include <locale.h>
-#include <openat.h>
 #include <pwd.h>
 #include <stdio.h>
 #include <stdlib.h>
-- 
2.1.4


>From 9ea664be6f5816a140cf6276f49e514b226a2788 Mon Sep 17 00:00:00 2001
From: Bernhard Voelker <m...@bernhard-voelker.de>
Date: Mon, 28 Dec 2015 01:01:30 +0100
Subject: [PATCH 07/10] maint: avoid syntax-check failures

* find/util.c: Remove unused include of 'verify.h' to let
sc_prohibit_verify_without_use pass.
* xargs/xargs.c: Likewise.
---
 find/util.c   | 1 -
 xargs/xargs.c | 1 -
 2 files changed, 2 deletions(-)

diff --git a/find/util.c b/find/util.c
index db10323..5ffe140 100644
--- a/find/util.c
+++ b/find/util.c
@@ -38,7 +38,6 @@
 #include "quotearg.h"
 #include "save-cwd.h"
 #include "timespec.h"
-#include "verify.h"
 #include "xalloc.h"
 
 /* find headers. */
diff --git a/xargs/xargs.c b/xargs/xargs.c
index 5f3e760..86e0479 100644
--- a/xargs/xargs.c
+++ b/xargs/xargs.c
@@ -60,7 +60,6 @@
 #include "progname.h"
 #include "quotearg.h"
 #include "safe-read.h"
-#include "verify.h"
 #include "xalloc.h"
 
 /* find headers. */
-- 
2.1.4


>From bb91a38f87e1362530e144d94bc4a10cc21fbce8 Mon Sep 17 00:00:00 2001
From: Bernhard Voelker <m...@bernhard-voelker.de>
Date: Mon, 28 Dec 2015 01:10:19 +0100
Subject: [PATCH 08/10] maint: avoid syntax-check failures

* find/parser.c (insert_regex): Mark error diagnostic for translation;
found by 'make sc_unmarked_diagnostics'.
---
 find/parser.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/find/parser.c b/find/parser.c
index eb8bc99..b57cdda 100644
--- a/find/parser.c
+++ b/find/parser.c
@@ -2124,7 +2124,8 @@ insert_regex (char **argv,
 
       error_message = re_compile_pattern (rx, strlen (rx), re);
       if (error_message)
-        error (EXIT_FAILURE, 0, "failed to compile regular expression '%s': %s",
+        error (EXIT_FAILURE, 0,
+	       _("failed to compile regular expression '%s': %s"),
 	       rx, error_message);
       our_pred->est_success_rate = estimate_pattern_match_rate (rx, 1);
       return true;
-- 
2.1.4


>From 5c7930fe02a20499078feeccbb3d8546c12b68fb Mon Sep 17 00:00:00 2001
From: Bernhard Voelker <m...@bernhard-voelker.de>
Date: Mon, 28 Dec 2015 01:45:43 +0100
Subject: [PATCH 09/10] maint: avoid syntax-check failures

* cfg.mk (exclude_file_name_regexp--sc_prohibit_strncpy): Exempt the
2 remaining sources using the possibly dangerous strncpy function
from the syntax-check.
---
 cfg.mk | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/cfg.mk b/cfg.mk
index 84f395e..797731e 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -46,6 +46,9 @@ exclude_file_name_regexp--sc_prohibit_doubled_word = \
 exclude_file_name_regexp--sc_program_name = \
 	^lib/test_splitstring\.c$$
 
+# Suppress syntax-check failure regarding possibly evil strncpy use for now.
+exclude_file_name_regexp--sc_prohibit_strncpy = ^(find/print.c|lib/buildcmd.c)$$
+
 # sc_texinfo_acronym: perms.texi from coreutils uses @acronym{GNU}.
 exclude_file_name_regexp--sc_texinfo_acronym = doc/perm\.texi
 
-- 
2.1.4


>From 607b9080d975944e8ac8d1715c6fa0231947b2d4 Mon Sep 17 00:00:00 2001
From: Bernhard Voelker <m...@bernhard-voelker.de>
Date: Mon, 28 Dec 2015 02:22:43 +0100
Subject: [PATCH 10/10] maint: avoid syntax-check failures

Avoid sc_prohibit_always_true_header_tests failure.

* configure.ac: Check for getrlimit function directly rather than the
"sys/resource.h" header file.
* lib/fdleak.c: Include "sys/resource.h" when HAVE_GETRLIMIT is set.
(get_max_fd): s/HAVE_GETRUSAGE/HAVE_GETRLIMIT/.
---
 configure.ac | 2 +-
 lib/fdleak.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index c5d3a99..eb13324 100644
--- a/configure.ac
+++ b/configure.ac
@@ -142,7 +142,7 @@ dnl Checks for header files.
 AC_HEADER_STDC
 AC_CHECK_HEADERS(sys/param.h mntent.h sys/mnttab.h sys/mntio.h sys/mkdev.h)
 dnl fdleak.c needs sys/resource.h because it calls getrlimit(2).
-AC_CHECK_HEADERS(sys/resource.h)
+AC_CHECK_FUNCS(getrlimit)
 AC_HEADER_MAJOR
 dnl TODO: it's possible gnulib eliminates the need for AC_HEADER_DIRENT.
 AC_HEADER_DIRENT
diff --git a/lib/fdleak.c b/lib/fdleak.c
index c22d299..2e6c9a9 100644
--- a/lib/fdleak.c
+++ b/lib/fdleak.c
@@ -26,7 +26,7 @@
 #include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
-#if defined HAVE_SYS_RESOURCE_H
+#if HAVE_GETRLIMIT
 # include <sys/resource.h>
 #endif
 #include <unistd.h>
@@ -120,7 +120,7 @@ get_max_fd (void)
     open_max = _POSIX_OPEN_MAX;	/* underestimate */
 
   /* We assume if RLIMIT_NOFILE is defined, all the related macros are, too. */
-#if defined HAVE_GETRUSAGE && defined RLIMIT_NOFILE
+#if defined HAVE_GETRLIMIT && defined RLIMIT_NOFILE
   if (0 == getrlimit (RLIMIT_NOFILE, &fd_limit))
     {
       if (fd_limit.rlim_cur == RLIM_INFINITY)
-- 
2.1.4

Reply via email to