delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2025/08/21/14:33:44

DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 57LIXifv1863171
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 57LIXifv1863171
X-Recipient: archive-cygwin AT delorie DOT com
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A4F41385E02A
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A4F41385E02A
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1755801210; cv=none;
b=FAIvjvHc1x+/jdxG/cxtdJvKAqnjrdp3ocgqVnkcf9o6AU8WYzT2nSRqSuxkR2OtStH/w0s+JI9I7po5Fvzat0bbBBHJTUXLznkVihUzEyWnmmmH5QL/+pAFJxDIt61Zb1cE02w/X1/S3bmy8WbwF+bi6bko19GNDGjuRFnjsgg=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1755801210; c=relaxed/simple;
bh=qKUQAl1gqiSWGFXrgSy4KoMLy7D8htPjrQSYFJzsaPk=;
h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version;
b=ma9SDqeD79wWlLgRSCxVJDX9WroZYoqo4jgU2NzwVIdt3eLfEE6liCIuexDn9mU+wvkdLVUQEhYSn1EJkGCbrqMMG3d0S08LAO1G7TEtVKPazCY08W9t92Z0yBf0qa5nZbWYIITqMLNNNJIr0tTulhX84qxNxS2czl3wiSG1ZJM=
ARC-Authentication-Results: i=1; server2.sourceware.org
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A4F41385E02A
Date: Thu, 21 Aug 2025 11:33:27 -0700 (PDT)
X-X-Sender: jeremyd AT resin DOT csoft DOT net
To: Thomas Wolff <towo AT towo DOT net>
cc: cygwin AT cygwin DOT com
Subject: Re: Runtime control per application
In-Reply-To: <0dd0529b-04e2-37db-229c-070258d17689@jdrake.com>
Message-ID: <6ecc4298-5947-d0f4-de57-8bdf8f5f37bb@jdrake.com>
References: <c34b8878-0e03-44f2-ae79-6ba51def5452 AT towo DOT net>
<0dd0529b-04e2-37db-229c-070258d17689 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 Thu, 21 Aug 2025, Jeremy Drake via Cygwin wrote:

> A potential downside that I see is that settings changes might "leak" into
> the parent process that were intended to only take effect for the child.

POC:

#include <process.h>
#include <stdio.h>
#include <unistd.h>

int main (int argc, char **argv)
{
        if (argc > 1)
        {
                const char *chargv[] = {"/bin/ln", "-s", "a", "b", NULL};
                const char *chenvp[] = {
#ifdef __MSYS__
                        "MSYS"
#else
                        "CYGWIN"
#endif
                        "=winsymlinks:sys", "PATH=/usr/bin:/bin", NULL};
                spawnve (_P_WAIT, chargv[0], chargv, chenvp);
        }
        if (symlink ("a", "c"))
                perror("symlink");
        return 0;
}

Run with no setting in MSYS or CYGWIN env var.  On Cygwin, with no args
you get "c" is a "JUNCTION" (wsl-style symlink).  With an arg, you get "b"
is a sysfile symlink and "c" is still a "JUNCTION" (wsl-style symlink).

On MSYS, with no args you get an error (assuming "a" doesn't exist)
because default is deepcopy.  With an arg, you get "b" AND "c" are sysfile
symlinks, because the env var setting effects "leaked" into the parent due
to that linked patch.

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