]> git.ipfire.org Git - thirdparty/man-pages.git/log
thirdparty/man-pages.git
18 months agocharsets.7: Say ISO/IEC 4873
Alejandro Colomar [Sun, 28 Jan 2024 19:08:00 +0000 (20:08 +0100)] 
charsets.7: Say ISO/IEC 4873

Link: <https://www.iso.org/standard/10859.html>
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Cc: Mario Blaettermann <mario.blaettermann@gmail.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
18 months agoman*/: Use '(date)' in TH line
Alejandro Colomar [Sun, 28 Jan 2024 19:13:35 +0000 (20:13 +0100)] 
man*/: Use '(date)' in TH line

It seems those dates were accidentally hardcoded.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
19 months ago*.mk: Allow pages with the suffix .man and no number
Alejandro Colomar [Mon, 22 Jan 2024 16:26:35 +0000 (17:26 +0100)] 
*.mk: Allow pages with the suffix .man and no number

This adds support for neomutt.man from the neomutt project.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
19 months agoopen.2: srcfix
G. Branden Robinson [Tue, 16 Jan 2024 15:33:55 +0000 (09:33 -0600)] 
open.2: srcfix

Migrate man page cross reference in non-filled context to font
alternation macro.  This is to prepare it for `MR` migration.

Signed-off-by: "G. Branden Robinson" <g.branden.robinson@gmail.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
19 months agosyscalls.2: ffix
G. Branden Robinson [Tue, 16 Jan 2024 13:40:20 +0000 (07:40 -0600)] 
syscalls.2: ffix

Refactor table format specification: use column modifiers to set heading
rows in bold instead of populating every entry in them with font
selection escape sequences.  Use a single '_' to indicate a horizontal
rule spanning the table.  Put vertical space before the table
(making it resemble a typographical "display") rather than after the
after the column heading.

Signed-off-by: "G. Branden Robinson" <g.branden.robinson@gmail.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
19 months agomremap.2: wfix
G. Branden Robinson [Tue, 16 Jan 2024 13:39:57 +0000 (07:39 -0600)] 
mremap.2: wfix

Recast to use language paralleling that of the MREMAP_DONTUNMAP
discussion elsewhere in the page.  Spotted these (excessively?)
abbreviated cross references while preparing for the `MR` man(7) macro
migration.

Signed-off-by: "G. Branden Robinson" <g.branden.robinson@gmail.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
19 months agofts.3, div_t.3type: ffix
G. Branden Robinson [Tue, 16 Jan 2024 13:39:40 +0000 (07:39 -0600)] 
fts.3, div_t.3type: ffix

Break lines containing a parametric prefix to a man page name into two
lines, using distinct font alternation macros and the `\c` escape
sequence to "connect" the output.  This prepares for adoption of the
`MR` man(7) macro in groff 1.23.0.

The style seen here assumes that the typeface used for man page names is
bold, which is ahistorical and which the `MR` feature makes
configurable.  It might be better to recast this shorthand into English.

Signed-off-by: "G. Branden Robinson" <g.branden.robinson@gmail.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
19 months agosocket.7: Mention CAP_NET_RAW on SO_MARK
Petr Vorel [Tue, 16 Jan 2024 11:04:18 +0000 (12:04 +0100)] 
socket.7: Mention CAP_NET_RAW on SO_MARK

Added in 079925cce1d0 ("net: allow SO_MARK with CAP_NET_RAW") in
Linux 5.17.

Cc: Maciej Żenczykowski <maze@google.com>
Cc: Matthias Gerstner <matthias.gerstner@suse.com>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
19 months agolocale.5: tfix
G. Branden Robinson [Sun, 14 Jan 2024 15:00:16 +0000 (09:00 -0600)] 
locale.5: tfix

...that proved surprisingly tough to troubleshoot.

I got the following output from my working copy.

grotty:...:(man5/locale.5):32291: error: output above first line discarded
grotty:...:(man5/locale.5):32291: error: output above first line discarded
grotty:...:(man5/locale.5):32291: error: output above first line discarded
grotty:...:(man5/locale.5):32291: error: output above first line discarded
grotty:...:(man5/locale.5):32291: error: output above first line discarded
grotty:...:(man5/locale.5):32291: error: output above first line discarded
grotty:...:(man5/locale.5):32291: error: output above first line discarded
grotty:...:(man5/locale.5):32291: error: output above first line discarded
grotty:...:(man5/locale.5):32291: error: output above first line discarded
grotty:...:(man5/locale.5):32292: error: output above first line discarded
grotty:...:(man5/locale.5):32294: error: output above first line discarded
grotty:...:(man5/locale.5):32294: error: output above first line discarded
grotty:...:(man5/locale.5):32294: error: output above first line discarded
grotty:...:(man5/locale.5):32294: error: output above first line discarded
grotty:...:(man5/locale.5):32294: error: output above first line discarded

`\r` is a perfectly legal *roff escape sequence, but one generally never
sees it in man pages.  In that case, the input line in question was at
the top of the "page" in continuous rendering mode, and so the attempt
at a reverse vertical motion did indeed put the drawing position above
the top of the page.

grepping reveals no other occurrences of '\r' in the man-pages corpus.

