286 Commits

Author SHA1 Message Date
Bernhard Voelker
c56b96a54f maint: prefer NULL to nullptr
NULL is best for C as discussed - for coreutils - at:
  https://bugs.gnu.org/66221#53

* bootstrap.conf: Remove dependency on nullptr.
* s/nullptr/NULL/.

This effectively reverts 93ce19f0d5a1.
2026-01-20 23:03:54 +01:00
Bernhard Voelker
733bb9a054 maint: update copyright year number ranges
Run 'make update-copyright'.

* lib/regexprops.c (copying): Update the year number manually.
* tests/sample-test: Adjust to use the single most recent year.
* All other files: Update copyright years via the above make run.
2026-01-02 11:46:15 +01:00
Bernhard Voelker
93ce19f0d5 maint: prefer C23-style nullptr
* bootstrap.conf (gnulib_modules): Add nullptr.
In code, prefer nullptr to NULL where either will do.
* cfg.mk (sc_prohibit_NULL): Direct to use nullptr instead.
(begword, endword): Add regex helper macros.
2025-11-15 19:39:43 +01:00
Collin Funk
c18bba5c59 maint: ensure that new "make syntax-check"-run sc_codespell passes
* cfg.mk (codespell_ignore_words_list): Ignore false-positives.
(exclude_file_name_regexp--sc_codespell): Skip some file names.
* NEWS: Fix typos.
* README-hacking: Likewise.
* doc/find-maint.texi: Likewise.
* doc/find.texi: Likewise.
* bootstrap.conf: Fix typos in comments.
* find/ftsfind.c: Likewise.
* find/parser.c: Likewise.
* find/print.c: Likewise.
* find/testsuite/find.gnu/exec-one-rtn-fail.exp: Likewise.
* find/testsuite/find.posix/bracket-depth.exp: Likewise.
* find/testsuite/find.posix/exec-nogaps.exp: Likewise.
* find/testsuite/find.posix/files-not-expressions1.exp: Likewise.
* find/testsuite/find.posix/files-not-expressions2.exp: Likewise.
* find/testsuite/find.posix/files-not-expressions3.exp: Likewise.
* find/util.c: Likewise.
* init.cfg: Likewise.
* lib/regextype.h: Likewise.
* lib/splitstring.h: Likewise.
* locate/locate.c: Likewise.
* locate/updatedb.sh: Likewise.
* tests/find/exec-plus-last-file.sh: Likewise.
* tests/find/files0-from.sh: Likewise.
* tests/xargs/test-sigusr.c: Likewise.
* tests/xargs/verbose-quote.sh: Likewise.
* xargs/xargs.c: Likewise.
2025-11-15 19:39:02 +01:00
Bernhard Voelker
c9c2c51175 regexprops: sort regex_map alphabetically
Commit '1b53838ddf' has changed the order of the nodes, yet not
quite well.  Let's use alphabetical sort order.

* lib/regextype.c (regex_map): Move 'awk' and 'egrep' entries up.
2025-07-09 20:49:51 +02:00
Bernhard Voelker
f1f6471ae8 maint: update copyright year number ranges
Run 'make update-copyright'.

* lib/regexprops.c (copying): Update the year number manually.
* tests/sample-test: Adjust to use the single most recent year.
* All other files: Update copyright years via the above make run.
2025-01-04 11:43:53 +01:00
Bernhard Voelker
eac8aecaad maint: update further Makefile variables used by Gnulib
Like in the recent commit, also change the following variables to follow
the renaming done in gnulib:
- LIB_SETLOCALE_NULL -> SETLOCALE_NULL_LIB,
- LIB_MBRTOWC -> MBRTOWC_LIB,
- LIB_EACCESS -> EUIDACCESS_LIBGEN.

* find/Makefile.am (LDADD): Change as described above.
* lib/Makefile.am: Likewise.
* locate/Makefile.am: Likewise.
* xargs/Makefile.am: Likewise.
2024-12-02 19:54:19 +01:00
Bernhard Voelker
4a719e65d2 maint: pacify GCC 14.2
Avoid the following warnings:
tree.c:1573:19: warning: no previous declaration for 'cost_table' [-Wmissing-variable-declarations]
 1573 | struct cost_assoc cost_table[] =
      |                   ^~~~~~~~~~
findutils-version.c:37:13: warning: no previous declaration for 'version_string' [-Wmissing-variable-declarations]
   37 | const char *version_string = VERSION;
      |             ^~~~~~~~~~~~~~

* find/tree.c (cost_table): Declare static.
* lib/findutils-version.c (version_string): Likewise.
* locate/frcode.c (version_string): Remove extern declaration.
* locate/locate.c: Likewise.
* xargs/xargs.c: Likewise.
2024-09-17 21:49:18 +02:00
James Youngman
e178314ae3 maint: convert tabs to spaces in C source files. 2024-06-01 21:41:05 +01:00
Bernhard Voelker
b9c9310eec maint: avoid gnulib sc_prefer_angle_bracket_headers failure
The following syntax-check rule fails:

  $ make syntax-check
  ...
  maint.mk: Use #include <hdr.h>, not #include "hdr.h" for the above
  make: *** [maint.mk:619: sc_prefer_angle_bracket_headers] Error 1

The rule suggests using '#include <header.h>' instead of
'#include "header.h"' for headers that override system headers.
See gnulib documentation, section "Style of #include statements".

