2552 Commits

Author SHA1 Message Date
Bernhard Voelker
bbd06d8e06 doc: document double dash "--" option delimiter for xargs
* doc/find.texi (node xargs options): Add description of the "--"
option delimiter.
* xargs/xargs.1 (OPTIONS): Likewise.
* NEWS (Documentation Changes): Document the change.

Suggested by Dan Jacobson <jidanni@jidanni.org> in
<https://lists.gnu.org/r/bug-findutils/2023-04/msg00009.html>
2023-05-23 22:17:07 +02:00
Bernhard Voelker
a5b2e20d8f tests: fix FP in xargs test when /bin/sh is dash
Dash as /bin/sh apparently does not know $'\n' syntax.

* tests/xargs/verbose-quote.sh: Define NL variable for newline character;
change from $'\n' syntax to the above variable when generating input
for xargs.

Fixes https://sv.gnu.org/bugs/?63934
2023-05-23 01:57:47 +02:00
Bernhard Voelker
277de38d4b doc: add 'bugs, reporting' to primary index
* doc/find.texi: Do the above.

Suggested by Dan Jacobson in:
<https://lists.gnu.org/r/bug-findutils/2023-04/msg00013.html>
2023-05-23 01:14:46 +02:00
Bernhard Voelker
0bc43b0b40 maint: require support for post-2038 timestamps
* bootstrap.conf (gnulib_modules): Replace year2038 with
year2038-recommended.
* NEWS (Changes to the build process): Mention the change.
2023-05-23 00:13:10 +02:00
Bernhard Voelker
cf4133e9b0 maint: update gnulib to latest
There have been 626 commits on gnulib since the last update.

* bootstrap: Auto-update.
* bootstrap-funclib.sh: Likewise.
* gnulib: Update to latest.
* tests/init.sh: Likewise.
2023-05-23 00:12:54 +02:00
Bernhard Voelker
db175578e3 doc: change find enty point to "Finding Files"
The previous entry point for 'info find' was "Invoking find" which
is not that enlightening for the user.   Change to the better choice.

* doc/find.texi (@direntry): Change target for 'find' to the
chapter "Finding Files".

Discussed at:
<https://lists.gnu.org/r/bug-findutils/2023-04/msg00006.html>
2023-05-22 23:15:34 +02:00
Bernhard Voelker
251158b59e build: update gnulib prerequisite tools
* bootstrap.conf (buildreq): Add autopoint, m4, makeinfo, texi2pdf,
wget and xz.
2023-05-22 23:15:27 +02:00
Bernhard Voelker
2be229d3af xargs: pacify GCC 13
* xargs/xargs.c: Ignore -Wanalyzer-fd-leak.
2023-05-22 23:15:16 +02:00
James Youngman
fc47dadea9 doc: describe history of find, xargs and locate. 2023-03-18 20:23:43 +00:00
Bernhard Voelker
7836aa1def doc: use "end-of-file" with hyphenation consistently
* cfg.mk (sc_prohibit_unhyphenated_eof): Add syntax-check rule.
* doc/find.texi: Change "end of file" to "end-of-file" in several places.
* xargs/xargs.1: Likewise.
* xargs/xargs.c (eof_str): Change comment to adhere to the new rule.
2023-02-13 20:46:48 +01:00
Bernhard Voelker
da65ab1e69 doc: improve description about when xargs stops processing
* doc/find.texi (Multiple Files): Clarify better that xargs will stop when
reading the EOF marker string specified with the --eof option, or when a
launched command exists with status 255.  Switch the two termination
conditions to reflect the behavior.

Fixes RT #1912852.
2023-02-13 20:46:42 +01:00
Bernhard Voelker
4a72809272 find: fix error diagnostics of options with mandatory, numeric arguments
The error diagnostic for wrong invocations with option that require
numeric arguments (-inum, -links, -gid, -uid) was wrong and not helpful:
  $ find -gid
  find: invalid argument `-gid' to `-gid'

* find/parser.c (parse_gid): Remove changing back of the ARG_PTR in
the error case; thus simplify.
(parse_inum,parse_links,parse_uid): Likewise.
(get_num): While at it, mention -gid and -uid in the comment as well.
(insert_num): Also improve the error diagnostic in the case the user
has provided a non-numeric argument.  Previously, it was just "invalid
argument".
* tests/find/opt-numeric-arg.sh: Add test.
* tests/local.mk: Reference it.
* NEWS (Bug Fixes): Mention the fix.

Reported by Andreas Schwab <schwab@linux-m68k.org> in
<https://lists.gnu.org/r/bug-findutils/2023-01/msg00001.html>
2023-01-05 19:43:25 +01:00
ribbon
6490a80765 doc: minor formatting fixes in xargs.1
* xargs/xargs.1 (--max-args): Reset the bold formatting earlier
in two places.

Fixes https://sv.gnu.org/bugs/?62325

