www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2025/06/13/17:25:50

DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 55DLPorq1678283
Authentication-Results: delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com
Authentication-Results: delorie.com; spf=pass smtp.mailfrom=cygwin.com
DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 55DLPorq1678283
Authentication-Results: delorie.com;
dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=x3pslUFj
X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8858639DA8A2
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1749849949;
bh=Z/uRljQ1/dqboTseVHlHB/BiiiHyJXq7d4NrSREaJI8=;
h=Date:To:Subject:In-Reply-To:References:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:
From;
b=x3pslUFjhGEJeQAXeRUtht6KHv5PZ+n+b8XDXT0iI1vALe339hjumhSUSQMSVkd8q
LA1a5IkGIU/TMcNFBk0b8tkmy6o5j8q1Pn9ma38hYQkXfn2gEqMe909PzGrs7+DuQQ
Gs4+s3AvA3GQioXAYlmQKnqLDrs+tjkK7XNwsBq0=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DAEBE388FA19
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org DAEBE388FA19
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1749849917; cv=none;
b=hIgm8tAvC/whg18iI3M2J0SAKVsXtCim/Hyfy9XP4fhVjazSa+ElVChgGUv4WekXhiEKKVe09KOV/PfbNbNqStq88gU73X3H8XnRdzYyaZ1xYGaJzzba8VN/+FeYs8vdhbZGswJUEpbBqff/BVFBQsh5QkdeHMTshcS2TZVCXcM=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1749849917; c=relaxed/simple;
bh=RSASCXPtRHOILBlSaGQdSGv1EYlAYvjYaEX7wDJe2Hg=;
h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version;
b=Jyp7VMJPzVx3AxFxLFeQwjuVzcpnshqSaOfP7McufGCLl/DIvF62agP0kM1PnOduFgO5comxhwvBEa9h3/F891aXVTumCP6ESLUKVDZvZG0OyxqwFac0VEQ0si+BmiUTd6ORiqHrU/HrFs19c6MY9YukmYDNa5rMH3pfpQHGAKM=
ARC-Authentication-Results: i=1; server2.sourceware.org
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DAEBE388FA19
Date: Fri, 13 Jun 2025 14:25:17 -0700 (PDT)
X-X-Sender: jeremyd AT resin DOT csoft DOT net
To: cygwin AT cygwin DOT com
Subject: Re: posix_spawn difference from Linux
In-Reply-To: <35d5a3b2-e060-cb17-7e2a-75f6b6e8d0a5@jdrake.com>
Message-ID: <bb65b74c-3216-0a61-c29d-6623395bb8bb@jdrake.com>
References: <35d5a3b2-e060-cb17-7e2a-75f6b6e8d0a5 AT jdrake DOT com>
MIME-Version: 1.0
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.30
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Jeremy Drake via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Jeremy Drake <cygwin AT jdrake DOT com>
Errors-To: cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com>

On Fri, 13 Jun 2025, Jeremy Drake wrote:

> I am working on some posix_spawn tests for the new stc repository [1], and
> making sure they behave the same between Cygwin and Linux.  I found one
> case (so far) which does not: passing NULL for argument "envp" to
> posix_spawn.
>
> In Cygwin, this results in the child inheriting the environment from the
> caller (same as passing "environ"), but on Linux this results in the child
> getting an empty environment (same as passing a char *envp[] = {NULL}).
>
> The Open Group doc on posix_spawn[2] doesn't seem to say anything about
> the potential for envp being NULL, but does mention
>
> > For the Ada language binding for Start_Process to be implemented with
> > posix_spawn(), that binding would need to explicitly pass an empty
> > signal mask and the parent's environment to posix_spawn() whenever the
> > caller of Start_Process allowed these arguments to default, since
> > posix_spawn() does not provide such defaults.
>
> That at least implies that passing NULL does not default to using the
> parent's environment.
>
> Thoughts?  Is this a bug in Cygwin, or "undefined behavior" that it's
> perfectly within its rights to do whatever it feels like in response
> (empty environment or inherited environment, or crash every second
> Tuesday)?

Oops, I forgot my footnote links:

[1]: https://cygwin.com/cgit/cygwin-apps/stc/
[2]: https://pubs.opengroup.org/onlinepubs/007904975/functions/posix_spawn.html

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019