307 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
G. Branden Robinson
09a4602970 xargs.1: revise option formatting
* xargs/xargs.1:

- Migrate from comma-separated to "stacked tag" formatting for command
  options.  This is easier to read and understand when option syntax is
  complex, and eliminates the problem of the comma being misinterpreted.
  Setting the comma in bold, not roman, might have increased this risk.

  Stacking tags--without direct recourse to formatter requests--however
  requires the use of a groff man(7) extension macro, `TQ` (from groff
  1.20, 2009).  Because this page needs to be portable to non-groff
  formatters, define a page-local version after testing for its
  nonexistence using other GNU troff extensions (the `do` request and
  the `d` conditional expression operator).  (Actually, the method here
  is to test for `TQ`'s existence and then ignore the macro definition
  if the test succeeds; the token `..` terminates whichever eventuates.)

- Use the `TQ` macro to stack paragraph tags presenting synonymous
  options to xargs(1).

- Use the page-local `~~` string to put unbreakable spaces (where
  supported) between short options and their arguments.  (On the other
  hand, if a paragraph tag breaks across lines, the document likely
  requires revision.)

Discussed at:
https://lists.gnu.org/r/bug-findutils/2025-11/msg00094.html

Copyright-paperwork-exempt: Yes
2026-01-05 16:52:58 +01:00
G. Branden Robinson
b698bc19a1 xargs.1: fix markup nit
* xargs/xargs.1: Consistently use empty request before paragraphing macros
to aid document maintainers.  This was already done, inconsistently.

Discussed at:
https://lists.gnu.org/r/bug-findutils/2025-11/msg00094.html

Copyright-paperwork-exempt: Yes
2026-01-05 16:52:58 +01:00
G. Branden Robinson
a86cd78912 xargs.1: fix markup nit
groff_man(7):
   History
     M. Douglas McIlroy ⟨m.douglas.mcilroy@dartmouth.edu⟩ designed,
     implemented, and documented the AT&T man macros for Unix Version 7
     (1979) and employed them to edit Volume 1 of its Programmer’s
     Manual, a compilation of all man pages supplied by the system.  The
     package supported the macros listed in this page not described as
     extensions, except P and the deprecated AT and UC.  It documented
     no registers and defined only R and S strings.

     UC appeared in 3BSD (1980).  Unix System III (1980) introduced P
     and exposed the registers IN and LL, which had been internal to
     Seventh Edition Unix man.  PWB/Unix 2.0 (1980) added the Tm string.
     4BSD (1980) added lq and rq strings.  SunOS 2.0 (1985) recognized
     C, D, P, and X registers.  4.3BSD (1986) added AT and P.  Ninth
     Edition Unix (1986) introduced EX and EE.  SunOS 4.0 (1988) added
     SB.  Unix System V (1988) incorporated BSD’s lq and rq strings.

     Except for EX/EE, James Clark implemented the foregoing features in
     early versions of groff.  Later, groff 1.20 (2009) resurrected
     EX/EE and originated SY/YS, TQ, MT/ME, and UR/UE.  Plan 9 from User
     Space’s troff introduced MR in 2020.

* xargs/xargs.1: Favor `P` macro, which the page predominantly uses, over
`PP` (`LP` is not observed).  `P` has been universally portable since 1986.

Discussed at:
https://lists.gnu.org/r/bug-findutils/2025-11/msg00094.html

Copyright-paperwork-exempt: Yes
2026-01-05 16:52:58 +01:00
G. Branden Robinson
8d74646de9 xargs.1: fix markup nit
* xargs/xargs.1:
Drop unnecessary quotes around single-word macro arguments.

Discussed at:
https://lists.gnu.org/r/bug-findutils/2025-11/msg00094.html

Copyright-paperwork-exempt: Yes
2026-01-05 16:52:58 +01:00
G. Branden Robinson
214285e6f2 xargs.1: fix unescaped hyphens
* xargs/xargs.1: Do the above.

