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

DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 55DLNe821677585
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 55DLNe821677585
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=AOne7omF
X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 290D4392510A
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1749849818;
bh=5HHYvidVAKLci3iegsOYlgjBUSM0R7IpCb/8Nhtnd7U=;
h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:
List-Help:List-Subscribe:From:Reply-To:From;
b=AOne7omFG2lA427hY5e/yYVJz+xr/X6y4j/JXgeUPib317xLuU6hiuqPyfHWKE193
4xlQhLuSjUyIq1zZvR0WkBPs3W3h++1doxAkuRf5JTvM44u2z2sQ2RATsPJqa6xkCU
fIUlxK3A4Bq3JFHfehq9fLuZel6QJtcOheTG4IgM=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E2B4F38FB67B
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org E2B4F38FB67B
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1749849792; cv=none;
b=ijBv0QQGcxguCzPLt7XO4trHjH3dHGwZaSQyf+WnfH9rl/z+p/ORvR9F6Gi6GHs5y3IB62LWZVEB1vMnQj7J+S11esLf7MBvPrRJvPqJibCc7LGKePhm+OK3sKj85JTXuIhUDdgtdaCyW7ZT6keG6rv3ohCSRGKMl6nJIi8+YJI=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1749849792; c=relaxed/simple;
bh=rT/N44Zaja0efsLAcEGcmWuVMcFNA4tCKoxDBMgPJkA=;
h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version;
b=g0zF65daTYXsN0DjE+5TWuXKxFm66LC8Qpc1omnkGBGNLt3KeIizkDPzJ0REX9lR56Q8i0o/q08CRo+2JNfIXXjf3zNiHibXuwYbjbnJG0NdRg0GxKuAZ7g4TkR1TypzJ4UiNiwtq44LB6UiSLzKgKXPieOiXWZNxyGXzyYm6EA=
ARC-Authentication-Results: i=1; server2.sourceware.org
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E2B4F38FB67B
Date: Fri, 13 Jun 2025 14:23:11 -0700 (PDT)
X-X-Sender: jeremyd AT resin DOT csoft DOT net
To: cygwin AT cygwin DOT com
Subject: posix_spawn difference from Linux
Message-ID: <35d5a3b2-e060-cb17-7e2a-75f6b6e8d0a5@jdrake.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-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>
Sender: "Cygwin" <cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com>

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 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)?

-- 
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