Signed-off-by: "G. Branden Robinson" <g.branden.robinson@gmail.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
19 months agocpuid.4: Note which CPUs don't support CPUID and what happens
наб [Thu, 4 Jan 2024 22:31:21 +0000 (23:31 +0100)] 
cpuid.4: Note which CPUs don't support CPUID and what happens

"Early 486" comes from an uncited wikipedia table, added in
<https://en.wikipedia.org/w/index.php?title=CPUID&diff=prev&oldid=592047209>
<https://en.wikipedia.org/w/index.php?title=CPUID&diff=prev&oldid=592047978>
but I spot-checked the rest of the table accurate to CPUs in my house
(the oldest of which is an original Celeron, so no 486),
and "early 486" is better than "early x86" which can mean anything.

This does leave earlier x86 unmentioned,
but Linux hasn't targeted those in over a decade,
so they're out of scope anyway.

Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
19 months agosched_getcpu.3: tfix
Alejandro Colomar [Mon, 1 Jan 2024 12:09:58 +0000 (13:09 +0100)] 
sched_getcpu.3: tfix

Fixes: 2b65a83f2983 ("Documents sched_getcpu(3), a wrapper for getcpu(2), provided since glibc 2.6.")
Reported-by: Shahab Ouraie <shahabouraie@gmail.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
19 months agofaccessat(2), utimensat(2): Document AT_EMPTY_PATH flag
Renzo Davoli [Sun, 10 Dec 2023 08:07:52 +0000 (09:07 +0100)] 
faccessat(2), utimensat(2): Document AT_EMPTY_PATH flag

utimensat() and faccessat() support the flag AT_EMPTY_PATH since
Linux 5.8.

(actually Linux 5.8 added faccessat2(): glibc wrapper for faccessat()
 uses faccessat2(), and faccessat2() does support AT_EMPTY_PATH).

Reuse the standard text used in many other -at manual pages.

Signed-off-by: Renzo Davoli <renzo@cs.unibo.it>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
19 months agofopencookie.3, stdio.3: wfix
наб [Fri, 29 Dec 2023 13:39:25 +0000 (14:39 +0100)] 
fopencookie.3, stdio.3: wfix

Suggested-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
19 months agostdio.3: Note down fmemopen(3), fopencookie(3), and open_[w]memstream(3)
наб [Tue, 26 Dec 2023 16:03:37 +0000 (17:03 +0100)] 
stdio.3: Note down fmemopen(3), fopencookie(3), and open_[w]memstream(3)

I was looking for fmemopen() to remember I was actually looking for
open_memstream(), and it was much more difficult than it ought to've
been.

Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
19 months agoopen_memstream.3: ffix
наб [Tue, 26 Dec 2023 16:04:14 +0000 (17:04 +0100)] 
open_memstream.3: ffix

Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
19 months agoCONTRIBUTING: Reduce strength of encouragement
Alejandro Colomar [Fri, 22 Dec 2023 11:44:05 +0000 (12:44 +0100)] 
CONTRIBUTING: Reduce strength of encouragement

That paragraph may be confusing to those who don't know about PGP, so
reduce strength of encouragement.  But to those that know about PGP, and
know how to use it, please, please use it.

Suggested-by: "G. Branden Robinson" <branden@debian.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agoCONTRIBUTING: Accept patches in attachments
Alejandro Colomar [Fri, 22 Dec 2023 11:08:13 +0000 (12:08 +0100)] 
CONTRIBUTING: Accept patches in attachments

I use mutt(1), which works fine with patches as attachments, and the
mailing list archives also work fine with attachments.  Let's accept
attachments.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agoCONTRIBUTING: The Majordomo has been fired
Alejandro Colomar [Fri, 22 Dec 2023 10:57:10 +0000 (11:57 +0100)] 
CONTRIBUTING: The Majordomo has been fired

The infrastructure of the list was recently modified.  Now, all the
information to subscribe, unsubscribe, or other actions, are in
<https://subspace.kernel.org/vger.kernel.org.html>.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agoswapon.2: MAX_SWAPFILES: Clarify limit after decrease
Yang Xu [Fri, 22 Dec 2023 03:07:08 +0000 (22:07 -0500)] 
swapon.2: MAX_SWAPFILES: Clarify limit after decrease

Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agoioctl_console.2: Document new CAP_SYS_ADMIN restrictions (since Linux 6.7)
Günther Noack [Fri, 1 Dec 2023 12:26:45 +0000 (13:26 +0100)] 
ioctl_console.2: Document new CAP_SYS_ADMIN restrictions (since Linux 6.7)