* find/parser.c (#include "fnmatch.h": Change from "..." to <...> style.
* find/pred.c (#include "fnmatch.h"): Likewise.
* find/tree.c (#include "fnmatch.h"): Likewise.
* lib/system.h (#include "error.h"): Likewise.
* locate/locate.c (#include "fnmatch.h"): Likewise.
* tests/xargs/test-sigusr.c (#include "error.h"): Likewise.
2024-05-20 13:54:38 +02:00
Bernhard Voelker
ea1abfa968 maint: update copyright year number ranges
Run 'make update-copyright'.

* lib/regexprops.c (copying): Update the year number manually.
* tests/sample-test: Adjust to use the single most recent year.
* All other files: Update copyright years via the above make run.
2024-01-02 09:13:29 +01:00
Bernhard Voelker
d76d0f5668 maint: go back to using 'error'
Now that Gnulib's 'error' module does proper static checking
for not returning, we need no longer use the 'die' macro.
This makes code easier to read for people that are used to 'error'.

* cfg.mk (sc_die_EXIT_FAILURE): Remove.
* src/die.h: Remove.  All includes removed.  All calls to 'die'
changed back to calls to 'error'.
* lib/Makefile.am (libfind_a_SOURCES): Remove 'die.h'.
* src/system.h: Include error.h.  Stop including error.h elsewhere.
* find/ftsfind.c (process_all_startpoints): Avoid extra '\n' in error
diagnostics wrt/ -files0-from.  Also avoid redundant "%s" formats.
* find/parser.c (parse_perm, parse_regex):
* lib/buildcmd.c (bc_push_arg):
Wrap calls to 'error' in block when under an if-condition and either
the if-condition or the 'error' invocation is spanning over more
than one line.
* find/tree.c (get_pred_cost): Make error message translatable - found
by sc_unmarked_diagnostics.
2023-09-30 14:57:05 +02:00
Bernhard Voelker
73d020f472 maint: update copyright year number ranges
Run 'make update-copyright'.

* lib/regexprops.c (copying): Update the year number manually.
* tests/sample-test: Adjust to use the single most recent year.
* All other files: Update copyright years via the above make run.
2023-01-01 23:51:15 +01:00
Bernhard Voelker
841aa66f1e maint: avoid warnings from sparse tool
https://sparse.docs.kernel.org/
Running the tool against unviled the following warnings:

  find/parser.c:328:7: warning: Using plain integer as NULL pointer
  find/parser.c:328:10: warning: Using plain integer as NULL pointer
  find/parser.c:328:13: warning: Using plain integer as NULL pointer
  find/parser.c:466:49: warning: Using plain integer as NULL pointer
  find/parser.c:656:45: warning: Using plain integer as NULL pointer
  find/print.c:1024:30: warning: Using plain integer as NULL pointer
  lib/regexprops.c:531:7: warning: symbol 'options' shadows an earlier one
  lib/regextype.c:48:24: warning: symbol 'regex_map' was not declared. Should it be static?
  locate/locate.c:131:25: warning: symbol 'check_existence' was not declared. Should it be static?
  locate/locate.c:207:12: warning: symbol 'metacharacters' was not declared. Should it be static?
  xargs/xargs.c:902:24: warning: symbol 'state' shadows an earlier one
  xargs/xargs.c:542:23: warning: Using plain integer as NULL pointer

The fixes for these findings are all trivial, so let's apply them.

* find/parser.c (parse_table): Initialize pointer-type members of
the last element with NULL instead of 0.
(get_noop): Compare to NULL as end condition of for-loop.
(find_parser): Likewise.
* find/print.c (do_fprintf): Initialize linkname with NULL instead of 0.
* lib/regexprops.c (describe_all): Rename local variable options
to regopts to avoid name shadowing.
* lib/regextype.c (regex_map): Declare static.
* locate/locate.c (check_existence): Likewise.
(metacharacters): Likewise.
* xargs/xargs.c (main): Set eof_str to NULL instead of 0.
2022-01-06 03:28:38 +01:00
Bernhard Voelker
17e3183c1a maint: fix GPLv3 texts to use a comma instead of semicolon
See: https://www.gnu.org/licenses/gpl-3.0.html#howto
Run:
  $ git grep -l 'Foundation; either version 3' \
      | xargs sed -i '/Foundation; either version 3/ s/n; e/n, e/'

* bootstrap.conf: Adjust GPLv3 header via the above command.
* build-aux/gen-changelog.sh: Likewise.
* lib/die.h: Likewise.
2022-01-05 21:54:16 +01:00
Bernhard Voelker
db5ec614a7 maint: update copyright year number ranges
Run 'make update-copyright'.

* lib/regexprops.c (copying): Update the year number manually.
The format of the copyright year number range in Texinfo files is
"YEAR1--YEAR2" now, i.e., with 2x '-'.
* tests/sample-test: Adjust to use the single most recent year.
* All other files: Update copyright years via the above make run.
2022-01-02 18:42:35 +01:00
Bernhard Voelker
b38464865a build: fix linking on AIX7.2
Linking on AIX7.2 fails:
  ld: 0711-317 ERROR: Undefined symbol: .pthread_mutex_lock
  ld: 0711-317 ERROR: Undefined symbol: .pthread_mutex_unlock

Bruno Haible noticed that $(LIB_MBRTOWC) and $(LIB_SETLOCALE_NULL)
expand to -lpthread on that platform, so let's add them to LDADD.

Maybe we should better depend on a 'gnulib.mk' file generated by
'gnulib-import' in the long run, but let's fix this issue with the
simpler solution for now.

* find/Makefile.am (LDADD): Add $(LIB_SETLOCALE_NULL) and $(LIB_MBRTOWC).
* locate/Makefile.am (LDADD): Likewise.
* xargs/Makefile.am (LDADD): Likewise.
* lib/Makefile.am (regexprops_LDADD): Add definition.
2021-01-09 17:06:23 +01:00
Bernhard Voelker
c5da48bcff maint: update copyright year number ranges
Run 'make update-copyright'.

* lib/regexprops.c (copying): Update the year number manually.
The format of the copyright year number range in Texinfo files is
"YEAR1--YEAR2" now, i.e., with 2x '-'.
* tests/sample-test: Likewise, here to avoid starting a year number range.
* All other files: Update copyright years via the above make run.
2021-01-02 01:46:51 +01:00
Bernhard Voelker
dc1a69f6dc maint: use gnulib *_safer functions consistently
Avoid using fopen_safer and opendir_safer directly in favor of
letting gnulib transparently doing the work via "dirent--.h" and
"stdio--.h".

* find/oldfind.c (dirent-safer.h): Replace include ...
(dirent--.h): ... by this.
(process_dir): Change opendir_safer to the regular opendir call.
* find/sharefile.c (stdio-safer.h): Replace include ...
(stdio--.h): ... by this.
(sharefile_fopen): Change fopen_safer to regular fopen call.
* lib/fdleak.c (dirent-safer.h): Replace include ...
(dirent--.h): ... by this.
(get_proc_max_fd): Change opendir_safer to regular opendir call.
2020-12-02 02:14:00 +01:00
Bernhard Voelker
6154e419b9 maint: ensure .deps/ in the project root is ignored by git
* .gitignore (.deps/): Add entry.
* find/.gitignore (/.deps/): Remove here.
* lib/.gitignore: Likewise.
* locate/.gitignore: Likewise.
* xargs/.gitignore: Likewise.
2020-03-15 11:07:13 +01:00
Bernhard Voelker
8f4dd0f712 doc: prefer https:// over http:// in more places
Use HTTPS for GNU, FSF, OpenGroup and Google URLs.

* build-aux/update-online-manual.sh: Switch to HTTPS.
* doc/find.texi (node Further Reading on Security): Likewise.
* lib/buildcmd.c: Likewise in a comment.
* NEWS: Likewise, and shorten a debbugs URL.
2020-03-15 10:54:36 +01:00
Bernhard Voelker
f7ea96d2b8 maint: update copyright year number ranges
Run 'make update-copyright'.

* lib/regexprops.c (copying): Update the year number manually.
* tests/sample-test: Likewise, here to avoid starting a year number range.
* All other files: Update copyright years via the above make run.
2020-01-01 16:22:52 +01:00
Pavel Modilaynen
5699fb78d4 xargs: use GNU_FINDUTILS_FD_LEAK_CHECK as for find
Utilize GNU_FINDUTILS_FD_LEAK_CHECK environment variable
to enable/disable fd leak check for xargs the same way as
for find.

* find/defs.h: Remove prototype for fd_leak_check_is_enabled().
* find/util.c: Remove implementation of fd_leak_check_is_enabled().
* lib/fdleak.c: Add implementation of fd_leak_check_is_enabled().
* lib/fdleak.h: Add prototype for fd_leak_check_is_enabled().
* xargs/testsuite/config/unix.exp: Enable GNU_FINDUTILS_FD_LEAK_CHECK
for all tests.
* xargs/xargs.c: Execute complain_about_leaky_fds when
fd_leak_check_is_enabled returns true.
* NEWS (Improvements): Document support of GNU_FINDUTILS_FD_LEAK_CHECK
by xargs.

Copyright-paperwork-exempt: Yes
2019-05-05 18:10:40 +01:00
Bernhard Voelker
487d0701c5 maint: update copyright year number ranges
Run 'make update-copyright'.

* lib/regexprops.c (copying): Update the year number manually.
* All other files: Update copyright years via the above make run.
2019-01-04 23:47:26 +01:00
Bernhard Voelker
4c5cebf4eb maint: avoid continued strings
* lib/bugreports.c (explain_how_to_report_bugs): Avoid continued strings
by using multi-part strings, one per line.
* cfg.mk (sc_prohibit_continued_string_alpha_in_column_1): Add SC rule.
2018-12-02 15:52:49 +01:00
Bernhard Voelker
bac58c5178 maint: adjust preprocessor indentation via cppi
Run 'cppi -a' for all *.[ch] files, and add a syntax-check rule for it.

* cfg.mk (sc_preprocessor_indentation): Add rule.
* find/defs.h: Run 'cppi -a' on this file.
* find/fstype.c: Likewise.
* find/oldfind.c: Likewise.
* find/parser.c: Likewise.
* find/pred.c: Likewise.
* find/print.h: Likewise.
* find/sharefile.h: Likewise.
* gnulib-local/lib/gcc-function-attributes.h: Likewise.
* lib/bugreports.h: Likewise.
* lib/buildcmd.c: Likewise.
* lib/buildcmd.h: Likewise.
* lib/extendbuf.h: Likewise.
* lib/fdleak.h: Likewise.
* lib/findutils-version.h: Likewise.
* lib/listfile.c: Likewise.
* lib/printquoted.h: Likewise.
* lib/regextype.h: Likewise.
* lib/safe-atoi.h: Likewise.
* lib/splitstring.h: Likewise.
* lib/system.h: Likewise.
* locate/locatedb.h: Likewise.
* xargs/xargs.c: Likewise.
2018-12-02 15:52:44 +01:00
Bernhard Voelker
815c737b42 maint: fix typo in comment in safe-atoi.c
* lib/safe-atoi.c (safe_atoi): s/chack/check/
2018-11-10 23:42:28 +01:00
Aron Barath
5dae49b4fc fdleak.c: avoid compiler error on platforms lacking getrlimit
* lib/fdleak.c (get_max_fd): Move definition of the fd_limit variable
into the HAVE_GETRLIMIT block giving it a better scope: platforms
lacking getrlimit probably also lack struct rlimit, too.

Copyright-paperwork-exempt: Yes
2018-08-08 15:27:58 +02:00
James Youngman
bb51d3581d Shorten output of qmark_chars after replacing a multibyte characer.
When qmark_chars() replaces a multibyte character with a single
character, this reduces the length of the string.  When this happens,
terminate the now-shorter string at the new length.

This is simple workaround for bug http://savannah.gnu.org/bugs/?54236.
2018-07-06 09:46:46 +01:00
Bernhard Voelker
565bbeb89d maint: prevent multiple inclusion of header files
* find/print.h: Add #ifndef / #define / #endif guard to prevent
multiple inclusion of this header file.
* lib/fdleak.h: Likewise.
* lib/findutils-version.h: Likewise.
* lib/regextype.h: Likewise.
* lib/splitstring.h: Likewise.
2018-03-14 20:44:14 +01:00
Bernhard Voelker
e9340a8bd7 build: avoid use of $(RM)
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.
2018-03-14 20:44:14 +01:00
Bernhard Voelker
e551cfec0f maint: move NLS-related macros to a central place
Add definition like in coreutils, thus also silencing GCC on NetBSD 7.1:
  warning: "textdomain" redefined

* lib/system.h: Include <locale.h> and gnulib's "gettext.h" here,
and define the macros textdomain, bindtextdomain, _ and N_.
* find/exe.c: Use it.
* 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/bugreports.c: Likewise.
* lib/buildcmd.c: Likewise.
* lib/dircallback.c: Likewise.
* lib/fdleak.c: Likewise.
* lib/findutils-version.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.
* cfg.mk (exclude_file_name_regexp--sc_bindtextdomain): Add exemption
for some non-main sources to pass the syntax-check.
2018-03-14 20:44:14 +01:00
Bernhard Voelker
8705455ce0 maint: update copyright year number ranges
Run 'make update-copyright'.

* lib/regexprops.c (copying): Update the year number manually.
* All other files: Update copyright years via the above make run.
2018-01-01 19:27:15 +01:00
James Youngman
1b53838ddf regexprops: don't mention regex dialects we're not going to document.
* 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.
2017-11-14 22:22:36 +00:00
James Youngman
e2c673cbcd regexprops: fix dangling reference to the `ed' regular expression dialect.
* 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.
2017-11-14 13:43:32 +00:00
Bernhard Voelker
aa742e34b8 all: use die() rather than error(EXIT_FAILURE)
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.
2017-11-13 18:40:29 +01:00
Bernhard Voelker
ff4701b4ef maint: avoid unused-but-set-variable, unused-parameter warnings from GCC 7
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'.
2017-11-13 18:40:29 +01:00
Bernhard Voelker
cd61e9f7ac maint: add die.h; avoid missing-fallthrough warnings after error w/ GCC 7
* 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.
2017-11-13 18:40:29 +01:00
Bernhard Voelker
05da1fa358 maint: avoid implicit-fallthrough warnings from GCC 7
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.
2017-11-13 18:38:08 +01:00
Bernhard Voelker
3876904855 maint: avoid unused-macros warning from GCC 7
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.
2017-11-08 00:32:39 +01:00
Bernhard Voelker
2cb10332af all: prefer https:// URLs where possible
Change from http:// to https:// URLs for the following:
www.gnu.org, gnu.org, savannah.gnu.org, git.sv.gnu.org, lists.gnu.org,
translationproject.org, cve.mitre.org, cwe.mitre.org, xkcd.com,
standards.ieee.org, and gcc.gnu.org.

* COPYING: Do the above replacement.
* ChangeLog-2013: Likewise.
* NEWS: Likewise.
* README: Likewise.
* README-hacking: Likewise.
* build-aux/Makefile.am: Likewise.
* build-aux/check-testfiles.sh: Likewise.
* build-aux/gen-changelog.sh: Likewise.
* build-aux/man-lint.sh: Likewise.
* build-aux/src-sniff.py: Likewise.
* cfg.mk: Likewise.
* configure.ac: Likewise.
* doc/Makefile.am: Likewise.
* doc/find-maint.texi: Likewise.
* doc/find.texi: Likewise.
* find/defs.h: Likewise.
* find/exec.c: Likewise.
* find/find.1: Likewise.
* find/finddata.c: Likewise.
* 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/print.h: Likewise.
* find/sharefile.c: Likewise.
* find/sharefile.h: Likewise.
* find/testsuite/Makefile.am: Likewise.
* find/testsuite/binary_locations.sh: Likewise.
* find/testsuite/checklists.py: Likewise.
* find/testsuite/config/unix.exp: Likewise.
* find/testsuite/find.gnu/name-period.exp: Likewise.
* find/testsuite/find.posix/depth1.exp: Likewise.
* find/testsuite/sv-34079.sh: Likewise.
* find/testsuite/sv-34976-execdir-fd-leak.sh: Likewise.
* find/testsuite/sv-48030-exec-plus-bug.sh: Likewise.
* find/testsuite/sv-48180-refuse-noop.sh: Likewise.
* find/testsuite/sv-52220.sh: Likewise.
* find/testsuite/sv-bug-32043.sh: Likewise.
* find/testsuite/test_escape_c.sh: Likewise.
* find/testsuite/test_escapechars.sh: Likewise.
* find/testsuite/test_inode.sh: Likewise.
* find/testsuite/test_type-list.sh: Likewise.
* find/tree.c: Likewise.
* find/util.c: Likewise.
* gnulib-local/lib/gcc-function-attributes.h: Likewise.
* lib/bugreports.c: Likewise.
* lib/bugreports.h: Likewise.
* lib/buildcmd.c: Likewise.
* lib/buildcmd.h: Likewise.
* lib/check-regexprops.sh: Likewise.
* lib/dircallback.c: Likewise.
* lib/dircallback.h: Likewise.
* lib/extendbuf.c: Likewise.
* lib/extendbuf.h: Likewise.
* lib/fdleak.c: Likewise.
* lib/fdleak.h: Likewise.
* lib/findutils-version.c: Likewise.
* lib/findutils-version.h: Likewise.
* lib/listfile.c: Likewise.
* lib/listfile.h: Likewise.
* lib/printquoted.c: Likewise.
* lib/printquoted.h: Likewise.
* lib/qmark.c: Likewise.
* lib/regexprops.c: Likewise.
* lib/regextype.c: Likewise.
* lib/regextype.h: Likewise.
* lib/safe-atoi.c: Likewise.
* lib/safe-atoi.h: Likewise.
* lib/splitstring.c: Likewise.
* lib/splitstring.h: Likewise.
* lib/test_splitstring.c: Likewise.
* lib/unused-result.h: Likewise.
* locate/frcode.c: Likewise.
* locate/locate.1: Likewise.
* locate/locate.c: Likewise.
* locate/locatedb.5: Likewise.
* locate/locatedb.h: Likewise.
* locate/testsuite/Makefile.am: Likewise.
* locate/testsuite/config/unix.exp: Likewise.
* locate/updatedb.1: Likewise.
* locate/updatedb.sh: Likewise.
* locate/word_io.c: Likewise.
* po/fetch-po-files: Likewise.
* xargs/testsuite/Makefile.am: Likewise.
* xargs/testsuite/config/unix.exp: Likewise.
* xargs/xargs.1: Likewise.
* xargs/xargs.c: Likewise.
2017-10-23 00:57:57 +02:00
Bernhard Voelker
0548a502cd maint: add copyright header to more files
* Makefile.am: Add copyright header.
* README: Likewise.
* TODO: Likewise.
* doc/perm.texi: Likewise; use 1994-2017 as Kevin brought it into
findutils from coreutils.
* find/Makefile.am: Add copyright header.
* lib/Makefile.am: Likewise.
* locate/Makefile.am: Likewise.
* xargs/Makefile.am: Likewise.
2017-10-23 00:57:57 +02:00
Bernhard Voelker
4625495c48 maint: align copyright header line
* lib/extendbuf.c: s/Copyright/Copyright (C)/
* lib/printquoted.h: Likewise.
* lib/regextype.c: Likewise.
* lib/regextype.h: Likewise.
2017-10-23 00:57:35 +02:00
Bernhard Voelker
77651af6a8 maint: update copyright year number ranges
Better late than never: run 'make update-copyright'.

* cfg.mk (update-copyright-env): Change UPDATE_COPYRIGHT_USE_INTERVALS
from 1 to 2 to get a minimal containing range of years; also set
UPDATE_COPYRIGHT_MAX_LINE_LENGTH to 79 characters.
* .x-update-copyright: Add an entry for bootstrap which comes from
gnulib.
* lib/qmark.c: While at it, fix a typo: s/courutils/coreutils/.
* lib/regexprops.c (copying): Update the text so that the
copyright years match the result of "make update-copyright".
* po/fi.po: Change copyright header so that "make update-copyright"
can pick it up: s/©/(C)/
* po/it.po: Likewise.
* po/vi.po: Likewise.
* All other files: Update copyright years via the above make run.
2017-10-23 00:45:18 +02:00
Bernhard Voelker
4bbc9e7a4a maint: avoid warnings from GCC 6.2.1
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.
2017-02-06 22:25:01 +01:00
Bernhard Voelker
7a6e548690 find: handle more readdir(3) errors
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".
2016-11-02 23:32:04 +01:00
Bernhard Voelker
8cdc9767e3 Fix bug #48030: find: -exec + does not pass all arguments in certain cases
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
2016-05-31 10:39:10 +02:00
Bernhard Voelker
06c72d9009 maint: adjust .gitignore files
* 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.
2016-02-16 23:27:44 +01:00
Bernhard Voelker
b05118da9c maint: avoid syntax-check failures
'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.
2016-02-16 23:27:21 +01:00
James Youngman
f535461241 Better and more consistent guidance on how to report bugs.
* 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.
2016-01-25 23:56:17 +00:00