You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Process.currentDirectoryURL is implemented on top of chdir in swift-corelibs-foundation. As a result, using multiple, unrelated Process objects from multiple threads in Linux that have this property set can cause wildly unexpected outcomes, leaving the working directory of the current process and all child processes set essentially randomly.
To Reproduce
Steps to reproduce the behavior:
Call Process from multiple threads at once with different currentDirectoryURL values
...
Expected behavior
All child processes execute in the expected directory and the parent working directory is unchanged
The text was updated successfully, but these errors were encountered:
Lukasa
added
the
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
label
Jun 21, 2022
We allow users to set the working directory of the child process when they use the Process API. Unfortunately, this was implemented by calling chdir in the parent process, which has nasty global effects on the process and cannot safely be used concurrently.
glibc has a non-POSIX extension to posix_spawn that can call chdir in the child process, so we add that call instead where it's available, and add a regression test.
Resolvesswiftlang/swift#59610.
Describe the bug
Process.currentDirectoryURL
is implemented on top of chdir in swift-corelibs-foundation. As a result, using multiple, unrelatedProcess
objects from multiple threads in Linux that have this property set can cause wildly unexpected outcomes, leaving the working directory of the current process and all child processes set essentially randomly.To Reproduce
Steps to reproduce the behavior:
currentDirectoryURL
values...
Expected behavior
All child processes execute in the expected directory and the parent working directory is unchanged
The text was updated successfully, but these errors were encountered: