linux-man.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alejandro Colomar <alx@kernel.org>
To: "G. Branden Robinson" <g.branden.robinson@gmail.com>
Cc: Keith Bostic <keith@bostic.com>, Sam James <sam@gentoo.org>,
	 Joseph Myers <josmyers@redhat.com>,
	linux-man@vger.kernel.org, Mark Harris <mark.hsj@gmail.com>,
	 Nevin Liber <nevin@cplusplusguy.com>,
	JeanHeyd Meneide <phdofthehouse@gmail.com>,
	 Christopher Bazley <chris.bazley.wg14@gmail.com>,
	"Serge E. Hallyn" <serge@hallyn.com>,
	 Iker Pedrosa <ipedrosa@redhat.com>,
	"Evgeny Grin (Karlson2k)" <k2k@drgrin.dev>,
	 Kees Cook <keescook@chromium.org>,
	bug-gnulib@gnu.org, libc-alpha@sourceware.org,
	 Douglas McIlroy <douglas.mcilroy@dartmouth.edu>
Subject: Re: proposed revision to memory.h(3head) (was: on the irresponsibility of pursuing C language reform)
Date: Sun, 2 Aug 2026 02:27:38 +0200	[thread overview]
Message-ID: <am6HTtAMkEEkWjfl@devuan> (raw)
In-Reply-To: <20260801235332.vc443gozbqkqdqm5@illithid>

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

Hi Branden,

> Date: 2026-08-01 18:53:32-0500
> From: "G. Branden Robinson" <g.branden.robinson@gmail.com>
>
> At 2026-08-02T01:24:28+0200, Alejandro Colomar wrote:
> > > Date: 2026-08-02 00:44:46+0200
> > > From: Alejandro Colomar <alx@kernel.org>
> > >
> > [...]
> > > > Advocating for better usage in the documentation is a different
> > > > thing, and a good thing. The man pages can even go pretty hard,
> > > > that’s their job: “Notice the include file is string.h. That’s an
> > > > historic accident maintained for compatibility reasons; don’t let
> > > > that fool you, this function doesn’t operate on strings.”
> > > 
> > [...]
> > > I should probably expand the NOTES a little bit, to be more clear
> > > about why we ignore the standard in the SYNOPSIS.
> > 
> > I've put that text in a centralized place, in the memory.h(3head)
> > manual page:
> > 
> > 	$ MANWIDTH=64 diffman-git HEAD
> > 	--- HEAD^:man/man3head/memory.h.3
> > 	+++ HEAD:man/man3head/memory.h.3
> > 	@@ -10,6 +10,11 @@ SYNOPSIS
> > 	      #include <memory.h>
> > 	 
> > 	 DESCRIPTION
> > 	+     These functions are also provided in <string.h>, as speci‐
> > 	+     fied by ISO C.  This is a historic accident maintained for
> > 	+     compatibility reasons.  Don’t let that fool you; these
> > 	+     functions don’t necessarily operate on strings.
> > 	+
> 
> That's a heavy editorial slant.  I don't think it was a historical
> accident; it was a historical "on purpose"[1], with which you disagree.

[pasted [1] here]
> [1] As one does with "all the glue", when one doesn't want a "major
>     award" to be readily repaired...

The C89 Rationale document doesn't document this as an intentional
change (or even as a change at all).
<https://www.open-std.org/jtc1/sc22/wg14/www/C89Rationale.pdf>

I'd certainly be interested in hearing first-hand information,
if anyone has it.  Maybe Keith would be the best candidate for that.

> Here's a revision that goes a little less hard, favors active voice over
> passive, and is shorter.
> 
> 	+     ISO C mandates that <string.h> declare these functions.
> 	+     Be aware that they do not necessarily operate on strings.

I'll think about it.

> 
> > 	+STANDARDS
> > 	+     BSD.
> 
> If you're tracking SVID in the Linux man-pages project, I would guess
> that it was in the original SVID, which formalized/specified SVr2--but I
> can't find online any version of SVID older than its Fourth Edition.

Here's an online copy of SVID Issue 2:
<https://bitsavers.org/pdf/att/unix/SVID/System_V_Interface_Definition_Issue_2_Volume_1_1986.pdf>
It does indeed standardize <memory.h>.

I don't know of any copy of SVID Issue 1.