Discussed at:
https://lists.gnu.org/r/bug-findutils/2025-11/msg00094.html

Copyright-paperwork-exempt: Yes
2026-01-05 16:52:58 +01:00
G. Branden Robinson
341ba019f4 xargs.1: clarify --max-args value "1" better
* xargs/xargs.1: Do the above.

Discussed at:
https://lists.gnu.org/r/bug-findutils/2025-11/msg00094.html

Copyright-paperwork-exempt: Yes
2026-01-05 16:52:58 +01:00
G. Branden Robinson
289eaa25dc xargs.1: hyphenate attributive phrase
* xargs/xargs.1 (OPTIONS): Use hyphen in "POSIX-compliant".

Discussed at:
https://lists.gnu.org/r/bug-findutils/2025-11/msg00094.html

Copyright-paperwork-exempt: Yes
2026-01-05 16:52:58 +01:00
G. Branden Robinson
ab387c1cdc xargs.1: fix font markup nit
* xargs/xargs.1:
Favor man(7) font macros over *roff font selection escape sequences.
Macros are (a) visually less cluttered, (b) interfere less with spell
checking, and (c), in groff man(7), automatically apply italic
corrections, which otherwise requires explicit use of GNU troff
extension escape sequences (`\/` and `\,`).

Discussed at:
https://lists.gnu.org/r/bug-findutils/2025-11/msg00094.html

Copyright-paperwork-exempt: Yes
2026-01-05 16:52:58 +01:00
G. Branden Robinson
2b9f253b15 xargs.1: use ellipses in synopsis
...rather than pluralization.

* xargs/xargs.1 (SYNOPSIS): Do the above.

Discussed at:
https://lists.gnu.org/r/bug-findutils/2025-11/msg00094.html

Copyright-paperwork-exempt: Yes
2026-01-05 16:52:58 +01:00
G. Branden Robinson
c5dfe4c378 xargs.1: set file names in italics
...not roman.

groff_man_style(7):
   Font style macros
...
     .I [text]
            Set text in an italic or oblique face.  Given no argument, I
            plants a one‐line input trap; text on the next line, which
            can be further formatted with a macro, is set in an italic
            or oblique face.

            Use italics for file and path names, for environment
            variables, for C data types, for enumeration or preprocessor
            constants in C, for variant (user‐replaceable) portions of
            syntax synopses, for the first occurrence (only) of a
            technical concept being introduced, for names of journals
            and of literary works longer than an article, and anywhere a
            parameter requiring replacement by the user is encountered.
            An exception involves variant text in a context already
            typeset in italics, such as file or path names with
            replaceable components; in such cases, follow the convention
            of mathematical typography: set the file or path name in
            italics as usual but use roman for the variant part (see IR
            and RI below), and italics again in running roman text when
            referring to the variant material.

* xargs/xargs.1: Do the above.

Discussed at:
https://lists.gnu.org/r/bug-findutils/2025-11/msg00094.html

Copyright-paperwork-exempt: Yes
2026-01-05 16:52:58 +01:00
G. Branden Robinson
6d695cc480 xargs.1: use quotation marks
* xargs/xargs.1: Also set the braces in `-I{}` in bold, not roman,
since they are literal.

The `lq` and `rq` strings are widely portable.