Since Linux commit 8d1b43f6a6df7bce ("tty: Restrict access to TIOCLINUX'
copy-and-paste subcommands"), the TIOCL_SETSEL, TIOCL_PASTESEL and
TIOCL_SELLOADLUT subcommands require CAP_SYS_ADMIN.

Cc: Hanno Böck <hanno@hboeck.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Günther Noack <gnoack@google.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agosendfile.2: Pull in_fd type requirements up to 6.7
наб [Thu, 21 Dec 2023 01:31:35 +0000 (02:31 +0100)] 
sendfile.2: Pull in_fd type requirements up to 6.7

But this does mean that since 5.12, it supports
(5.12 has ISREG|ISBLK, this actually matches 6.0 semantics):
  any      -> pipe  via splice
  seekable -> any

Also, there are many seekable files which aren't regular,
and the offset is updated regardless.
This is obvious, but the wording is clumsy.

Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agounix.7: SO_PEERCRED: Mention listen(2)
Alexey Tikhonov [Wed, 20 Dec 2023 17:28:34 +0000 (18:28 +0100)] 
unix.7: SO_PEERCRED: Mention listen(2)

In case of connected AF_UNIX stream sockets, server-side credentials are
set at the time of a call to listen(2), not when client-side calls
connect(2).

This is important if server side process changes UID/GID after listen(2)
and before connect(2).

Reproducer is available in [1].
Behavior was confirmed in the email thread [2].

Link: [1] <https://bugzilla.redhat.com/show_bug.cgi?id=2247682>
Link: [2] <https://lore.kernel.org/linux-man/CABPeg3a9L0142gmdZZ+0hoD+Q3Vgv0BQ21g8Z+gf2kznWouErA@mail.gmail.com/>
Signed-off-by: Alexey Tikhonov <atikhono@redhat.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agostrtol.3, strtoul.3: If the base is not supported, endptr may be left untouched
Alejandro Colomar [Tue, 19 Dec 2023 12:23:14 +0000 (13:23 +0100)] 
strtol.3, strtoul.3: If the base is not supported, endptr may be left untouched

Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agoREADME: Versions: Document the online pages in man7.org
Alejandro Colomar [Sun, 17 Dec 2023 13:37:20 +0000 (14:37 +0100)] 
README: Versions: Document the online pages in man7.org

Michael's online pages seem to be more-or-less up-to-date now.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agostring_copying.7: EXAMPLES: st[rp]ncpy(3): Use fwrite(3) instead of a loop
Alejandro Colomar [Sun, 17 Dec 2023 12:56:39 +0000 (13:56 +0100)] 
string_copying.7: EXAMPLES: st[rp]ncpy(3): Use fwrite(3) instead of a loop

Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agostring_copying.7: Use NITEMS() instead of sizeof()
Alejandro Colomar [Sun, 17 Dec 2023 12:45:15 +0000 (13:45 +0100)] 
string_copying.7: Use NITEMS() instead of sizeof()

For these byte functions, sizeof() works as well as NITEMS(), since
CHAR_BIT == 1.  However, equivalent wide-character functions need
NITEMS(), which is semantically more appropriate, and also safer (it
cannot be applied to pointers).

Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agostring_copying.7: EXAMPLES: Update stpecpy() example
Alejandro Colomar [Sun, 17 Dec 2023 12:41:22 +0000 (13:41 +0100)] 
string_copying.7: EXAMPLES: Update stpecpy() example

The function was changed recently to return NULL on truncation; update
the example of use accordingly.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agostring_copying.7: stpecpy(): Reimplement as a wrapper of strtcpy()
Alejandro Colomar [Fri, 15 Dec 2023 14:25:36 +0000 (15:25 +0100)] 
string_copying.7: stpecpy(): Reimplement as a wrapper of strtcpy()

Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agostring_copying.7: stpecpy(): Return NULL on truncation
Alejandro Colomar [Fri, 15 Dec 2023 14:18:15 +0000 (15:18 +0100)] 
string_copying.7: stpecpy(): Return NULL on truncation

This makes it simpler to test the return value, and since it sets errno
to find out the reason, we don't need a complex return value.

Now that (dst == end) shouldn't happen, use ENOBUFS to report that
error.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agostring_copying.7: stpecpy(), strtcpy(): Set errno on failure
Alejandro Colomar [Fri, 15 Dec 2023 13:52:58 +0000 (14:52 +0100)] 
string_copying.7: stpecpy(), strtcpy(): Set errno on failure

Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agoswapon.2: Adjust decreased value under CONFIG_PTE_MARKER
Yang Xu [Tue, 5 Dec 2023 06:30:17 +0000 (01:30 -0500)] 
swapon.2: Adjust decreased value under CONFIG_PTE_MARKER

Since linux 5.19[1], MAX_SWAPFILES will be futher decreased
1 if kernel built with CONFIG_PTE_MARKER.

Link: [1] <https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/include/linux/swap.h?id=679d10331>
Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agoswapon.2: Adjust decreased value under CONFIG_MIGRATION
Yang Xu [Tue, 5 Dec 2023 06:30:16 +0000 (01:30 -0500)] 
swapon.2: Adjust decreased value under CONFIG_MIGRATION

Since Linux 5.19[1], the limit is decreased by 3 instead of 2.

Link: [1] <https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/include/linux/swap.h?id=6c287605f>
Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agoscanf.3: BUGS: It's impossible to know how many characters were consumed
Alejandro Colomar [Sat, 9 Dec 2023 12:35:19 +0000 (13:35 +0100)] 
scanf.3: BUGS: It's impossible to know how many characters were consumed

Suggested-by: Zack Weinberg <zack@owlfolio.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agoscanf.3, sscanf.3: These functions scan formatted input
Alejandro Colomar [Sat, 9 Dec 2023 11:50:22 +0000 (12:50 +0100)] 
scanf.3, sscanf.3: These functions scan formatted input

Suggested-by: Lee Griffiths <poddster@gmail.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agombind.2: Add mode flag MPOL_F_NUMA_BALANCING
Yafang Shao [Fri, 8 Dec 2023 09:05:53 +0000 (09:05 +0000)] 
mbind.2: Add mode flag MPOL_F_NUMA_BALANCING

In Linux Kernel 5.12, a new mode flag, MPOL_F_NUMA_BALANCING, was
added to set_mempolicy() to optimize the page placement among the
NUMA nodes with the NUMA balancing mechanism even if the memory of
the applications is bound with MPOL_BIND.

In Linux Kernel 5.15, this mode flag was extended to mbind(2). Let's
also add man-page for mbind(2). It is copied from set_mempoicy(2)
man-page with subtle modifications.

Related kernel commits:
bda420b985054a3badafef23807c4b4fa38a3dff
6d2aec9e123bb9c49cb5c7fc654f25f81e688e8c

Suggested-by: "Huang, Ying" <ying.huang@intel.com>
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
Cc: "Huang, Ying" <ying.huang@intel.com>
Cc: Michael Kerrisk <mtk.manpages@gmail.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agoscanf.3: CAVEATS: Trailing text cannot be checked
Alejandro Colomar [Sat, 9 Dec 2023 11:06:45 +0000 (12:06 +0100)] 
scanf.3: CAVEATS: Trailing text cannot be checked

scanf("%d foo");

It is impossible to know if scanf(3) consumed " foo" or not.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agoscanf.3: CAVEATS: These functions don't distinguish newlines easily
Alejandro Colomar [Sat, 9 Dec 2023 10:35:25 +0000 (11:35 +0100)] 
scanf.3: CAVEATS: These functions don't distinguish newlines easily

One could use "%*1[\n]" for specifying a newline, and "%*[ \t] for other
white space.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agostrtol.3: Clarify that the base should be tested beforehand, if at all
Alejandro Colomar [Wed, 6 Dec 2023 21:26:04 +0000 (22:26 +0100)] 
strtol.3: Clarify that the base should be tested beforehand, if at all

Normally, the base need not be tested, and the only interesting errno
value should be ERANGE.

If the base needs to be tested, it should be tested in a call that
would not otherwise fail.  Otherwise, it would be easy to trigger
Undefined Behavior.  Consider the following example:

errno = 0;
val = strtol("foo", &end, -42);

There's no portable way to know if the call failed due to the string or
the base.

Cc: Matthew House <mattlloydhouse@gmail.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agosscanf.3: Remove term 'deprecated', and expand BUGS
Alejandro Colomar [Wed, 6 Dec 2023 14:36:51 +0000 (15:36 +0100)] 
sscanf.3: Remove term 'deprecated', and expand BUGS

Several programmers have been confused about this use of 'deprecated'.

Also, maximum field width can be used with these fields to mitigate the
problem.  Still, it's only a mitigation, since it limits the number of
characters read, but that means an input of LONG_MAX+1 --which takes up
the same number of characters than LONG_MAX-- would still cause UB; or
one can limit that to well below the limit of UB, but then it
artificially invalidates valid input.  No good way to avoid UB with
sscanf(3), but it's not necessarily bad with trusted input (and
strtol(3) isn't the panacea either: it avoids UB, but error checking is
hard; strtoi(3) is good, though, but not standard).

