Re: posix_spawn(3): explain that handling NULL envp is an extension

2023-06-26 Thread Theo Buehler
> -.An \ Shouten Aq Mt e...@freebsd.org
> +.An \ Schouten Aq Mt e...@freebsd.org

Committed. Thanks



Re: posix_spawn(3): explain that handling NULL envp is an extension

2023-06-26 Thread Todd C . Miller
On Mon, 26 Jun 2023 17:24:38 +0200, Paul de Weerd wrote:

> Having never heard of posix_spawn(3), I read the full manpage and
> (besides wondering "what's the point"), found that it's misspelled Ed
> Schouten's name:

Yes, that should be fixed.

 - todd



Re: posix_spawn(3): explain that handling NULL envp is an extension

2023-06-26 Thread Paul de Weerd
Having never heard of posix_spawn(3), I read the full manpage and
(besides wondering "what's the point"), found that it's misspelled Ed
Schouten's name:

Index: posix_spawn.3
===
RCS file: /cvs/src/lib/libc/gen/posix_spawn.3,v
retrieving revision 1.10
diff -u -p -r1.10 posix_spawn.3
--- posix_spawn.3   26 Jun 2023 06:58:18 -  1.10
+++ posix_spawn.3   26 Jun 2023 15:17:07 -
@@ -132,4 +132,4 @@ These functions were ported from
 to
 .Ox 5.2 .
 .Sh AUTHORS
-.An \ Shouten Aq Mt e...@freebsd.org
+.An \ Schouten Aq Mt e...@freebsd.org

I checked the rest of the tree, no other occurences of 'Ed Shouten'
can be found.

Paul

On Sun, Jun 25, 2023 at 07:07:33PM -0300, Lucas de Sena wrote:
| The manual already describes how posix_spawn(3) behaves when passing it
| a NULL envp, but does not make it clear that it is an OpenBSD extension:
| 
| > If envp is NULL, the environment is passed unchanged from the parent
| > process.
| 
| That differs from GNU/Linux, for example, where a NULL envp gives the
| child an empty environment rather than a copy.
| 
| 
| Index: posix_spawn.3
| ===
| RCS file: /cvs/src/lib/libc/gen/posix_spawn.3,v
| retrieving revision 1.9
| diff -u -p -r1.9 posix_spawn.3
| --- posix_spawn.3 17 Oct 2017 22:47:58 -  1.9
| +++ posix_spawn.3 25 Jun 2023 21:38:47 -
| @@ -122,6 +122,10 @@ with exit status 127.
|  .Sh STANDARDS
|  Both functions conform to
|  .St -p1003.1-2001 .
| +.Pp
| +The handling of NULL
| +.Fa envp
| +is an extension to that standard.
|  .Sh HISTORY
|  These functions were ported from
|  .Fx
| 

-- 
>[<++>-]<+++.>+++[<-->-]<.>+++[<+
+++>-]<.>++[<>-]<+.--.[-]
 http://www.weirdnet.nl/ 



Re: posix_spawn(3): explain that handling NULL envp is an extension

2023-06-26 Thread Lucas de Sena
On 2023-06-26, Marc Espie wrote:
> Note that a NULL environment is undefined behavior according to POSIX.
> If you read the OpenGroup description, it very clearly states that
> envp is a pointer to a NULL terminated array.
> 
> Does GNU/Linux at least document that passing a NULL pointer means no
> environment for them ?

No, GNU/Linux does not document that.  Neither NetBSD (which behaves
like GNU/Linux on NULL envp) or FreeBSD (which behaves like OpenBSD)
document that behavior.  All three systems do check envp, handling it
as a special case when NULL (either by passing the child an empty
environment or a copy of the parent's environment), but none document
such behavior.

But, since OpenBSD does document such behavior, it is necessary to say
that it is a special case not covered by the standard.  Either do that
or, like the others, do not document it at all.



Re: posix_spawn(3): explain that handling NULL envp is an extension

2023-06-26 Thread Marc Espie
On Sun, Jun 25, 2023 at 07:07:33PM -0300, Lucas de Sena wrote:
> The manual already describes how posix_spawn(3) behaves when passing it
> a NULL envp, but does not make it clear that it is an OpenBSD extension:
> 
> > If envp is NULL, the environment is passed unchanged from the parent
> > process.
> 
> That differs from GNU/Linux, for example, where a NULL envp gives the
> child an empty environment rather than a copy.

Note that a NULL environment is undefined behavior according to POSIX.
If you read the OpenGroup description, it very clearly states that
envp is a pointer to a NULL terminated array.

Does GNU/Linux at least document that passing a NULL pointer means no
environment for them ?



Re: posix_spawn(3): explain that handling NULL envp is an extension

2023-06-26 Thread Jason McIntyre
On Sun, Jun 25, 2023 at 07:07:33PM -0300, Lucas de Sena wrote:
> The manual already describes how posix_spawn(3) behaves when passing it
> a NULL envp, but does not make it clear that it is an OpenBSD extension:
> 
> > If envp is NULL, the environment is passed unchanged from the parent
> > process.
> 
> That differs from GNU/Linux, for example, where a NULL envp gives the
> child an empty environment rather than a copy.
> 

fixed, thanks!
jmc

> 
> Index: posix_spawn.3
> ===
> RCS file: /cvs/src/lib/libc/gen/posix_spawn.3,v
> retrieving revision 1.9
> diff -u -p -r1.9 posix_spawn.3
> --- posix_spawn.3 17 Oct 2017 22:47:58 -  1.9
> +++ posix_spawn.3 25 Jun 2023 21:38:47 -
> @@ -122,6 +122,10 @@ with exit status 127.
>  .Sh STANDARDS
>  Both functions conform to
>  .St -p1003.1-2001 .
> +.Pp
> +The handling of NULL
> +.Fa envp
> +is an extension to that standard.
>  .Sh HISTORY
>  These functions were ported from
>  .Fx
>