Copyright-paperwork-exempt: Yes
2023-01-02 00:05:44 +01: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
f293f5da80 maint: update gnulib to latest
Run 'make update-gnulib-to-latest', mainly to update the copyright
year numbers with:

  > maint: run 'make update-copyright'

This also pulls in the splitting of bootstrap into autopull.sh,
autogen.sh and bootstrap.

* autogen.sh: Add file.
* autopull.sh: Likewise.
* bootstrap-funclib.sh: Likewise.
* bootstrap: Auto-update.
* gnulib: Update to latest.
* tests/init.sh: Sync from 'gnulib/tests/init.sh'.
2023-01-01 23:51:03 +01:00
Bernhard Voelker
5c43cfb05c maint: avoid unportable 'grep -q'
The upcoming gnulib update comes with the new syntax-check named
'sc_unportable_grep_q':

  maint.mk: unportable 'grep -q', use >/dev/null instead
  make: *** [maint.mk:1377: sc_unportable_grep_q] Error 1

Fix offending places.

* cfg.mk (sc_prohibit_test_calls_print_ver_with_irrelevant_argument):
Replace unportable '-q' by redirecting grep output to /dev/null.
* doc/find.texi (node Adding Tests): Likewise.
* init.cfg (find_emits_warnings_): Likewise.
2023-01-01 23:15:36 +01:00
Bernhard Voelker
4391e438a4 doc: generate manuals with makeinfo --no-split
* doc/Makefile.am (AM_MAKEINFOFLAGS): Add for --no-split option.
(find_mono.html): Remove --no-split from makeinfo invocation.
* NEWS (Documentation Changes): Document the change.
* doc/.gitignore (/find.info-1,/find.info-2): Remove entries.