groff_man_style(7):
   Strings
     \*(lq
     \*(rq   interpolate special character escape sequences for left and
             right double‐quotation marks, \(lq and \(rq, respectively.
...
     A contemporary man page needs none of the above.  \*S is
     superfluous; type size changes are invisible on terminals, and
     macros that change it restore its original value afterward.  Better
     alternatives exist for the rest; simply use the \[rg], \[lq],
     \[rq], and \[tm] special character escape sequences directly.
     Unless you are aiming for a pathological level of portability——
     perhaps composing a man page for consumption on simulators of 1980s
     Unix systems (or Solaris 10 troff, though even it supports
     “\(rg”)——avoid using the above strings.
...
Notes
     Some tips on composing and troubleshooting your man pages follow.
...
     • When and how should I use quotation marks?

       As noted above in subsection “Font style macros”, apply quotation
       marks to “brief specimens of literal text, such as article
       titles, inline examples, mentions of individual characters or
       short strings, and (sub)section headings in man pages”.  Multi‐
       word literals, such as Unix commands with arguments, when set
       inline (as opposed to displayed between EX and EE), should be
       quoted to ensure that the boundaries of the literal are clear
       even when the material is stripped of font styling by, for
       example, copy‐and‐paste operations.  groff, Heirloom Doctools
       troff, neatroff, and mandoc support all of the special characters
       \[oq], \[cq], \[lq], \[rq], \[aq], and \[dq] described in
       subsection “Portability” above.  DWB, Plan 9, and Solaris 10
       troffs do not.  Interpolating the strings \*(lq and \*(rq
       portably yields directional double quotation marks, if available,
       in all these formatters (though neatroff does not supply a man
       macro package), but they cannot reliably be used in macro
       arguments.

Discussed at:
https://lists.gnu.org/r/bug-findutils/2025-11/msg00094.html

Copyright-paperwork-exempt: Yes
2026-01-05 16:52:58 +01:00
G. Branden Robinson
34142ca063 xargs.1: set "findutils" in italics
...not roman.

* xargs/xargs.1 (STANDARDS CONFORMANCE): Do the above.

Discussed at:
https://lists.gnu.org/r/bug-findutils/2025-11/msg00094.html

Copyright-paperwork-exempt: Yes
2026-01-05 16:52:58 +01:00
G. Branden Robinson
4055cf7bbc xargs.1: fix truncated examples on old troff
Seventh Edition Unix man(7)[1] and its descendants handle at most six
arguments to macros.  Excess arguments are ignored and not formatted.

[1] https://minnie.tuhs.org/cgi-bin/utree.pl?file=V7/usr/lib/tmac/tmac.an

* xargs/xargs.1 (EXAMPLES): Add quotes.

Discussed at:
https://lists.gnu.org/r/bug-findutils/2025-11/msg00094.html

Copyright-paperwork-exempt: Yes
2026-01-05 16:52:58 +01:00
G. Branden Robinson
5c31ac2aeb xargs.1: add styling to text
...for consistency with existing practice in findutils man pages.

* xargs/xargs.1: Set "find" (the command) and "-print0" in bold, not roman.

Discussed at:
https://lists.gnu.org/r/bug-findutils/2025-11/msg00094.html

Copyright-paperwork-exempt: Yes
2026-01-05 16:52:58 +01:00
G. Branden Robinson
4e562ab11f xargs.1: access ' character portably
* xargs/xargs.1: Do the above.

Discussed at:
https://lists.gnu.org/r/bug-findutils/2025-11/msg00094.html

Copyright-paperwork-exempt: Yes
2026-01-05 16:52:58 +01:00
G. Branden Robinson
cd4977172c xargs.1: overcome limited portability of \~
Warnings from `groff -C -ww -man` in the forthcoming groff 1.24:
troff:xargs/xargs.1:295: warning: an escaped '~' is not portable to AT&T troff
troff:xargs/xargs.1:296: warning: an escaped '~' is not portable to AT&T troff
troff:xargs/xargs.1:296: warning: an escaped '~' is not portable to AT&T troff
troff:xargs/xargs.1:298: warning: an escaped '~' is not portable to AT&T troff

groff_man_style(1):
   Portability
...
     \~        Adjustable non‐breaking space.  Use this escape sequence
               to prevent a break inside a short phrase or between a
               numerical quantity and its corresponding unit(s).

                      Before starting the motor,
                      set the output speed to\~1.
                      There are 1,024\~bytes in 1\~KiB.
                      CSTR\~#8 documents the B\~language.

               \~ is a GNU extension also supported by Heirloom Doctools
               troff 050915 (September 2005), mandoc 1.9.14
               (2009‐11‐16), neatroff (commit 1c6ab0f6e, 2016‐09‐13),
               and Plan 9 from User Space troff (commit 93f8143600,
               2022‐08‐12), but not by DWB or Solaris 10 troffs.

* xargs/xargs.1:
Define a string to indirect use of `\~` escape sequence.  On formatters
that don't support groff extensions, use the AT&T troff `\ `
(backslash-space) escape sequence, which isn't quite as good because it
is a space that is not only unbreakable, but unadjustable--which,
however, doesn't matter when formatting man pages with adjustment
disabled, as some implementations do (and which groff makes
configurable).

Discussed at:
https://lists.gnu.org/r/bug-findutils/2025-11/msg00094.html

Copyright-paperwork-exempt: Yes
2026-01-05 16:52:58 +01:00
G. Branden Robinson
236a3c8647 xargs.1: use portable typographer's quotes
* xargs/xargs.1: Do the above.

Discussed at:
https://lists.gnu.org/r/bug-findutils/2025-11/msg00094.html

Copyright-paperwork-exempt: Yes
2026-01-05 16:52:58 +01:00
G. Branden Robinson
2923a0d78f doc: access en dash character portably
The `\(en` special character escape sequence is not universally
portable.  Indirect it through a string definition.

* find/find.1:
* locate/locate.1:
* locate/locatedb.5:
* locate/updatedb.1:
* xargs/xargs.1: Do the above.

Discussed at:
https://lists.gnu.org/r/bug-findutils/2025-11/msg00094.html

Copyright-paperwork-exempt: Yes
2026-01-05 16:52:58 +01:00
G. Branden Robinson
7e8712f0ca doc: use man(7) macros to style command synopses
* find/find.1:
* locate/locate.1:
* locate/updatedb.1:
* xargs/xargs.1: Favor man(7) font alternation macros over *roff font
  escape sequences.  When typesetting with groff(1), the macros
  automatically apply italic corrections.

* locate/locate.1: Protect long option name literals from hyphenation.
  GNU troff, Heirloom Doctools troff, and mandoc all support use of the
  `\%` hyphenation control escape sequence at the _beginning_ of a word
  suppress its hyphenation.  Other troffs do not.  Indirect this
  application of the escape sequence through a string, interpolating
  nothing on formatters that don't advertise GNU compatibility via the
  `.g` register.  (This means that literals can hyphenate undesirably on
  DWB, Solaris, and Plan 9 troffs.)

Discussed at:
https://lists.gnu.org/r/bug-findutils/2025-11/msg00094.html

Copyright-paperwork-exempt: Yes
2026-01-05 16:52:58 +01:00
G. Branden Robinson
ad7e34650a doc: delete blank lines from man page sources
* find/find.1:
* xargs/xargs.1: Replace blank lines with empty requests or paragraphing
  macro calls as seems to be intended.
* find/find.1: Delete blank lines preceding paragraphing or sectioning
  macros that serve only to put excess vertical space in the output.
* locate/locatedb.5: Replace blank lines with a dummy character
  producing a blank output line as _might_ be intended.

groff_man_style(7):
     ?  The empty request (.), which does nothing, vertically spaces the
        input file for readability by the document maintainer.  Do not
        put blank (empty) lines in a man page source document.  Some
        man(1) programs ?squeeze? multiple blank output lines into one.

Fixes style warnings from `groff -rCHECKSTYLE=3 -man`:
an.tmac:/.../share/man/man1/find.1:87: style: blank line in input
...
an.tmac:/.../share/man/man1/xargs.1:231: style: blank line in input
...
an.tmac:/.../share/man/man5/locatedb.5:118: style: blank line in input
...

Discussed at:
https://lists.gnu.org/r/bug-findutils/2025-11/msg00094.html

Copyright-paperwork-exempt: Yes
2026-01-05 16:52:37 +01:00
G. Branden Robinson
627072f022 doc: populate man pages' headers and footers more
Style warnings from `groff -rCHECKSTYLE=3 -man`.
an.tmac:/.../share/man/man1/locate.1:1: style: .TH missing third argument; \
  consider document modification date in ISO 8601 format (YYYY-MM-DD)
an.tmac:/.../share/man/man1/locate.1:1: style: .TH missing fourth argument; \
  consider package/project name and version (e.g., "groff 1.23.0")
...and similar.

groff_man_style(7):
     .TH identifier section [footer‐middle [footer‐inside [header‐
     middle]]]
...
            By convention, footer‐middle is the date of the most recent
            modification to the man page source document, and footer‐
            inside is the name and version or release of the project
            providing it.

* find/find.1:
* locate/locate.1:
* locate/locatedb.5:
* locate/updatedb.1:
* xargs/xargs.1: Add appropriate third and fourth arguments to `TH` macro calls.

To determine the revision date to include in the page, I used the Git
"AuthorDate" of the last commit consituting anything but a "bump" to the
copyright notice.

Discussed at:
https://lists.gnu.org/r/bug-findutils/2025-11/msg00094.html

Copyright-paperwork-exempt: Yes
2026-01-02 22:48:58 +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
James Youngman
99cfb6cf42 [maint] Stricter manpage checks.
From a suggestion by G. Branden Robinson to use `groff -t -z -ww
-rCHECKSTYLE=2 -man`, by pointing to and example in
https://lists.gnu.org/archive/html/bug-findutils/2025-11/msg00004.html.

* configure.ac: discover the location of the groff binary.
* build-aux/man-lint.sh: also run groff with -rCHECKSTYLE=2.   Use
  groff at the path discovered during configuration.
* find/Makefile.am: Lint-check manpages during "make check",
  not "make dist". Set the environment variable GROFF to the
  location of the groff binary.
* locate/Makefile.am: Likewise.
* xargs/Makefile.am: Likewise.
2025-11-17 10:08:13 +00:00
Bernhard Voelker
aa292af4c1 maint: help translators to disambiguate -0 as --null, not option "o"
As reported in <https://savannah.gnu.org/bugs/?67432>, it is easy to
confuse -0 with -O.  Give a hint to translators.

* xargs/xargs.c (main): Add TRANSLATORS hints.
2025-11-15 19:39:43 +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
Bernhard Voelker
deb3f7066d maint: use consistent references to standard files in messages
Use standard input instead of stdin, standard output instead of stdout,
and standard error instead of stderr in messages and documentation.
Inspired by coreutils commit:
https://cgit.git.sv.gnu.org/cgit/coreutils.git/commit/?id=c9a30d6781

* cfg.mk (sc_standard_outputs): Add syntax-check rule.
* doc/find.texi: Do the above.
* find/find.1: Likewise.
* locate/locate.1: Likewise.
* locate/locate.c: Likewise.
* xargs/xargs.1: Likewise.
* xargs/xargs.c: Likewise.
2025-11-15 19:39:43 +01:00
Bernhard Voelker
c41a617953 doc: clarify that POSIX Issue 8 is "IEEE Std 1003.1-2024"
* doc/find.texi: Do the above in various places.
* find/find.1:  Likewise.
* xargs/xargs.1: Likewise.
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
0c20228608 xargs: clarify command as optional in --help output
* xargs/xargs.c (usage): Fix synopsis by wrapping COMMAND in '[...]',
because it is in fact optional.  Also add a sentence that the default
COMMAND is 'echo'.
2025-01-05 22:32:46 +01:00
Bernhard Voelker
7752c3da26 xargs: simplify error handling for gnulib's safe_read function
The gnulib/NEWS file states:
  SAFE_READ_ERROR and SAFE_WRITE_ERROR are now
  obsolescent; callers can just check for < 0.

* xargs/xargs.c (xargs_do_exec): Adjust error handling of safe_read
accordingly.
2025-01-04 20:04:15 +01: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
Collin Funk
e65a91d2fb maint: update Makefile variables used by Gnulib
* locate/Makefile.am (LDADD): Remove $(LIB_CLOSE) as it is no longer
required per Gnulib NEWS 2009-03-20.
* xargs/Makefile.am (LADD): Likewise.
* find/Makefile.am (LDADD): Likewise. Change $(LIB_EACCESS) to
$(EUIDACCESS_LIBGEN) per Gnulib NEWS 2023-01-07.
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
76ddbb913e doc: State that find -print0 and xargs -0 are in POSIX from Issue 8.
The forthcoming Issue 8 of the POSIX standard includes find -print0
and xargs -0.
* doc/find.texi: find -print0 is no longer GNU-specific.  Similarly
for xargs -0.
* xargs/xargs.1: Likewise.
* NEWS: mention these changes.
2024-06-03 12:40:42 +01:00
James Youngman
e178314ae3 maint: convert tabs to spaces in C source files. 2024-06-01 21:41:05 +01:00
Bernhard Voelker
a76e5e1f02 xargs: avoid sc_useless_cpp_parens failure
$ make syntax-check
...
xargs/xargs.c:674:#if !(defined(SIGUSR1) && defined(SIGUSR2))
maint.mk: found useless parentheses in cpp directive
make: *** [maint.mk:924: sc_useless_cpp_parens] Error 1

* xargs/xargs.c (main): Simplify -P #if conditional to avoid the
above syntax-check failure.
2024-05-20 13:54:46 +02:00
James Youngman
9f5295f704 [xargs] restart stdin reads interruipted by SIGUSR1/SIGUSR2.
While we do use the gnulib safe_read function, we read input from
stdin using stdio, not direct Unix syscalls, so safe_read is not
involved.

* xargs/xargs.c: If a stdin read fails with EINTR, do it again.  Use
SA_RESTART when setting up signal handlers.  This fixes Savannah
bug #64442.
2024-05-19 13:11:02 +01:00
James Youngman
9fed05088f [doc] Mention the changes to xargs -P
* doc/find.texi: explain how xargs -P affects the handling of the
SIGUSR1 and SIGUSR2 signals.
* xargs/xargs.1: Likewise.
2024-05-19 11:27:46 +01:00
James Youngman
b560e3f911 [xargs] POSIX requires SIGUSR1/2 to be fatal if not blocked.
If the user uses -P we're not using only POSIX options, so in that
case it is OK to handle SIGUSR1/2.  Otherwise (without -P) don't
handle these signals, meaning that they could cause xargs to
terminate.

* xargs/xargs.c: set signal handlers for SIGUSR1 and SIGUSR2 only if
the -P option was used.  Warn if SIGUSR1 or SIGUSR2 is not defined.
* tests/xargs/test-sigusr: a new test for this.
* tests/local.mk: build and run the new test.
* NEWS: mention these changes.
2024-05-19 11:13:31 +01:00
James Youngman
ad636eae01 xargs: Wait for all children even if one exited with 255.
* xargs/xargs.c: fix Savannah bug #64451 (xargs -P exits before all
children have exited if one exits with status 255).
* xargs/xargs.1 (BUGS): mention this bug and the corrected behaviour.
* doc/find.texi: Likewise.
* NEWS: mention this bugfix.
2024-05-18 10:59:52 +01: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
65f456e055 xargs.1: narrow down deprecation on the -i option
The long option --replace it not deprecated, only the short form.

* xargs/xargs.1: Clarify the above better by explicitly mentioning
the short -i form.
2023-10-14 18:29:20 +02: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
c2002a3646 xargs.1: further editing improvements
* xargs/xargs.1: Start new sentences on a new line.
Use '\~' as unbreakable space in "2048 bytes".
2023-09-24 16:11:06 +02:00
Bjarni Ingi Gislason
a77c161b65 xargs.1: some remarks and editing fixes in the man page
Not in the patch.

Output from "mandoc -T lint xargs.1":

mandoc: xargs.1:1:2: WARNING: missing date, using "": TH

#######

Change '-' (\-) to '\(en' (en-dash) for a numeric range.
GNU gnulib has recently (2023-06-18) updated its
"build_aux/update-copyright" to recognize "\(en" in man pages.

xargs.1:393:if any invocation of the command exited with status 1-125
xargs.1:518:Copyright \(co 1990-2023 Free Software Foundation, Inc.

#####

Change (or include a "FIXME" paragraph about) misused SI (metric)
numeric prefixes (or names) to the binary ones, like Ki (kibi), Mi
(mebi), Gi (gibi), or Ti (tebi), if indicated.
If the metric prefixes are correct, add the definitions or an
explanation to avoid misunderstanding.

254:more than 128KiB, 128Kib is used as the default value; otherwise, the
255:default value is the maximum.  1KiB is 1024 bytes.

#####

Reduce space between words.

51:prevents such problems.   When using this option you will need to
94:command.   Multibyte characters are not supported.
466:internally.   This means that there is an upper limit on the length
492:a line which is longer than it can handle.   This is not an ideal

#####

Change -- in x--y to \(em (em-dash), or, if an
option, to \-\-

268:.BR --no-run-if-empty )

#####

Change - to \- if it shall be printed as a minus sign.

xargs.1:393:if any invocation of the command exited with status 1-125
xargs.1:518:Copyright \(co 1990-2023 Free Software Foundation, Inc.

#####

Change a HYPHEN-MINUS (code 0x55, 2D) to a minus (\-), if in front of a
name for an option.

234:.BR -t .
248:.BI -s " max-chars\fR, \fI" \-\-max\-chars "=\fImax-chars\fR"

#####

Wrong distance between sentences.

  Separate the sentences and subordinate clauses; each begins on a new
line.  See man-pages(7) ("Conventions for source file layout") and
"info groff" ("Input Conventions").

  The best procedure is to always start a new sentence on a new line,
at least, if you are typing on a computer.

Remember coding: Only one command ("sentence") on each (logical) line.

E-mail: Easier to quote exactly the relevant lines.

Generally: Easier to edit the sentence.

Patches: Less unaffected text.

  The amount of space between sentences in the output can then be
controlled with the ".ss" request.

51:prevents such problems.   When using this option you will need to
94:command.   Multibyte characters are not supported.
316:are mutually exclusive. If some of them are specified at the same
466:internally.   This means that there is an upper limit on the length
492:a line which is longer than it can handle.   This is not an ideal

#####

Do not use more than two space characters between sentences or (better)
only a new line character.

51:prevents such problems.   When using this option you will need to
94:command.   Multibyte characters are not supported.
466:internally.   This means that there is an upper limit on the length
492:a line which is longer than it can handle.   This is not an ideal

#####

  Not in the patch.

Output from "test-nroff -man -b -ww -z":

[ "test-groff" is a developmental version of "groff" ]

Input file is ./xargs.1

Output from test-groff -b -mandoc -dAD=l -rF0 -rHY=0 -t -w w -z :
an.tmac:/tmp/chk_manuals.temp.ZC2PK6:1: style: .TH missing third argument;\
  suggest document modification date in ISO 8601 format (YYYY-MM-DD)
an.tmac:/tmp/chk_manuals.temp.ZC2PK6:1: style: .TH missing fourth argument;\
  suggest package/project name and version (e.g., "groff 1.23.0")

####

* xargs/xargs.1: Change as described above.
2023-09-23 16:12:45 +02:00
Bernhard Voelker
6aedc4e631 doc: fix extra escaping of a minus '-' character in xargs.1
* xargs/xargs.1 (--show-limits): Remove redundant backslash character,
introduced when adding the description of that option in commit
956992ff71b3 in 2005.
2023-05-23 22:17:15 +02:00
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
2be229d3af xargs: pacify GCC 13
* xargs/xargs.c: Ignore -Wanalyzer-fd-leak.
2023-05-22 23:15:16 +02:00