SVID is a withdrawn standard (having been superseded by the SUS/POSIX
standards, Issue 8 in the most recent revision), and thus not
appropriate for STANDARDS.  It'd be however appropriate for HISTORY.
However, the SVID 1 corresponds to SVr2 (1985), so that's actually too
late for this.  In HISTORY, I've documented this as SysV (maybe we
should coin SVr1?  It doesn't exist in standards(7), but it'd be
reasonable).

At the moment, I have it as:

	STANDARDS
	     BSD.

	HISTORY
	     SysV, 4.3BSD.

		...

Also, we don't document the SVID documents in HISTORY, because we
document the corresponding revision of SysV.

Interestingly, POSIX.1-1988 already moved everything to <string.h>
(C89 was almost finalized by then) and doesn't contain any references to
<memory.h>, as if it had never existed.
<https://nvlpubs.nist.gov/nistpubs/Legacy/FIPS/fipspub151-1.pdf>
I'd be curious to see whether XPG Issue 3 still kept <memory.h> (but
I suspect it won't, since it derives from POSIX.1-1988).
SVID Third Edition curiously removed any mentions of <memory.h>, as if
it had never existed (just like POSIx.1-1988).
<https://archive.org/details/systemvinterface0001unse/page/n149/mode/1up?q=memory.h>

(For anyone reading and wondering about the incestuous relationship of
 these old standards, here's a useful rough sketch I did some time ago):
<https://lore.kernel.org/linux-man/aWwzhLaG_aehhWOG@devuan/>

> If you care about SVID, this point may bear further research.  Matt G.
> of TUHS might have a line on older editions of SVID.

I'd be interesting to have a copy of those, for sure.  I am aware of
the copies of Issue 2 and Third Edition I linked above, but I'd
certainly be interested in a copy of Issue 1.  XPG 3 would also be nice.

> > 	+HISTORY
> > 	+     The <memory.h> header file is the original one which was
> > 	+     added in System V (1983), and was later adopted by 4.3BSD
> > 	+     (1986).  It contained the original mem* functions.
> > 	+
> > 	+     C89 didn’t standardize this header file, and instead
> > 	+     crammed all these functions in <string.h>, resulting in
> > 	+     confusing programmers about the real purpose of these
> > 	+     functions.
> 
> Again, you're going harder than you need to here.
> 
> I propose:
> 
> 	+HISTORY
> 	+     System V (1983) introduced an initial set of mem*
> 	+     functions in a <memory.h> file.  4.3BSD (1986) adopted
> 	+     them.  C89 specified them in <string.h>.

I like part of this paragraph.

> 	+     The programmer bears the burden of selecting appropriate
> 	+     functions for operations on memory buffers (which may
> 	+     contain any bytes, including nulls) versus strings (which
> 	+     null bytes terminate).

I'm not convinced.

> 
> If you like the foregoing, consider it:
> 
> Signed-off-by: G. Branden Robinson <g.branden.robinson@gmail.com>

I'll probably modify it and note it as

	Suggested-by: ...


Cheers,
Alex

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

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

  reply	other threads:[~2026-08-02  0:27 UTC|newest]

Thread overview: 85+ 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
     [not found]                   ` <CAETFuj2OwoyK9J85r2f0RoXbHbXKA4gQJ=JZ-7=QoqGcMwk0+Q@mail.gmail.com>
2026-08-01 22:44                     ` 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 [this message]
2026-08-02  1:03                             ` 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-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-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ć

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=am6HTtAMkEEkWjfl@devuan \
    --to=alx@kernel.org \
    --cc=bug-gnulib@gnu.org \
    --cc=chris.bazley.wg14@gmail.com \
    --cc=douglas.mcilroy@dartmouth.edu \
    --cc=g.branden.robinson@gmail.com \
    --cc=ipedrosa@redhat.com \
    --cc=josmyers@redhat.com \
    --cc=k2k@drgrin.dev \
    --cc=keescook@chromium.org \
    --cc=keith@bostic.com \
    --cc=libc-alpha@sourceware.org \
    --cc=linux-man@vger.kernel.org \
    --cc=mark.hsj@gmail.com \
    --cc=nevin@cplusplusguy.com \
    --cc=phdofthehouse@gmail.com \
    --cc=sam@gentoo.org \
    --cc=serge@hallyn.com \
    /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).