Link: <https://stackoverflow.com/questions/77601832/man-sscanf-d-is-deprecated-in-c-or-glibc/>
Cc: Lee Griffiths <poddster@gmail.com>
Cc: Zack Weinberg <zack@owlfolio.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agostring_copying.7: wfix
Alejandro Colomar [Mon, 4 Dec 2023 23:44:40 +0000 (00:44 +0100)] 
string_copying.7: wfix

Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agostring_copying.7: Generalize null-padded character sequences with strnlen(3)
Alejandro Colomar [Mon, 4 Dec 2023 23:42:07 +0000 (00:42 +0100)] 
string_copying.7: Generalize null-padded character sequences with strnlen(3)

Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agostrncat.3: Clarify that it terminates the string
Alejandro Colomar [Mon, 4 Dec 2023 23:04:25 +0000 (00:04 +0100)] 
strncat.3: Clarify that it terminates the string

Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agostring_copying.7: Be consistent in the use of null byte and null character
Alejandro Colomar [Mon, 4 Dec 2023 22:41:08 +0000 (23:41 +0100)] 
string_copying.7: Be consistent in the use of null byte and null character

Null character, for the terminating character of a string.
Null byte, for the padding.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agostring_copying.7: Don't say 'size' when 'len' is meant
Alejandro Colomar [Mon, 4 Dec 2023 18:06:58 +0000 (19:06 +0100)] 
string_copying.7: Don't say 'size' when 'len' is meant

Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agostring_copying.7: Say 'known-length' for character sequences whose length is known
Alejandro Colomar [Mon, 4 Dec 2023 18:03:07 +0000 (19:03 +0100)] 
string_copying.7: Say 'known-length' for character sequences whose length is known

Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agostring_copying.7: Don't say 'width' when 'size' is meant
Alejandro Colomar [Mon, 4 Dec 2023 18:00:41 +0000 (19:00 +0100)] 
string_copying.7: Don't say 'width' when 'size' is meant