Suggested by Antonio Diaz Diaz <antonio@gnu.org> in
https://lists.gnu.org/r/bug-findutils/2022-11/msg00001.html
2022-11-16 01:12:40 +01:00
Antonio Diaz Diaz
f9f1ffc850 doc: fix typo in maintainer manual
* doc/find-maint.texi (chapter Security): s/p[art/part/

Copyright-paperwork-exempt: Yes
2022-11-16 00:30:47 +01:00
Antonio Diaz Diaz
8ff8307fd6 doc: remove redundant @deffnx for option -files0-from from manual
* doc/find.texi (section Starting points): Remove @deffnx; the @deffn
above it is sufficient.

Copyright-paperwork-exempt: Yes
2022-11-16 00:27:06 +01:00
John A. Leuenhagen
3657b73ecb doc: fix grammar issue in find man page
* find/find.1 (GLOBAL OPTIONS): Add "be" between "should" and
"specified".

Copyright-paperwork-exempt: Yes
2022-10-11 08:07:55 +02:00
Shuiqing Zhou
3c2d824ef5 tests: add tests for the 'find -newer' family
* tests/find/newer.sh: Add to improve test coverage.
* tests/local.mk (all_tests): Reference the test.

Co-authored-by: Bernhard Voelker <mail@bernhard-voelker.de>
Copyright-paperwork-exempt: Yes
2022-08-09 23:45:57 +02:00
Bernhard Voelker
e5c697eccf maint: remove obsolete AC_HEADER_STDC macro
Avoid the following warning:
  configure.ac:208: warning: The macro `AC_HEADER_STDC' is obsolete.

* configure.ac (AC_HEADER_STDC): Remove, and ...
(AC_CHECK_INCLUDES_DEFAULT): ... add this instead.
2022-04-25 08:37:17 +02:00
Helmut Grohne
a48d2ba8d7 build: bump gettext version to 0.19.8
findutils failed to build from source on musl-libc, because it failed
to detect gettext availability.  Newer gettext fixes this:

  Version 0.19.8 - June 2016
  [...]
  - The AM_GNU_GETTEXT Autoconf macro can now detect musl-libc's
    gettext as a compatible implementation.

* configure.ac (AM_GNU_GETTEXT_VERSION): Update from 0.19.3 to 0.19.8.
(AM_GNU_GETTEXT_REQUIRE_VERSION): Add to make autopoint pull the latest
available version instead of the exact specified version.
* NEWS: Mention the change.

Reported via Andreas Metzler <ametzler@bebt.de> at:
  https://sv.gnu.org/patch/?10203

Fixes: https://bugs.debian.org/1009874

Copyright-paperwork-exempt: Yes
2022-04-25 08:37:10 +02:00
Bernhard Voelker
d3097b3325 doc: fix formatting typo in Texinfo manual
* doc/find.texi (LC_COLLATE): Change man-style `\-name' to @samp{-name}.
2022-04-24 13:37:26 +02:00
Bernhard Voelker
36ec95c4d6 maint: fix code smell
Detected by `make findutils-check-smells` (ironically for itself):
  error: ./Makefile.am:88: Spaces at start of makefile line

* Makefile.am (findutils-check-smells): Fix tab indentation of the
recipe, and re-indent for better reading.
2022-04-24 13:37:00 +02:00
Bernhard Voelker
6d2fa2c9a0 find: omit warning diagnostic for -name '/'
Although usually a pattern containing a directory separator does not match
anything, a pattern solely consisting of one '/' still does (and has to)
for the root directory "/".

* find/parser.c (check_name_arg): Omit the warning in the case the
given pattern equals "/".
find/find.1 (-name): Clarify better that the pattern "/" is valid to
match the "/" directory.
* init.cfg (find_emits_warnings_): Add utility function.
* tests/find/name-slash.sh: Add test.
* tests/local.mk (all_tests): Reference it.
* MEWS (Bug Fixes): Mention the fix.

Fixes https://savannah.gnu.org/bugs/?62227
2022-04-24 13:35:49 +02:00
Bernhard Voelker
82e81acc5c maint: simplify check_name_arg in parser.c
* find/parser.c (check_name_arg): Change to void; remove return statement.
(parse_iname): Adjust caller.
(parse_name): Likewise.
2022-03-30 21:55:35 +02:00
Bernhard Voelker
fa7e628e19 find: port to Ubuntu 20.04 cross-compiling for OpenWRT 21.02
In the above build environment, HAVE_ENDPWENT seems to be defined to 0
instead of being #undef'ed.  Hence the build fails:

  parser.c: In function 'parse_user':
  parser.c:75:20: error: expected expression before ')' token
     75 | # define endpwent ()
        |                    ^
  parser.c:2463:7: note: in expansion of macro 'endpwent'
   2463 |       endpwent ();
        |       ^~~~~~~~

* find/parser.c (HAVE_ENDGRENT,HAVE_ENDPWENT): Change from #ifndef to
"#if !", and define the replacement code to "(void) 0".

Fixes https://github.com/openwrt/packages/issues/17912
2022-03-30 21:55:30 +02:00
Bernhard Voelker
43679658e2 find: fix indentation of --help output
* find/util.c (usage): Remove excess leading blank in the -mount line
of the "Normal options" block.
2022-02-04 16:49:44 +01:00
Bernhard Voelker
cabad6fc17 maint: post-release administrativa
* NEWS: Add new dummy release header.
2022-02-02 01:39:45 +01:00
Bernhard Voelker
f56ec21a34 NEWS: update before release
* NEWS: Prepare for the 4.9.0 release: minor re-ordering, and update
entries with bug numbers.
v4.9.0
2022-02-02 00:05:33 +01:00
Bernhard Voelker
1ce4f28720 maint: update gnulib to latest
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.
2022-02-01 19:18:03 +01:00
Andreas Metzler
58747d778e doc: improve description of 'find -delete'
* 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>
2022-01-31 00:48:47 +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
2e6c701850 maint: update gnulib to latest
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.
2022-01-06 01:55:29 +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
780b31ad23 maint: update gnulib to latest
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'.
2022-01-02 18:39:11 +01:00
Bernhard Voelker
2efc2d2e33 doc: fix 'xargs --open-tty' example
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
2021-12-31 02:34:31 +01:00
Bernhard Voelker
71556793c1 tests: avoid FP from 'find -files0-from DIR' on certain platforms
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.
2021-12-31 02:13:56 +01:00
Bernhard Voelker
a8e60e7437 maint: update gnulib to latest
Run 'make update-gnulib-to-latest'.

* bootstrap: Sync from gnulib/build-aux/bootstrap.
* gnulib: Update to latest.
2021-12-29 20:45:24 +01:00
Bernhard Voelker
9290525c77 find: fix visiting of files with inode number Zero
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
2021-12-29 20:36:19 +01:00
Bernhard Voelker
68979e578c find: avoid '-D stat' side effect on SELinux handling with -L or -H
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.
2021-12-25 16:55:49 +01:00
Bernhard Voelker
b1b58be2b2 doc: add description for birth time in 'find -printf' format
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
2021-11-28 00:30:57 +01:00
Bernhard Voelker
4ddb092de6 find: allow -files0-from input file to be empty
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
2021-11-27 23:21:06 +01:00
Bernhard Voelker
f16272db43 tests: fix error diagnostic
* find/testsuite/config/unix.exp (safe_path): Change $PATH to PATH
as the message refers to the name of the environment variable, i.e.,
not its value.
2021-11-27 23:04:30 +01:00
Bernhard Voelker
94e91f60fb tests: skip -execdir test if PATH contains unsafe directory
* 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
2021-11-27 23:04:16 +01:00
Bernhard Voelker
0dd5eaa329 maint: update gnulib to latest
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.
2021-11-27 23:03:16 +01:00
Bernhard Voelker
372cd34894 doc: improve maintainer description of the online manual
* doc/find-maint.texi (User Documentation): Add details how to
update the online manual from Git via the CVS web repository.
2021-10-20 12:09:11 +02:00
Bernhard Voelker
425e82e7b0 maint: copy online docs from 'doc/manual' to apply the GNU stylesheet
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
2021-10-20 12:09:01 +02:00