Some make implementations, e.g. on NetBSD 7.1, lack it; therefore
avoid it in order to prevent error messages during 'make clean'.
* Makefile.am (coverage-clean): Replace $(RM) by 'rm -f'.
* find/Makefile.am: Likewise.
* lib/Makefile.am: Likewise.
* locate/Makefile.am: Likewise.
* xargs/Makefile.am: Likewise.
Run 'make update-copyright'.
* lib/regexprops.c (copying): Update the year number manually.
* All other files: Update copyright years via the above make run.
* lib/regextype.c (get_regex_type_synonym): don't return regex
dialect Y as a synonym of dialect X, if we're not in fact going to
include X. Accept a CONTEXT parameter in order to identify this
situation. This ensures that the bug fixed in commit
e2c673cbcdc325a3a2e9dd02169bb4a42c61bc48 stays fixed for any
permutation of regex_map.
* lib/regextype.h: update prototype of get_regex_type_synonym.
* lib/regexprops.c (describe_all): Pass the new context parameter.
* doc/regexprops.texi: regenerate this file.
* lib/regextype.c (regex_map): Permute the entries to list POSIX
dialects before other ones, so that we don't end up with a
dangling reference to `ed' regular expressions when
context=findutils. Remove trailing white space from the output.
* doc/regexprops.texi: Regenerate this file, so that we no longer
have a dangling reference to the `ed' dialect.
* doc/find.texi (Regular Expressions): Point out the difference
between Emacs regular expressions and findutils regular
expressions: in findutils "." will match newline.
* find/find.1: Likewise.
* locate/locate.1: Likewise. Also document the --regextype option.
die() has the advantage of being apparent to the compiler
that it doesn't return, which will avoid warnings in some cases,
and possibly generate better code.
While at it, wrap some of the overly long error messages into a new line.
* cfg.mk (sc_die_EXIT_FAILURE): A new syntax check rule to
catch any new uses of error (CONSTANT, ...);
* find/exec.c: Include "die.h" and use die rather than exit (EXIT_FAILURE).
* find/fstype.c: Likewise.
* find/ftsfind.c: Likewise.
* find/oldfind.c: Likewise.
* find/parser.c: Likewise.
* find/pred.c: Likewise.
* find/print.c: Likewise.
* find/tree.c: Likewise.
* find/util.c: Likewise.
* lib/buildcmd.c: Likewise.
* lib/listfile.c: Likewise.
* lib/regextype.c: Likewise.
* lib/safe-atoi.c: Likewise.
* locate/frcode.c: Likewise.
* locate/locate.c: Likewise.
* locate/word_io.c: Likewise.
* xargs/xargs.c: Likewise.
GCC-7.2.1 complained about this occur during 'make check'.
* lib/regexprops.c (menu): Remove set-but-unused-variable 'options'.
* lib/test_splitstring.c (main): Avoid unused-parameter warnings
for 'argc' and 'argv'.
* lib/die.h (die): New file/function from grep/coreutils.
Note: this file will probably be migrated to gnulib.
* lib/Makefile.am (libfind_a_SOURCES): Reference it.
* xargs/xargs.c: Include die.h.
(xargs_do_exec): Use die in place of error-nonzero, thus allowing
the compiler to know that we do not fall through into the 0 (child)
case.
Avoid the new warnings GCC 7 gives with the
"-Werror=implicit-fallthrough=" compiler option.
Since version 7, GCC requires fallthrough switch/cases to be
marked by the appropriate attribute.
* lib/system.h: Add new header file defining the FALLTHROUGH macro.
* lib/Makefile.am (libfind_a_SOURCES): Reference it.
* find/print.c (do_fprintf): Use the new macro.
* xargs/xargs.c (read_line): Likewise.
(xargs_do_exec): For error(3), GCC 7 doesn't know that the function
does not return, and would complain about falling through into the
following case. Temporarily add an abort call - this will be fixed
with another commit.
GCC-7.2.1 on openSUSE-Tumbleweed complains:
listfile.c:56:0: error: macro "HAVE_MAJOR" is not used \
[-Werror=unused-macros]
#define HAVE_MAJOR
* listfile.c (major,minor): Avoid the temporary #define HAVE_MAJOR
by using #else's.
buildcmd.c: In function 'bc_push_arg':
buildcmd.c:362:11: error: this 'if' clause does not guard... [-Werror=misleading-indentation]
if (ctl->replace_pat
^~
buildcmd.c:366:13: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if'
bc_do_exec (ctl, state);
^~~~~~~~~~
pred.c: In function 'print_optlist':
pred.c:1328:46: error: format '%ld' expects argument of type 'long int', but argument 3 has type 'long unsigned int' [-Werror=format=]
fprintf (fp, "[real success rate %ld/%ld", p->perf.successes, p->perf.visits);
^
pred.c:1328:50: error: format '%ld' expects argument of type 'long int', but argument 4 has type 'long unsigned int' [-Werror=format=]
fprintf (fp, "[real success rate %ld/%ld", p->perf.successes, p->perf.visits);
^
print.c: In function 'scan_for_digit_differences':
print.c:449:46: error: logical 'or' of equal expressions [-Werror=logical-op]
if (!isdigit ((unsigned char)q[i]) || !isdigit ((unsigned char)q[i]))
^~
In file included from ../gl/lib/gettext.h:25:0,
from locate.c:86:
locate.c: In function 'dolocate':
locate.c:1873:28: error: format '%d' expects argument of type 'int', but argument 5 has type 'unsigned int' [-Werror=format=]
_("warning: database %s is more than %d %s old (actual age is %.1f %s)"),
^
locate.c:1873:26: note: in expansion of macro '_'
_("warning: database %s is more than %d %s old (actual age is %.1f %s)"),
^
locate.c:1927:18: error: format '%ld' expects argument of type 'long int', but argument 2 has type 'long unsigned int' [-Werror=format=]
printf ("%ld\n", found);
^
cc1: all warnings being treated as errors
* find/pred.c (print_optlist): Use %lu for unsigned long int.
* find/print.c (scan_for_digit_differences): Check p[i] too rather than
q[i] two times.
* lib/buildcmd.c (bc_push_arg): Fix indentation.
* locate/locate.c (dolocate): Use %u format for unsigned int.
Use %lu format for unsigned long int.
Similar to the FTS readdir fix in v4.6.0-72-g155c9d1, handle the last
two unhandled readdir(3) errors.
* find/pred.c (pred_empty): Do the above.
* lib/fdleak.c (get_proc_max_fd): Likewise. While at it, fix the
condition to only skip "." and ".."; previously, also other files
beginning with ".." would have been skipped - that was theoretically,
as we only expect the FD files in "/proc/self/fd".
When the -exec arguments buffer (usually 128k) is full and the given
command has been executed with all that arguments, find(1) missed to
execute the command yet another time if only 1 another file would have
to be processed.
Both find(1), i.e., nowadays FTS-version, and oldfind are affected.
This bug was present since the implementation of '-exec +' in 2005,
see commit FINDUTILS_4_2_11-1-25-gf0a6ac6.
* lib/buildcmd.c (bc_push_arg): Move the assignment to set 'state->todo'
to 1 down after the immediate execution which resets that flag.
* find/testsuite/sv-48030-exec-plus-bug.sh: Add a test.
* find/testsuite/Makefile.am (test_shell_progs): Reference the test.
* NEWS (Bug Fixes): Mention the fix.
Reported by Joe Philip Ninan <indiajoe@gmail.com> in
https://savannah.gnu.org/bugs/?48030
* lib/.gitignore: Use pattern for prominent suffixes like *.o, *.log
and *.a; an entry for the new intermediate file bugreports.o was missing
here. Sort file.
* locate/.gitignore (bigram,code,bigram.o,code.o): Remove, as these
programs have been removed with commit v4.6.0-44-g89ec021.
* find/.gitignore: Use pattern for *.o, and sort the file.
* xargs/.gitignore: Likewise.
'make syntax-check' failed with:
locate/word_io.h:
maint.mk: the above files include assert.h but don't use it
maint.mk:479: recipe for target 'sc_prohibit_assert_without_use' failed
...
lib/bugreports.h:
maint.mk: empty line(s) or no newline at EOF
maint.mk:929: recipe for target 'sc_prohibit_empty_lines_at_EOF' failed
* locate/word_io.h (#include <assert.h>): Remove superfluous inclusion
of <assert.h>.
* lib/bugreports.h: Remove stray empty line at EOF.
* configure.ac (PACKAGE_BUGREPORT_URL): Define this macro to point
to the findutils bug-reporting web page.
* lib/bugreports.c: New file, defining the function
explain_how_to_report_bugs which explains how to report bugs. Use
the new PACKAGE_BUGREPORT_URL macro.
* lib/bugreports.h: New file, providing a declaration of
explain_how_to_report_bugs.
* lib/Makefile.am (libfind_a_SOURCES): Add bugreports.c and
bugreports.h.
* find/parser.c (parse_help): Call explain_how_to_report_bugs
instead of printing an explanation here.
* xargs/xargs.c (usage): Likewise.
* locate/locate.c (usage): Likewise.
* locate/code.c (usage): Likewise.
* locate/frcode.c (usage): Likewise.
* locate/updatedb.sh (usage): Produce a similar message
by including it in the usage text itself.
* lib/regexprops.c (copying): Update the text so that the
copyright years (and the line breaks) match the
result of "make update-copyright".
* doc/regexprops.texi: Tweak copyright years to match the
result of "make update-copyright".
* All other files: update copyright years if the file has
a copyright statement.
* .x-update-copyright: new file, a list of files to exclude
from automated copyright updates.
* lib/regexprops.c (newpara): Function parameter list should be
declared as void in the function definition, instead of leaving it
blank (C++ style). This fixes a GCC warning controlled by
-Wstrict-prototypes.
(beginenum): Likewise.
(endenum): Likewise.
(endtable): Likewise.
(copying): Update copyright years.
* doc/regexprops.texi: Update copyright years to match the output
of regexprops.c.
* lib/listfile.h (list_file): Make the relname parameter const.
* lib/listfile.c (list_file): Make the relname parameter const.
Remove the unused local variable inode_field_width. Update
nlink_width with the greatest width of the st_nlink field, and
print the field using the maximum width (as we do for other
fields).
* configure.ac: gnulib supplies waitpid and C89 supplies strspn.
Hence there is no need for any call to FINDLIB_REPLACE_FUNCS.
That being the case we don't need to test it with forcefindlib.
* m4/findlib.m4: remove since FINDLIB_REPLACE_FUNCS is unused.
* m4/Makefile.am (EXTRA_DIST): findlib.m4 has been deleted, so
don't distribute it.
* lib/waitpid.c: remove, since gnulib provides this.
* lib/forcefindlib.c: remove, since there is no longer any need to
test FINDLIB_REPLACE_FUNCS.
* lib/Makefile.am (libfind_a_SOURCES): Specify this variable all
in one go, instead of in several parts. Move some header files
into here instead of just having them in EXTRA_DIST. Because
FINDLIBOBJS is empty now, there is no need to copy that to
libfind_a_LIBADD.
* 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/.
* Makefile.am (gen-ChangeLog): Replace 8 spaces by a tab to avoid
sc_makefile_TAB_only_indentation failure.
* po/POTFILES.in: Remove some entries to let sc_po_check pass.
While at it, sort the entries.
* find/print.c (do_fprintf): Remove stray semicolon to let
sc_prohibit_double_semicolon pass.
* find/util.c (digest_mode): Likewise.
* bootstrap.conf: Change comment to let sc_prohibit_doubled_word pass.
* 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.
* lib/buildcmd.c: Remove unused include of openat header to let
sc_prohibit_openat_without_use pass.
* lib/listfile.c: Likewise.
* find/util.c: Remove unused include of 'verify.h' to let
sc_prohibit_verify_without_use pass.
* xargs/xargs.c: Likewise.
* find/parser.c (insert_regex): Mark error diagnostic for translation;
found by 'make sc_unmarked_diagnostics'.
* cfg.mk (exclude_file_name_regexp--sc_prohibit_strncpy): Exempt the
2 remaining sources using the possibly dangerous strncpy function
from the syntax-check.
* README-hacking (footer): use the official FDL license wording as
listed in FDL's "ADDENDUM: How to use this License for your
documents". Update copyright year.
* NEWS (footer): Likewise.
* doc/find-maint.texi: Likewise.
* doc/find.texi: Likewise.
* doc/regexprops.texi: Likewise.
* lib/regexprops.c (copying): Amend the code to emit the updated
wording. Update the copyright year.
* lib/listfile.c (list_file): For aligned fields, use the number
of characters output to deduce whether our current idea of the
maximum width of each field is too small. When this happens,
increase the field width. Keep track of the field width in a
static variable for each field. Do this for the inode number,
number of blocks, owner, group, major and minor device numbers,
and the file size. Use mbswidth in some places to count
characters.
* find/print.c (do_fprintf): Mention the potential portability
problems in casting ino_t to uintmax_t.
* bootstrap.conf (gnulib_modules): Add mbswidth.
* po/Makevars (XGETTEXT_OPTIONS): updated by running bootstrap.
*NEWS: Mention this bugfix.
* find/exec.c (initialise_wd_for_exec): rename to
initialize_wd_for_exec, since "initialize" is the preferred form
even in UK spelling (the OED says "initialise" is a variant).
Update callers (it's a static function). Update spelling in
comments.
* find/find.c (main): Fix missing "to" in error message and update
"initialise" to "initialize". Update comment too.
* find/ftsfind.c (main): Update spelling in error message.
* lib/listfile.c (print_name_with_quoting): spelling change in
comment.
* find/tree.c (init_pred_perf): Likewise.
* lib/extendbuf.c (extendbuf): Likewise.
* lib/splitstring.h: Likewise.
* find/print.c (format_date): Likewise.
* doc/find-maint.texi (Tools): Update spelling.
* lib/listfile.c (list_file): Check the result of fprintf to
determine if there was an I/O error on output. Return false (bool
instead of void) if so.
(print_name_without_quoting): Likewise.
(print_name_with_quoting): Likewise.
(print_name): Propagate the result of print_name_without_quoting
or print_name_with_quoting (and make all three functions return bool).
* find/pred.c (is_ok): Check the result of fprintf to
determine if there was an I/O error on output. Exit fatally if
there was a problem (since we cannot expect the user to say "yes"
or "no" to a prompt they will not have seen).
* xargs/xargs.c (print_args): Check the result of fprintf and
fflush to determine if there was an I/O error on output. Exit
fatally for the same reason as above if there is a problem.
* NEWS: Mention this bugfix (now that it is fully fixed).
* build-aux/src-sniff.py (checkers): Check for #define directives
which use a macro name which is reserved.
(MakefileRegexChecker): New class which performs regex checks on
makefiles; this ensures that we don't check Makefile.in if we're
going to check Makefile.am anyway.
* lib/unused-result.h: Don't use a reserved identifier in the
macro name defined as the #include guard.
* locate/locatedb.h: Likewise.
* Makefile.am (findutils-check-smells): Don't check gnulib code.
* import-gnulib.sh (hack_gnulib_tool_output): Move the 'do' of a
for loop onto the line following the 'for' (instead of the same
line).
* lib/Makefile.am (coverage-clean): Remove output files left
behind by gcc -fprofile-arcs -ftest-coverage by using $(RM) with a
glob pattern rather than a $(libfindtools_a_SOURCES.c=.gcno)
Makefile substitution, because the latter caused us to delete
header files entirely (their names do not end in .c). This had
meant that it was impossible to compile findutils after "make
clean". Bug report by David Gilbert.
* find/Makefile.am (coverage-clean): Likewise.
* xargs/Makefile.am (coverage-clean): Likewise.
* locate/Makefile.am (coverage-clean): Likewise.
* Makefile.am (coverage-clean): Likewise, but also do this in the
subdirectories whose Makefile.am files are generated by
gnulib-tool.
* find/Makefile.am (CLEANFILES): Clean the .gcda and .gcdo files
which are produced by running programs that were compile with gcc
-fprofile-arcs -ftest-coverage.
* lib/Makefile.am (CLEANFILES): Likewise.
* locate/Makefile.am (CLEANFILES): Likewise.
* xargs/Makefile.am (CLEANFILES): Likewise.
* xargs/xargs.c: Remove definition of the unused macro VOID.
Include error.h instead of declaring error (incorrectly).
Change the type of lineno from int to size_t.
(get_char_oct_or_hex_escape): Don't point endp unnecessarily at p,
because they have different constness. There's no need for this,
just initialise it to NULL.
(main): Make input_file const. Make the default arglist
non-const, to avoid a constness warning.
(main): Pass the option name as the argument to error's %s format,
as opposed to the whole struct (this was a bug, but since the name
member was the first in the struct, there were probably no
symptoms).
(main): read_args returns an int, but the only negative value it
can return is -1. Once we know that didn't happen, assign the
value to a size_t variable to avoid signed/unsigned warnings
elsewhere.
(xargs_do_exec): Manually inhibit some unused-parameters warnings.
(print_args): Use size_t as the type of a loop variable.
(wait_for_proc): Since procs_executing is an unsigned long, use a
%lu format specifier to print it.
(increment_proc_max): Inhibit an unused-parameter warning (the
signal number).
(decrement_proc_max): Likewise.
* lib/buildcmd.h (struct buildcmd_control): Make member
replace_pat const. Change the type of lines_per_exec to unsigned
long.
* locate/locate.c: Include <regex.h> instead of "regex.h".
Include "fnmatch.h" instead of <fnmatch.h> (because we use
fnmatch-gnu). Include "gettext.h".
* lib/regexprops.c: Include <regex.h> instead of "regex.h".
* find/tree.c: Include "gettext.h". Include "fnmatch.h" instead
of <fnmatch.h> (because we use fnmatch-gnu).
* find/parser.c: Include "gettext.h" and <regex.h>. Include
"fnmatch.h" instead of <fnmatch.h> (because we use fnmatch-gnu).
* find/pred.c: Likewise.
* find/exec.c: Include "gettext.h".
* find/find.c: Likewise.
* find/fstype.c: Likewise.
* find/ftsfind.c: Likewise.
* find/print.c: Likewise.
* lib/buildcmd.c: Likewise.
* lib/fdleak.c: Likewise.
* lib/findutils-version.c: Likewise.
* lib/regextype.c: Likewise.
* lib/safe-atoi.c: Likewise.
* find/util.c: Likewise.
* locate/bigram.c: Likewise.
* locate/code.c: Likewise.
* locate/frcode.c: Likewise.
* locate/word_io.c: Likewise.
* xargs/xargs.c: Likewise.
* find/Makefile.am: Add a comment explaining why gnulib-tool
advised us to use each library.
* lib/regextype.c (tagRegexTypeMap): make the name field const.
* find/parser.c (parse_version): instead of counting features, use
a boolean variable, nofeatures. This avoids compiler warnings
about overflow.
* find/find.c: Remove definition of SAFE_CHDIR, which we don't
use.
* find/defs.h: Remove redundant declaration of launch.
* find/parser.c (parse_false): Cast unused arguments to void.
(parse_print0): Likewise.
(pred_context): Likewise.
(parse_newerXY): Add some parens for slightly greater clarity.
(make_segment): Avoid switch-missing-default-case warning by
turning it into an if statement.
(check_path_safety): Remove unused argument.
(insert_exec_ok): Don't pass the unwanted arugment to
check_path_safety.
(get_relative_timestamp): silence compiler warning by adding a
case for the remaining enumberation value rather than using
default.
* find/pred.c (months): the strings can be const char*, rather
than just char*.
(ctime_format): change TIME_BUF_LEN to an integer constant to
avoid signed/unsigned comparison.
(blank_rtrim): Change to new-style function definition(!) and
remove unnecessary parentheses around a return value.
* lib/buildcmd.c: Omit redundant declaration of environ.
* find/tree.c (get_expr): Make static.
(cost_assoc): make the name field const.
(prec_assoc): make the prec_name field const.
(op_assoc): make the type_name field const.
(type_name): turn into an ANSI function definition(!).
(prec_name): Likewise! Also remove spurious parentheses around
return value.
(prec_name): Remove spurious parentheses around return value.
* lib/buildcmd.h (buildcmd_state): change types of several fields
to size_t: cmd_argc, cmd_argv_alloc, largest_successful_arg_count,
smallest_failed_arg_count.
(buildcmd_control): change types of several fields
to size_t: max_arg_count, initial_argc, lines_per_exec,
args_per_exec.
* lib/splitstring.c: New file; defines splitstring(), which will
non-destructively locate character-separated fields in a string.
* lib/splitstring.h: New file; declares splitstring.
* lib/test_splitstring.c: New file; unit test for splitstring.c.
* lib/nextelem.c: Delete (obsoleted by splitstring.c).
* lib/nextelem.h: Delete (obsoleted by splitstring.h).
* lib/Makefile.am (libfind_a_SOURCES): Add splitstring.c,
splitstring.c. Remove nextelem.c, nextelem.h.
(check_PROGRAMS): Add test_splitstring.
(TESTS): Add test_splitstring.
(test_splitstring_SOURCES): Sources for the
test_splitstring unit test.
* locate/locate.c: Include splitstring.h rather than nextelem.h.
(dolocate): Use splitstring rather than next_element. In places
where we need a nul-terminated string, use strndup() to create it.
Convert some space-tab sequences to regular spacing.
* find/parser.c: Include splitstring.h rather than nextelem.h.
(check_path_safety): Use splitstring rather than next_element.
* import-gnulib.config (modules): Depend on the module strndup.
* cfg.mk: Exempt lib/test_splitstring.c from calling
bindtextdomain or set_program_name.