Reported-by: Paul Eggert <eggert@cs.ucla.edu>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agostring_copying.7: RETURN VALUE: Remove some confusing text about stpncpy(3)
Alejandro Colomar [Mon, 4 Dec 2023 13:02:21 +0000 (14:02 +0100)] 
string_copying.7: RETURN VALUE: Remove some confusing text about stpncpy(3)

That text could lead someone to think that it's possible to check
truncation from the return value, but it isn't.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agostring_copying.7: Consistently list strtcpy() after stpecpy()
Alejandro Colomar [Mon, 4 Dec 2023 12:58:53 +0000 (13:58 +0100)] 
string_copying.7: Consistently list strtcpy() after stpecpy()

And put it next to strlcpy(3bsd), which is very similar to strtcpy().

Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agostring_copying.7: stpecpy() and strtcpy() don't exist in man3
Alejandro Colomar [Mon, 4 Dec 2023 12:50:13 +0000 (13:50 +0100)] 
string_copying.7: stpecpy() and strtcpy() don't exist in man3

Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agostring_copying.7: Use fwrite(3) to print character sequences
Alejandro Colomar [Mon, 4 Dec 2023 12:43:49 +0000 (13:43 +0100)] 
string_copying.7: Use fwrite(3) to print character sequences

Suggested-by: Paul Eggert <eggert@cs.ucla.edu>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agostring_copying.7: tfix
Alejandro Colomar [Mon, 4 Dec 2023 12:39:00 +0000 (13:39 +0100)] 
string_copying.7: tfix

Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agostring_copying.7: Use real examples with utmp(5)
Alejandro Colomar [Mon, 4 Dec 2023 12:26:42 +0000 (13:26 +0100)] 
string_copying.7: Use real examples with utmp(5)

For the functions that are designed to be used with utmp(5) or similar
APIs, use utmp(5) in the example, which results in a clearer example,
and also more realistic.  It better clarifies how these functions are to
be used.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agostrncat.3: Fix return value of possible implementation
Alejandro Colomar [Mon, 4 Dec 2023 11:58:31 +0000 (12:58 +0100)] 
strncat.3: Fix return value of possible implementation

Accidentally, I changed the return while changing something else.  Fix it.

Fixes: 790795ec4e5e ("strncat.3: Write the null byte with stpcpy(3)")
Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agostring_copying.7: Improve strncat(3) example
Alejandro Colomar [Sun, 3 Dec 2023 23:33:46 +0000 (00:33 +0100)] 
string_copying.7: Improve strncat(3) example

Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agostring_copying.7: Reimplement stpecpy()
Alejandro Colomar [Sun, 3 Dec 2023 23:03:23 +0000 (00:03 +0100)] 
string_copying.7: Reimplement stpecpy()

This implementation resembles more strtcpy(), so the differences are
more visible.  Also, it has no -1's, so it's a bit easier to implement
correctly.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agostrncat.3: Write the null byte with stpcpy(3)
Alejandro Colomar [Sun, 3 Dec 2023 22:52:17 +0000 (23:52 +0100)] 
strncat.3: Write the null byte with stpcpy(3)

Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agostrncat.3: Implement strncat(3) in terms of strnul()
Alejandro Colomar [Sun, 3 Dec 2023 22:51:06 +0000 (23:51 +0100)] 
strncat.3: Implement strncat(3) in terms of strnul()

Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agostring_copying.7: Remove zustr2stp()
Alejandro Colomar [Sun, 3 Dec 2023 22:06:44 +0000 (23:06 +0100)] 
string_copying.7: Remove zustr2stp()

Instead, document how to use mempcpy(3) well in that case.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agostring_copying.7: Remove zustr2ustp()
Alejandro Colomar [Sun, 3 Dec 2023 21:57:05 +0000 (22:57 +0100)] 
string_copying.7: Remove zustr2ustp()

Instead, document how to use mempcpy(3) well in that case.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agostring_copying.7: Remove ustr2stp() and ustpcpy()
Alejandro Colomar [Sun, 3 Dec 2023 21:27:12 +0000 (22:27 +0100)] 
string_copying.7: Remove ustr2stp() and ustpcpy()

Users reported complains about having so many invented functions, and
the complexity of remembering all of them.

In these two cases, open-coding mempcpy(3) isn't so bad.  In fact, it's
quite readable.  It has the problem of type safety, since this function
accepts almost everything, but let users come up with a wrapper if they
need it; it's not like you would be calling these functions often.

Document how to use mempcpy(3) well in those cases.

Cc: "Serge E. Hallyn" <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agostring_copying.7: Fortify source of some functions
Alejandro Colomar [Sun, 3 Dec 2023 20:02:35 +0000 (21:02 +0100)] 
string_copying.7: Fortify source of some functions

By setting the terminating null byte via a stpcpy(dst, "") call, the
last byte is also protected by _FORTIFY_SOURCE.

