linux-man.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alejandro Colomar <alx@kernel.org>
To: "Arsen Arsenović" <arsen@aarsen.me>
Cc: Collin Funk <collin.funk1@gmail.com>, Sam James <sam@gentoo.org>,
	 "G. Branden Robinson" <g.branden.robinson@gmail.com>,
	"Maciej W. Rozycki" <macro@orcam.me.uk>,
	 Paul Eggert <eggert@cs.ucla.edu>,
	linux-man@vger.kernel.org, bug-gnulib@gnu.org,
	 libc-alpha@sourceware.org
Subject: The goal of the Linux man-pages project
Date: Tue, 4 Aug 2026 19:16:17 +0200	[thread overview]
Message-ID: <anIaZ8X_73ZjmYtR@devuan> (raw)
In-Reply-To: <8633wtnaw8.fsf@aarsen.me>

[-- Attachment #1: Type: text/plain, Size: 6571 bytes --]

Hi Arsen,

> Date: 2026-08-04 17:49:43+0200
> From: Arsen Arsenović <arsen@aarsen.me>
>
[...]
> >     man/man3/: Put first <string.h> in SYNOPSIS, then comment about <memory.h>
> >     
> >     This is a compromise between the fact that <string.h> is the standard
> >     header and (only slightly) most portable header file for these
> >     functions, while hinting at the fact that it might be more appropriate
> >     to use <memory.h> where possible.
> >     
> >     Remove the STANDARDS and NOTES about this, since now the SYNOPSIS
> >     contains all the necessary information.  The extra info is in
> >     memory.h(3head), which is linked to in the SYNOPSIS.
> >
> > What do you think?
> 
> Why, though?

To help guide programmers to understand these APIs, and consequentially
be able to write better code.  That's the goal of this project.  It's
the Linux Programmer's Manual, and its purpose is that programmers on
a Linux system are able to write correct programs.

The purpose of this documentation is not, and was never supposed to be,
a technical specification of the implementation.

Branden asked me yesterday:

| Date: 2026-08-03 11:09:02-0500
| From: "G. Branden Robinson" <g.branden.robinson@gmail.com>
| Message-ID: <20260803160902.5edjmpxaqr5uudbu@illithid>
|
| What is the overall mission of the Linux man-pages project as you
| conceive it?

Here's my reply.

A programmer should be able to write correct code.

A piece of documentation that describes an API in detail --as if it were
reverse-engineering it from its binary code-- but doesn't tell me how
to use it correctly is useless.

Let's take an example.  Here's the description of strncpy(3) as of
man-pages-5.05 (right before my first patch to the project):

     The strcpy() function copies the string pointed to by src,
     including  the terminating null byte ('\0'), to the buffer
     pointed to by dest.  The strings may not overlap, and  the
     destination  string  dest  must be large enough to receive
     the copy.  Beware of buffer overruns!  (See BUGS.)

     The strncpy() function is similar, except that at  most  n
     bytes  of  src  are  copied.  Warning: If there is no null
     byte among the first n bytes of src, the string placed  in
     dest will not be null‐terminated.

     If  the length of src is less than n, strncpy() writes ad‐
     ditional null bytes to dest to ensure that a  total  of  n
     bytes are written.

Okay, we have an algorithm.  I'm sure you can implement strncpy(3) from
that description.  But what is it useful for?  Why would I want to call
it?  How do I even call it?

The page even continues with an actual implementation.

     A simple implementation of strncpy() might be:

         char *
         strncpy(char *dest, const char *src, size_t n)
         {
             size_t i;

             for (i = 0; i < n && src[i] != '\0'; i++)
                 dest[i] = src[i];
             for ( ; i < n; i++)
                 dest[i] = '\0';

             return dest;
         }

Well, if someone misunderstood the reverse-engineered description, now
they should have it clear.  Still, as a user, I don't give a shit about
any of the text I've read.  What is this good for?  How do I use it?
Should I use it at all?  This is the 'Linux Programmer’s Manual', as the
page says at the top, but as a programmer, I don't know what to do with
this.  How am I supposed to write programs in a Linux system?

Branden continued with more questions:

| Take some time to draft one, if you haven't already and I missed it.
| Here are some points you might consider.
|
| *  Is delivery of factual information more or less important than
|    advocacy of correct methods and accepted idioms?

I continue with my reply:

Factual information is useless if it can't be interpreted.  The only
thing that matters is that the programmer is able to, well, program.
Of course, the program should be correct, and as safe/simple as
possible/reasonable.

'Accepted' idioms is something that doesn't strike me as an
unconditionally good thing.  Back in the times of Galileo, it was
accepted that the Earth didn't move.  Good documentation might need to
exceptionally reject accepted idioms, even if most of the time they'll
be good.

So, maybe correct methods would be the priority, with accepted idioms
and factual information being secondary to it.

> I think that, in the thread, it was already demonstrated (by Bionic
> having an empty memory.h for a time) that nobody includes <memory.h> on
> its own and expects to see these functions.

This is part of 'factual information', which is only a secondary goal of
this documentation project, as stated above.

The purpose of this change is to help form a mental model of how these
memory and string functions relate to each other, and how they behave.

> (not that Bionic is that
> widely-used; a better test would be checking something like Debian
> codesearch)
> 
> As I've noted before, what header provides what declaration is also
> largely inconsequential.

If it is largely inconsequential, I expect this change shouldn't be as
controversial as it seemed to be.

> So, the only effect of this can be to create new cases where <memory.h>
> is included, for no gain.

I don't agree with the 'for no gain' claim.  But yes, the first part of
the sentence is certainly true.

> It doesn't really matter that memory.h is only slightly less portable,
> IMO.  It is unused, to the point where Autoconf recommends not using it,
> and no longer bothers checking whether 'mem*' functions are also present
> in string.h.

It doesn't really matter that it is unused.  What matters is that it can
be used just fine, and will help --IMO-- understand these functions
better.

> Is suddenly reviving a dead header to copy a few declarations of
> functions well known to be part of string.h into it not just unneeded
> churn?  Especially as program code would (nearly?) always need to do:
> 
>   #include <string.h>
>   #ifdef HAVE_MEMORY_H
>   # include <memory.h>
>   #endif

Are there any systems without <memory.h>?  We've been seeing in this
thread that most systems have it.  Even Microsoft has it.  I bet most
programs can live without that conditional.

I'd say most programs would be portable enough with this:

	#include <string.h>
	#include <memory.h>


Have a lovely day!
Alex

-- 
<https://www.alejandro-colomar.es>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2026-08-04 17:16 UTC|newest]

Thread overview: 139+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-31 21:18 [PATCH 0/2] alx-0097r1 - <memory.h>, the legitimate header for memcpy(3) et al Alejandro Colomar
2026-07-31 21:18 ` [PATCH 1/2] man/man3/{mem,strn}*(): SYNOPSIS, STANDARDS: Document these as provided by <memory.h> Alejandro Colomar
2026-07-31 21:23   ` Joseph Myers
2026-07-31 21:28     ` Alejandro Colomar
2026-07-31 21:54       ` Sam James
2026-07-31 22:18         ` Alejandro Colomar
2026-08-01  0:12           ` Alejandro Colomar
2026-08-01 14:43           ` Sam James
2026-07-31 21:51     ` on the irresponsibility of pursuing C language reform (was: [PATCH 1/2] man/man3/{mem,strn}*(): SYNOPSIS, STANDARDS: Document these as provided by <memory.h>) G. Branden Robinson
2026-07-31 21:59       ` on the irresponsibility of pursuing C language reform Sam James
2026-07-31 22:24         ` G. Branden Robinson
2026-07-31 23:19           ` Alejandro Colomar
2026-08-01 14:52           ` Sam James
2026-08-01 12:01         ` Alejandro Colomar
2026-08-01 12:04           ` Alejandro Colomar
2026-08-01 14:38           ` Sam James
2026-08-01 15:15             ` Alejandro Colomar
2026-08-01 16:10               ` Sam James
2026-08-01 17:09                 ` Alejandro Colomar
2026-08-01 21:34                   ` G. Branden Robinson
2026-08-01 22:22                     ` Alejandro Colomar
2026-08-01 22:26                       ` Alejandro Colomar
2026-08-03 13:42                       ` Joseph Myers
2026-08-03 14:22                         ` Alejandro Colomar
2026-08-03 14:38                         ` on glibc forking/reclaiming its man pages (was: on the irresponsibility of pursuing C language reform) G. Branden Robinson
2026-08-03 14:44                           ` Joseph Myers
2026-08-03 15:18                             ` G. Branden Robinson
     [not found]                   ` <CAETFuj2OwoyK9J85r2f0RoXbHbXKA4gQJ=JZ-7=QoqGcMwk0+Q@mail.gmail.com>
2026-08-01 22:44                     ` on the irresponsibility of pursuing C language reform Alejandro Colomar
2026-08-01 23:24                       ` Alejandro Colomar
2026-08-01 23:53                         ` proposed revision to memory.h(3head) (was: on the irresponsibility of pursuing C language reform) G. Branden Robinson
2026-08-02  0:27                           ` Alejandro Colomar
2026-08-02  1:03                             ` Alejandro Colomar
2026-08-03  0:47                             ` proposed revision to memory.h(3head) Alejandro Colomar
2026-08-03 17:58                               ` Mark Harris
2026-08-03 18:47                                 ` Alejandro Colomar
2026-08-03 20:14                                   ` Mark Harris
2026-08-03 23:36                                     ` Alejandro Colomar
2026-08-04  3:25                                       ` Mark Harris
2026-08-03 14:10                             ` proposed revision to memory.h(3head) (was: on the irresponsibility of pursuing C language reform) Joseph Myers
2026-08-03 14:31                               ` Alejandro Colomar
2026-08-02 12:52                         ` on the irresponsibility of pursuing C language reform Steve Summit
2026-08-02 13:17                           ` Alejandro Colomar
2026-08-02 13:45                             ` Steve Summit
2026-08-02 14:11                               ` Alejandro Colomar
2026-08-02 19:28                                 ` Paul Eggert
2026-08-02 20:31                                   ` Alejandro Colomar
2026-08-03  3:28                                     ` Paul Eggert
2026-08-03 11:39                                       ` Alejandro Colomar
2026-08-03 13:23               ` Joseph Myers
2026-08-01 20:18             ` G. Branden Robinson
2026-08-01 20:42               ` Alejandro Colomar
2026-08-01 20:45                 ` Alejandro Colomar
2026-08-01 20:52                 ` G. Branden Robinson
2026-08-01 21:12                   ` Alejandro Colomar
2026-07-31 22:10       ` on the irresponsibility of pursuing C language reform (was: [PATCH 1/2] man/man3/{mem,strn}*(): SYNOPSIS, STANDARDS: Document these as provided by <memory.h>) Joseph Myers
2026-07-31 22:21         ` Alejandro Colomar
2026-07-31 22:28           ` [PATCH 1/2] man/man3/{mem,strn}*(): SYNOPSIS, STANDARDS: Document these as provided by <memory.h> G. Branden Robinson
2026-07-31 22:42           ` on the irresponsibility of pursuing C language reform (was: [PATCH 1/2] man/man3/{mem,strn}*(): SYNOPSIS, STANDARDS: Document these as provided by <memory.h>) Joseph Myers
2026-07-31 22:52             ` Alejandro Colomar
2026-07-31 23:11               ` Joseph Myers
2026-07-31 23:32                 ` G. Branden Robinson
2026-08-01 12:39                   ` Alejandro Colomar
2026-08-01 14:26                   ` Christopher Bazley
2026-08-01 15:29                     ` Alejandro Colomar
2026-07-31 23:45                 ` on the irresponsibility of pursuing C language reform (was: " Alejandro Colomar
2026-08-01 12:39                   ` Douglas McIlroy
2026-08-01 19:54                     ` G. Branden Robinson
2026-08-01 20:35                       ` Alejandro Colomar
2026-07-31 23:08             ` [PATCH 1/2] man/man3/{mem,strn}*(): SYNOPSIS, STANDARDS: Document these as provided by <memory.h> G. Branden Robinson
2026-07-31 23:28               ` Joseph Myers
2026-07-31 23:57                 ` G. Branden Robinson
2026-08-01  0:06                   ` Alejandro Colomar
2026-07-31 22:05     ` Alejandro Colomar
2026-07-31 22:16       ` Joseph Myers
2026-07-31 22:33         ` Alejandro Colomar
2026-07-31 23:48     ` [PATCH 1/2] man/man3/{mem, strn}*(): " Collin Funk
2026-07-31 23:52       ` Alejandro Colomar
2026-08-01  0:01         ` Alejandro Colomar
2026-08-04  2:35         ` Thorsten Glaser
2026-07-31 21:19 ` [PATCH 2/2] man/man*/{string.3,memory.h.3head}: Move functions to a new page memory.h(3head) Alejandro Colomar
2026-07-31 21:20 ` [PATCH 0/2] alx-0097r1 - <memory.h>, the legitimate header for memcpy(3) et al Alejandro Colomar
2026-08-01  0:25 ` [PATCH v2] man/man3/mem*(): SYNOPSIS: Document non-standard mem*() functions as provided by <memory.h> Alejandro Colomar
2026-08-01 22:22   ` Bruno Haible
2026-08-01 22:38     ` Alejandro Colomar
2026-08-01 22:55       ` Bruno Haible
2026-08-01 23:10         ` Alejandro Colomar
2026-08-01 23:26           ` Collin Funk
2026-08-01 23:34             ` Alejandro Colomar
2026-08-01 23:29           ` Paul Eggert
2026-08-01 23:36             ` Alejandro Colomar
2026-08-02  0:08               ` the Linux man-pages as an educational tool (was: [PATCH v2] man/man3/mem*(): SYNOPSIS: Document non-standard mem*() functions as provided by <memory.h>) G. Branden Robinson
2026-08-02  0:45                 ` Alejandro Colomar
2026-08-02  1:04                   ` the Linux man-pages as an educational tool Collin Funk
2026-08-02  1:15                     ` G. Branden Robinson
2026-08-02  1:15                     ` Alejandro Colomar
2026-08-02  1:49                       ` Collin Funk
2026-08-02 11:29                         ` Alejandro Colomar
2026-08-02 11:47                           ` Alejandro Colomar
2026-08-02 12:04                       ` Alejandro Colomar
2026-08-02 21:23                       ` Maciej W. Rozycki
2026-08-02 21:34                         ` Alejandro Colomar
2026-08-02 23:08                           ` Arsen Arsenović
2026-08-02 23:10                             ` G. Branden Robinson
2026-08-02 23:27                               ` Collin Funk
2026-08-02 23:37                                 ` Alejandro Colomar
2026-08-02 23:41                                   ` Alejandro Colomar
2026-08-02 23:42                                     ` Alejandro Colomar
2026-08-03  1:12                                       ` Alejandro Colomar
2026-08-03  2:09                                       ` G. Branden Robinson
2026-08-03 12:21                                         ` Alejandro Colomar
2026-08-03 14:05                                           ` Sam James
2026-08-03 14:40                                             ` Alejandro Colomar
2026-08-03 15:34                                               ` G. Branden Robinson
2026-08-03 16:11                                                 ` Alejandro Colomar
2026-08-03 16:15                                               ` Sam James
2026-08-03 16:43                                                 ` Alejandro Colomar
2026-08-03 10:28                                   ` the Linux man-pages as an educational tool... and a bit about C Αγαθοκλής Χατζημανίκας
2026-08-03 14:03                                   ` the Linux man-pages as an educational tool Sam James
2026-08-03 14:28                                     ` Alejandro Colomar
2026-08-04  2:39                                     ` Collin Funk
2026-08-04 12:12                                       ` Alejandro Colomar
2026-08-04 15:49                                         ` Arsen Arsenović
2026-08-04 17:16                                           ` Alejandro Colomar [this message]
2026-08-04 20:04                                             ` The goal of the Linux man-pages project DJ Delorie
2026-08-04 20:14                                             ` [GNULIB] " Αγαθοκλής Χατζημανίκας
2026-08-03 16:09                                   ` on project management (was: the Linux man-pages as an educational tool) G. Branden Robinson
2026-08-03 19:46                                     ` enh
2026-08-03 21:09                                       ` on project management Arsen Arsenović
2026-08-02 23:30                               ` the Linux man-pages as an educational tool Alejandro Colomar
2026-08-03 11:00                               ` Arsen Arsenović
2026-08-03 16:07                           ` Jeffrey Walton
2026-08-03 16:17                             ` Alejandro Colomar
2026-08-03 19:31                           ` Joseph Myers
2026-08-03 19:47                             ` Alejandro Colomar
2026-08-03 13:51                         ` When and why realloc(,0) was broken in glibc in 1999 Alejandro Colomar
2026-08-03 12:35                       ` the Linux man-pages as an educational tool Bruno Haible
2026-08-03 13:07                         ` Alejandro Colomar
2026-08-03 19:45                           ` Joseph Myers
2026-08-03 19:50                             ` Alejandro Colomar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=anIaZ8X_73ZjmYtR@devuan \
    --to=alx@kernel.org \
    --cc=arsen@aarsen.me \
    --cc=bug-gnulib@gnu.org \
    --cc=collin.funk1@gmail.com \
    --cc=eggert@cs.ucla.edu \
    --cc=g.branden.robinson@gmail.com \
    --cc=libc-alpha@sourceware.org \
    --cc=linux-man@vger.kernel.org \
    --cc=macro@orcam.me.uk \
    --cc=sam@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).