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

Reply via email to