Reported-by: "Serge E. Hallyn" <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months ago*.mk: build-book: Use sponge(1) to update the book atomically
Alejandro Colomar [Sun, 3 Dec 2023 14:10:16 +0000 (15:10 +0100)] 
*.mk: build-book: Use sponge(1) to update the book atomically

Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months ago*.mk: build-book: Add target for building the Linux Man Book
Alejandro Colomar [Fri, 1 Dec 2023 13:51:44 +0000 (14:51 +0100)] 
*.mk: build-book: Add target for building the Linux Man Book

Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agoscripts/LinuxManBook/: Simplify pipeline
Alejandro Colomar [Thu, 30 Nov 2023 23:55:11 +0000 (00:55 +0100)] 
scripts/LinuxManBook/: Simplify pipeline

Call the groff(1) pipeline only once.  This optimizes around 2 seconds,
while also simplifying the code.

This change was originally written by Deri, with some parts written by
Brian.  I took the script that Deri sent, and split it so that the
groff(1) pipeline is called from the shell script, and the Perl script
is limited to editing the man(7) pages.  This helps me understand the
process, since my understanding of Perl is very limited.  It also makes
this change smaller, so that it's less of a big-bang.

Link: <https://lore.kernel.org/linux-man/ZWkO4qPC4BxkwBNm@debian/T/#m3d453440b02dd189bc12d2e629c4026206025b40>
Co-developed-by: Deri James <deri@chuzzlewit.myzen.co.uk>
Co-developed-by: Brian Inglis <Brian.Inglis@Shaw.ca>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agostrtol.3, strtoul.3: ERRORS: Clarify that these don't set errno on success
Alejandro Colomar [Thu, 30 Nov 2023 23:05:16 +0000 (00:05 +0100)] 
strtol.3, strtoul.3: ERRORS: Clarify that these don't set errno on success

That's a guarantee made by POSIX.

Reported-by: Jakub Wilk <jwilk@jwilk.net>
Cc: Florian Weimer <fweimer@redhat.com>
Cc: Iker Pedrosa <ipedrosa@redhat.com>
Cc: Michael Kerrisk <mtk.manpages@gmail.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agoposix_memalign.3: wfix
Alejandro Colomar [Fri, 24 Nov 2023 22:09:38 +0000 (23:09 +0100)] 
posix_memalign.3: wfix

Remove superfluous words.

Suggested-by: Jonny Grant <jg@jguk.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agoposix_memalign.3: ERRORS: wfix
Alejandro Colomar [Fri, 24 Nov 2023 22:08:27 +0000 (23:08 +0100)] 
posix_memalign.3: ERRORS: wfix

Simplify, and make it consistent with malloc(3).

Suggested-by: Jonny Grant <jg@jguk.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agoscripts/LinuxManBook/: Shorten names of scripts
Alejandro Colomar [Fri, 24 Nov 2023 13:35:02 +0000 (14:35 +0100)] 
scripts/LinuxManBook/: Shorten names of scripts

Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agoscripts/LinuxManBook/prepare_linux_man_book.pl: Add new function BuildSec()
Alejandro Colomar [Fri, 24 Nov 2023 11:51:04 +0000 (12:51 +0100)] 
scripts/LinuxManBook/prepare_linux_man_book.pl: Add new function BuildSec()

The intention is to move some code from BuildPage() into this function,
reducing the complexity of that inner function.  As a side effect, just
by adding this function, I've already noticed an optimization of 0.3 s.
The reason, I guess, is that it starts processing pages without waiting
for the entire sort to complete, which reduces the latency of the script.

Cc: Deri James <deri@chuzzlewit.myzen.co.uk>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agoscripts/LinuxManBook/build_linux_man_book.sh: Call pic(1), and call it after preconv(1)
Alejandro Colomar [Thu, 23 Nov 2023 22:05:23 +0000 (23:05 +0100)] 
scripts/LinuxManBook/build_linux_man_book.sh: Call pic(1), and call it after preconv(1)

Call it, just in case we want to use in manual pages in the future.  It
doesn't hurt performance.  And call it after preconv(1), which should be
the first program in the groff(1) pipeline.

Suggested-by: Deri James <deri@chuzzlewit.myzen.co.uk>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agoproc_sys_user.5: tfix
Jakub Wilk [Wed, 22 Nov 2023 21:08:26 +0000 (22:08 +0100)] 
proc_sys_user.5: tfix

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agoproc_pid_oom_score_adj.5: tfix
Jakub Wilk [Wed, 22 Nov 2023 21:08:25 +0000 (22:08 +0100)] 
proc_pid_oom_score_adj.5: tfix

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agoproc_pid_mountinfo.5: spfix
Jakub Wilk [Wed, 22 Nov 2023 21:08:24 +0000 (22:08 +0100)] 
proc_pid_mountinfo.5: spfix

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agoproc_crypto.5: spfix
Jakub Wilk [Wed, 22 Nov 2023 21:08:23 +0000 (22:08 +0100)] 
proc_crypto.5: spfix

