Run 'make update-gnulib-to-latest' in order to use the latest version
for the imminent release.
* bootstrap: Sync from gnulib/build-aux/bootstrap.
* gnulib: Update to latest.
* doc/find.texi (Action -delete): Improve and re-structure:
Mention that -delete is able to remove directories (if they are empty),
that failure to delete a file changes the exit code to nonzero, and
clarify better the relation between -delete, -depth and -prune.
* find/find.1 (-delete): Align with the above mentioned section in the
Texinfo manual.
Fixes https://savannah.gnu.org/bugs/?61774
Originally reported by Chris Davies in
https://bugs.debian.org/1003339
Co-authored-by: Bernhard Voelker <mail@bernhard-voelker.de>
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.
Run 'make update-gnulib-to-latest', mainly due to:
> license: fix GPLv3 texts to use a comma instead of semicolon.
* bootstrap: Sync from gnulib/build-aux/bootstrap.
* gnulib: Update to latest.
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.
Run 'make update-gnulib-to-latest', mainly to update the copyright
year numbers with:
> maint: run 'make update-copyright'
* bootstrap: Sync from gnulib/build-aux/bootstrap.
* gnulib: Update to latest.
* tests/init.sh: Sync from 'gnulib/tests/init.sh'.
doc/find.texi (xargs options): Change 'grep -lz' to 'grep -lZ' as
input for 'xargs -0o' as only the latter will write a NUL after
each file name. Add -n1 to the xargs call.
Reported by Robin A. Meade in
https://savannah.gnu.org/bugs/?61341
On most modern systems like GNU/Linux, read(2)-ing from a directory file
descriptor will fail with EISDIR, but it succeeds e.g. on GNU/Hurd and
AIX-7.1/AIX-7.2.
tests/find/files0-from.sh: Skip the test case excercising a directory
argument for the -files0-from option when the system allows reading
from a directory.
On GNU/Hurd, the value 0 is a valid inode number, and is e.g. used
for /dev/console and /dev/tty. The find(1) program aborted on this
platform when the user specified the -inum test and when the search
visited such a file.
$ find /dev/null /dev/tty -inum 40799 -printf '%i:%p\n'
40799:/dev/null
find: util.c:330: get_info: Assertion `p->st_ino' failed.
Aborted
Likewise, 'find -printf %i' aborted when hitting such a file.
* find/defs.h (get_info): Remove declaration.
* find/pred.c (pred_inum): Remove the redundant assert for ST_INO
as parse_inum sets need_inum=true which ensures that the inode number
is known.
* find/util.c (get_info): Declare static, and simplify: remove the
assertions for the inode number and file type.
While at it, add condition !state.have_stat in the need_stat case
for consistency.
* tests/find/inode-zero.sh: Add test.
* tests/local.mk (all_tests): Reference it.
Problem introduced by the inum optimisation in commit 2bf001636e6.
Reported by Andrea Monaco <andrea.monaco@autistici.org> in
https://lists.gnu.org/r/bug-findutils/2021-12/msg00008.html
With the '-D stat' debugging option turned on, 'find -L' determined the
SELinux context information as if the -L (or -H) option was not given:
$ strace -ve getxattr,lgetxattr find -L . -maxdepth 0 -printf '%Z:%p\n'
getxattr(".", "security.selinux", 0x55b29a2b2d40, 255) = -1 ENODATA (No data available)
...
$ strace -ve getxattr,lgetxattr find -D stat -L . -maxdepth 0 -printf '%Z:%p\n'
lgetxattr(".", "security.selinux", 0x5649c91d8d40, 255) = -1 ENODATA (No data available)
...
* find/parser.c (set_follow_state): Move the DebugStat handling after
the switch statement, thus eliminating the if/else.
Bug present since adding the SELinux implementation in v4.5.5-42-g1a05af6a.
find(1) supports both searching for and printing of the birth time
of a file since 2007, but the documenation lacked the description
for the latter.
* doc/find.texi (node Time Directives): Add item for %B.
(node Time Formats): Mention that the described formats also apply to
the %B directive.
* find/find.1 (-printf format): Add description of %B.
* NEWS (Documentation Changes): Mention the change.
Fixes https://savannah.gnu.org/bugs/?61327
Do no longer output an error diagnostic when the input file of
the -files0-from option is empty.
* find/ftsfind.c (process_all_startpoints): Remove error diagnostic.
* doc/find.texi (node Starting points): Adjust documentation.
* find/find.1: Likewise.
* tests/find/files0-from.sh: Adjust test.
Suggested by Stephane Chazelas in
https://savannah.gnu.org/bugs/?60383#comment11
* find/testsuite/find.gnu/sv-bug-27563-execdir.exp: Guard test by
'safe_path' condition to avoid false-positive failures in case the
PATH variable contains the current directory '.' ... which lets the
`find -execdir` action fail with an error diagnostic.
Reported by Paxsali <akis.kapo@googlemail.com> in
https://savannah.gnu.org/bugs/?60383
Run 'make update-gnulib-to-latest' - thus pulling in 357 commits,
including the following which was also discussed in:
https://savannah.gnu.org/bugs/?60383
> test-framework-sh: remove unsafe entries from PATH
* gnulib: Update to latest.
* cfg.mk (local-checks-to-skip): Add and therefore disable sc_indent
as auto indent is too invasive for now.
* m4/mkinstalldirs.m4: Fix repeated word: s/can can/can/. Reported by
a new rule in sc_prohibit_doubled_word.
* m4/noreturn.m4: Likewise.
* tests/init.sh: Likewise.
The script to copy the documentation for the web to the CVS checkout
directory took the files from 'doc'. But as those files do not
reference the GNU stylesheet, the resulting online documentation
didn't look as fancy as usual.
Instead, copy the files from 'doc/manual' which gets created by the make
target 'web-manual'.
* build-aux/update-online-manual.sh: Call the 'web-manual' make target
instead of building the documentation files in 'doc/' explicitly.
Adjust the commands to copy the just-generated files accordingly.
Remove the PostScript format as that does not get generated by the
'web-manual' target; it is probably no longer used nowadays anyway.
* NEWS (Documentation Changes): Mention the change.
Reported by Charles Burkitt <cecburkitt@gmail.com> in
https://lists.gnu.org/r/bug-findutils/2021-10/msg00008.html
* doc/find.texi (subsection Full Name Patterns): Change 2nd '-wholename'
to '-iwholename' to complete the enumeration of related options.
Fixes https://savannah.gnu.org/bugs/?61303
Copyright-paperwork-exempt: Yes
The FTS-based find is the default for a long time; oldfind has not been
installed since 4.5.18 (2015), and was only just used in tests.
* NEWS: Document the change.
* doc/find-maint.texi (Factor Out Repeated Code): Remove mentioning of
oldfind.
* find/.gitignore (/oldfind): Remove entry.
* find/Makefile.am (check_PROGRAMS): Remove.
(oldfind_SOURCES): Remove.
* find/defs.h (struct dir_id): Remove, it was only used in oldfind.c.
(symlink_handling): Likewise.
Adjust comments wrt oldfind otherwise.
* find/oldfind.c: Remove.
* find/testsuite/config/unix.exp: Remove the code to search for and
to run tests with oldfind.
* find/testsuite/find.posix/dotdotfiles.exp: Adjust comment.
* po/POTFILES.in (find/oldfind.c): Remove entry.
* tests/find/debug-missing-arg.sh: Remove run with oldfind.
* tests/find/exec-plus-last-file.sh: Likewise.
* tests/find/execdir-fd-leak.sh: Likewise.
* tests/find/many-dir-entries-vs-OOM.sh: Likewise.
* tests/find/name-lbracket-literal.sh: Likewise.
* tests/find/printf_escape_c.sh: Likewise.
* tests/find/printf_escapechars.sh: Likewise.
* tests/find/printf_inode.sh: Likewise.
* tests/find/refuse-noop.sh: Likewise.
* tests/find/type_list.sh: Likewise.
* tests/local.mk (built_programs): Remove oldfind from list.
* find/util.c (usage): Start sentences with upper case.
Add extra newlines to put each section (operators, options, tests, and
actions) on its own line.
Move the typical generic options --help and --version to the end.
* NEWS (Documentation Changes): Mention the change.
* build-aux/gen-changelog.sh: Call gitlog-to-changelog with the
--no-cluster option. The resulting ChangeLog reads better, because
each commit get its own date/author line.
The struct state field exit_status is only set to 0 (EXIT_SUCCESS) or
to 1 (EXIT_FAILURE) throughout the code.
Therefore, remove the more complicated wrapper function error_severity
which was only used in very few cases anyway.
While at it, replace the above magic numbers by EXIT_OKAY/EXIT_SUCCESS.
* find/defs.h (error_severity): Remove.
* find/util.c (error_severity): Remove, and update all callers by replacing
it by the direct assignment to state.exit_status.
(get_statinfo): Use the above better names.
(report_file_err): Likewise.
* find/exec.c (launch): Likewise.
* find/ftsfind.c (consider_visiting): Likewise.
(find): Likewise.
(process_all_startpoints): Likewise.
(main): Likewise.
* find/pred.c (pred_delete): Likewise.
(pred_empty): Likewise.
(match_lname): Likewise.
(pred_xtype): Likewise.
* find/print.c (do_fprintf): Likewise.
Prompted by the following warning of GCC-11.1.1:
tree.c: In function 'get_expr':
tree.c:140:31: warning: dereference of NULL 'prev_pred' [CWE-476] \
[-Wanalyzer-null-dereference]
140 | if ((UNI_OP == prev_pred->p_type
| ~~~~~~~~~^~~~~~~~
Former versions of find are not vulnerable to this, because a closing
parenthesis ')' without anything before was treated as a pathname
rather than an option.
But this is possible now with the recent introduction of the -files0-from
option (see commit 11576f4e6a) - yet still an invalid invocation.
Reproducer for a crash:
$ find -files0-from FILE ')' -print
Segmentation fault (core dumped)
In the similar case when the user didn't specify any action, and find(1)
adds the default action via '( user-expr ) -print', the error diagnostic
was very confusing, too:
$ find -files0-from FILE ')'
find: invalid expression; empty parentheses are not allowed.
* find/tree.c (get_expr): Handle the cases when there's no predicate
before CLOSE_PAREN, and output a useful error diagnostic.
* tests/find/files0-from.sh: Add a test case for it.
* bootstrap.conf (gnulib_modules): Add argv-iter and same-inode.
* find/defs.h (struct options): Add files0_from and ok_prompt_stdin
members.
* find/ftsfind.c (argv-iter.h, same-inode.h, xalloc.h): Add #include
for gnulib headers.
(process_all_startpoints): Change loop over starting point arguments
to a loop using the argv_iter gnulib module.
* find/parser.c (parse_table): Add option.
(parse_files0_from): Declare and define function.
(insert_exec_ok): Set options flag ok_prompt_stdin to true for
the -ok and -okdir action.
* find/util.c (usage): Add new option.
(set_option_defaults): Initialize new struct members.
* doc/find.texi (node Starting points): Add new section describing
the regular processing of starting points, and that with the new
option. Also mention in the description of -ok and -okdir that they
conflict with the new option.
* find/find.1: Document the new option here as well.
* tests/find/files0-from.sh: Add test.
* tests/local.mk (all_tests): Reference it.
* NEWS (New features in find): Mention the new option.
* README: Add section to attract more people towards the GNU project.
Inspired by a suggestion from Jose E. Marchesi <jemarch@gnu.org> on
the gnu-prog-discuss mailing list.
s3fs is a popular way to access S3-compatible object storage.
Its users have reported many bugs being surprised that updatedb crawls
these remote storage systems which causes poor performance:
https://github.com/s3fs-fuse/s3fs-fuse/issues?q=is%3Aissue+updatedb
* locate/updatedb.sh (PRUNEFS): Add 'fuse.s3fs'.
Copyright-paperwork-exempt: Yes
In manual pages, set environment variables in bold;
in the texinfo manual, use the @env{} macro consistently.
Additionally, talk about PATH instead of $PATH in all manuals.
* doc/find.texi: Do the above.
* find/find.1: Likewise.
* NEWS (Documentation Changes): Mention the fix.
Reported by Helge Kreutzmann in
https://savannah.gnu.org/bugs/?59963
* find/find.1 (Safer `...` approach): When referring to stat(2), change
the formatting so that only the function name 'stat' is set in bold,
not the '(2)'.
(Pruning ...): Change formatting of the tilde backup suffix in the example
to use simple quoting without additional markup.
Fixes https://savannah.gnu.org/bugs/?59963
Copyright-paperwork-exempt: Yes
The default command changed from '/bin/echo' to 'echo' in version 4.5.11,
but the commit 804ff7b90e only adjusted the Texinfo manual.
* xargs/xargs.1 (.SH DESCRIPTION): Change the default command here
in the man page as well.
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.
* gnulib-local/lib/gcc-function-attributes.h: Rename
_GL_ATTRIBUTE_FORMAT_PRINTF to _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD
following gnulib's change:
https://git.sv.gnu.org/cgit/gnulib.git/commit/?id=387d654c
* find/print.c (checked_fprintf): Use it.
Run 'make update-gnulib-to-latest'. Let's use this latest version
for the imminent 4.8.0 release.
* bootstrap: Sync from gnulib/build-aux/bootstrap.
* gnulib: Update to latest.
* xargs/xargs.c (warn_mutually_exclusive): Add function to output the
new warning diagnostic.
(main): Call the above new function in order to show a warning message
if conflicting options (-L -l -I -i -n) are specified.
* xargs/xargs.1: Explicitly document the fact that -L -l -I -i -n
options are mutually exclusive and how xargs behaves when more than one
of these options are specified.
* doc/find.texi (node Conflicting xargs options): Likewise, add this
section with examples.
* xargs/testsuite/config/unix.exp (xargs_start): Replace the full path
of the xargs executable in the stderr output file by its basename.
* xargs/testsuite/xargs.gnu/P3-n1-IARG.xe: Add file containing the
expected output with the new warning diagnostic.
* xargs/testsuite/xargs.posix/L2-n2.xe: Likewise.
* xargs/testsuite/xargs.posix/rc-123.xe: Likewise.
* xargs/testsuite/xargs.sysv/l1n4.xe: Likewise.
* xargs/testsuite/xargs/testsuite/xargs.gnu/P3-n1-IARG.exp: Ensure the
error diagnostic is in C locale to avoid false positives in other locales.
* xargs/testsuite/xargs.posix/L2-n2.exp: Likewise.
* xargs/testsuite/xargs.posix/rc-123.exp: Likewise.
* xargs/testsuite/xargs.sysv/l1n4.exp: Likewise.
* tests/xargs/conflicting_opts.sh: Add test coverage for combinations
of the mutually exclusive options -I -L and -n.
* xargs/testsuite/Makefile.am (EXTRA_DIST_EXP): Reference the new tests.
(EXTRA_DIST_XO): Reference the new *.xo files.
(EXTRA_DIST_XE): Reference the new *.xe files.
* NEWS (Improvements): Mention the change.
Co-authored-by: Bernhard Voelker <mail@bernhard-voelker.de>
Discussed at https://savannah.gnu.org/bugs/?52137
Duplicate of https://savannah.gnu.org/bugs/?58156
The type pid_t is defined as long on Solaris 11. Therefore, GCC
issued a -Wformat warning there when attempting to print as %d.
* find/exec.c: (launch): When writing the debug message, treat child_pid
as the wider long type.
'ls -i' outputs leading blanks before the inode number on Solaris 11.
The 'exp' reference file should not contain them.
* tests/find/printf_inode.sh (make_canonical): Strip off leading
blanks.
"Overfull \hbox" results lines exceeding the page width, and therefore
may not even be readable. At least they are ugly.
* doc/find.texi (node O_NOFOLLOW): Break long example lines into
the next lines. While at it, update the version in that example to
4.8.0 (in good faith we'll have it in 2021), because we shouldn't
have a "*-git" version there.
* xargs/xargs.c (usage): Amend the -I description to mention that
the input is split at newlines.
* NEWS: Mention the change.
Fixes https://savannah.gnu.org/bugs/?58149
Run 'make update-gnulib-to-latest', mainly for these two commits:
> free-posix: Work around GCC mis-optimization bug.
> getgroups test: Avoid warning with glibc >= 2.32 and gcc >= 10.
* gnulib: Update to latest.
This test was prone to false-positive errors due to sub-second rounding
issues. Failures have been seen on openSUSE's build system.
* tests/find/used.sh: Use larger time intervals for the future access
times of the test files (compared to the '-used N' search), and adjust
the expected output accordingly.