"Cypher" is a valid but less common spelling of "cipher".
The latter is used everywhere else, so let's use it here too.

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agopthread_key_create.3: tfix
Jakub Wilk [Wed, 22 Nov 2023 21:08:22 +0000 (22:08 +0100)] 
pthread_key_create.3: tfix

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agoCONTRIBUTING: Say it's us who recommend signing emails
Alejandro Colomar [Wed, 22 Nov 2023 21:50:34 +0000 (22:50 +0100)] 
CONTRIBUTING: Say it's us who recommend signing emails

Also link to <gnupg.org>, since they also recommend it.

Suggested-by: "G. Branden Robinson" <branden@debian.org>
Acked-by: "G. Branden Robinson" <branden@debian.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months agoscripts/LinuxManBook/prepare_linux_man_book.pl: Don't support trailing white space...
Alejandro Colomar [Wed, 22 Nov 2023 16:24:59 +0000 (17:24 +0100)] 
scripts/LinuxManBook/prepare_linux_man_book.pl: Don't support trailing white space nor \r

Signed-off-by: Alejandro Colomar <alx@kernel.org>
20 months ago*: Remove trailing white space
Alejandro Colomar [Wed, 22 Nov 2023 16:23:23 +0000 (17:23 +0100)] 
*: Remove trailing white space

Scripted change:

$ grep -rl '\s$' | xargs sed -i 's/ * * *$//g'

Signed-off-by: Alejandro Colomar <alx@kernel.org>
21 months agoscripts/LinuxManBook/build_linux_man_book.sh: Simplify groff(1) call
Alejandro Colomar [Wed, 22 Nov 2023 15:20:32 +0000 (16:20 +0100)] 
scripts/LinuxManBook/build_linux_man_book.sh: Simplify groff(1) call

We're suppressing formatted device-independent output of troff(1),
so it doesn't make sense to pass an option to gropdf(1) with -P.
We don't need the fonts either.  We don't even need groff(1), since
we're only using troff(1).

Redirect to /dev/null, instead of using -z.  It's more explicit.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
21 months agoscripts/LinuxManBook/build_linux_man_book.sh: Explicitly preprocess before calling...
Alejandro Colomar [Wed, 22 Nov 2023 15:15:25 +0000 (16:15 +0100)] 
scripts/LinuxManBook/build_linux_man_book.sh: Explicitly preprocess before calling groff(1)

Signed-off-by: Alejandro Colomar <alx@kernel.org>
21 months agoscripts/LinuxManBook/build_linux_man_book.sh: Allow running from any working directory
Alejandro Colomar [Wed, 22 Nov 2023 14:36:25 +0000 (15:36 +0100)] 
scripts/LinuxManBook/build_linux_man_book.sh: Allow running from any working directory

Signed-off-by: Alejandro Colomar <alx@kernel.org>
21 months agoscripts/LinuxManBook/build_linux_man_book.sh: Use pipes instead of temporary files
Alejandro Colomar [Wed, 22 Nov 2023 14:29:10 +0000 (15:29 +0100)] 
scripts/LinuxManBook/build_linux_man_book.sh: Use pipes instead of temporary files

It's still easy to debug, by inserting |tee /dev/tty|, but the script
is cleaner if it doesn't generate intermediary files, and it's also
faster (on my desktop computer, it goes down from 18.5 s to 16.3 s).

Signed-off-by: Alejandro Colomar <alx@kernel.org>
21 months agoCONTRIBUTING: Please sign your emails with PGP
Alejandro Colomar [Fri, 10 Nov 2023 00:10:00 +0000 (01:10 +0100)] 
CONTRIBUTING: Please sign your emails with PGP

Cc: Matthew House <mattlloydhouse@gmail.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
21 months agostpncpy.3: Rename third parameter to 'dsize'
Alejandro Colomar [Wed, 22 Nov 2023 11:32:08 +0000 (12:32 +0100)] 
stpncpy.3: Rename third parameter to 'dsize'

This better clarifies that the size is of dst.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
21 months agoscripts/LinuxManBook/build_linux_man_book.sh: License
Alejandro Colomar [Tue, 21 Nov 2023 18:52:57 +0000 (19:52 +0100)] 
scripts/LinuxManBook/build_linux_man_book.sh: License

Signed-off-by: Alejandro Colomar <alx@kernel.org>
21 months agoscripts/LinuxManBook/prepare_linux_man_book.pl: Use a helper function for building...
Alejandro Colomar [Tue, 21 Nov 2023 14:23:36 +0000 (15:23 +0100)] 
scripts/LinuxManBook/prepare_linux_man_book.pl: Use a helper function for building pages

Signed-off-by: Alejandro Colomar <alx@kernel.org>
21 months agoscripts/LinuxManBook/prepare_linux_man_book.pl: wsfix
Alejandro Colomar [Tue, 21 Nov 2023 18:44:45 +0000 (19:44 +0100)] 
scripts/LinuxManBook/prepare_linux_man_book.pl: wsfix

Signed-off-by: Alejandro Colomar <alx@kernel.org>
21 months agostpncpy.3: Reword, saying 'byte' instead of 'character'
Alejandro Colomar [Tue, 21 Nov 2023 18:29:47 +0000 (19:29 +0100)] 
stpncpy.3: Reword, saying 'byte' instead of 'character'

These functions are also used with multi-byte characters, so character
can be confusing.

Suggested-by: Paul Eggert <eggert@cs.ucla.edu>
Cowritten-by: Paul Eggert <eggert@cs.ucla.edu>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
21 months agostpncpy.3: EXAMPLES: errx(3) instead of warnx(3) if truncation occurs
Alejandro Colomar [Tue, 21 Nov 2023 18:18:48 +0000 (19:18 +0100)] 
stpncpy.3: EXAMPLES: errx(3) instead of warnx(3) if truncation occurs

Truncation is not acceptable in most cases.  Don't suggest that it's
just fine.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
21 months agostpncpy.3: EXAMPLES: Use fwrite(3) instead of printf(3)
Alejandro Colomar [Tue, 21 Nov 2023 18:15:29 +0000 (19:15 +0100)] 
stpncpy.3: EXAMPLES: Use fwrite(3) instead of printf(3)

fwrite(3) is more appropriate for printing a character sequence with
known lenght.  printf(3) has a limitation of INT_MAX, and also requires
more complex (less readable) code.

Suggested-by: Paul Eggert <eggert@cs.ucla.edu>
Cowritten-by: Paul Eggert <eggert@cs.ucla.edu>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
21 months agostpncpy.3: NAME: Clarify that these functions only pad if necessary
Alejandro Colomar [Tue, 21 Nov 2023 18:10:08 +0000 (19:10 +0100)] 
stpncpy.3: NAME: Clarify that these functions only pad if necessary

Suggested-by: Paul Eggert <eggert@cs.ucla.edu>
Cowritten-by: Paul Eggert <eggert@cs.ucla.edu>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
21 months agostpncpy.3: Optimize possible implementation of stpncpy()
Alejandro Colomar [Tue, 21 Nov 2023 17:57:19 +0000 (18:57 +0100)] 
stpncpy.3: Optimize possible implementation of stpncpy()

Don't zero twice, since it can be confusing.  Since bzero(3) returns
void, we need memset(3) here.

Reported-by: Paul Eggert <eggert@cs.ucla.edu>
Cowritten-by: Paul Eggert <eggert@cs.ucla.edu>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
21 months agostpncpy.3: SYNOPSIS: ffix
Alejandro Colomar [Tue, 21 Nov 2023 17:52:11 +0000 (18:52 +0100)] 
stpncpy.3: SYNOPSIS: ffix

Reported-by: Paul Eggert <eggert@cs.ucla.edu>
Cowritten-by: Paul Eggert <eggert@cs.ucla.edu>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
21 months agostpncpy.3: Don't say 'width' when 'size' is meant
Alejandro Colomar [Tue, 21 Nov 2023 17:50:40 +0000 (18:50 +0100)] 
stpncpy.3: Don't say 'width' when 'size' is meant

Reported-by: Paul Eggert <eggert@cs.ucla.edu>
Cowritten-by: Paul Eggert <eggert@cs.ucla.edu>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
21 months agostrncat.3: CAVEATS: wfix
Alejandro Colomar [Tue, 21 Nov 2023 16:00:22 +0000 (17:00 +0100)] 
strncat.3: CAVEATS: wfix

Signed-off-by: Alejandro Colomar <alx@kernel.org>
21 months agostrncat.3: Reword description
Alejandro Colomar [Tue, 21 Nov 2023 15:55:58 +0000 (16:55 +0100)] 
strncat.3: Reword description

While rewording, use "byte" instead of "character".  This function is
also used with multi-byte characters, so character can be confusing.

Suggested-by: Paul Eggert <eggert@cs.ucla.edu>
Cowritten-by: Paul Eggert <eggert@cs.ucla.edu>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
21 months agostrncat.3: Say that if dst isn't a string, the behavior is undefined
Alejandro Colomar [Tue, 21 Nov 2023 15:45:51 +0000 (16:45 +0100)] 
strncat.3: Say that if dst isn't a string, the behavior is undefined

Suggested-by: Paul Eggert <eggert@cs.ucla.edu>
Cowritten-by: Paul Eggert <eggert@cs.ucla.edu>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
21 months agostrncat.3: SEE ALSO: tfix
Alejandro Colomar [Tue, 21 Nov 2023 15:39:04 +0000 (16:39 +0100)] 
strncat.3: SEE ALSO: tfix

Reported-by: Paul Eggert <eggert@cs.ucla.edu>
Cowritten-by: Paul Eggert <eggert@cs.ucla.edu>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
21 months agostrncat.3: EXAMPLES: Fix name of variable
Alejandro Colomar [Tue, 21 Nov 2023 15:30:12 +0000 (16:30 +0100)] 
strncat.3: EXAMPLES: Fix name of variable

It was called maxsize, but it was really a number of elements.  And it
wasn't maximum; it was exact.

Reported-by: Paul Eggert <eggert@cs.ucla.edu>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
21 months agostrncat.3: Simplify possible implementation of strncat()
Alejandro Colomar [Tue, 21 Nov 2023 15:24:42 +0000 (16:24 +0100)] 
strncat.3: Simplify possible implementation of strncat()

Cowritten-by: Paul Eggert <eggert@cs.ucla.edu>
Signed-off-by: Alejandro Colomar <alx@kernel.org>