Skip to content

Process.currentDirectoryURL affects global state on Linux #59610

Closed
swiftlang/swift-corelibs-foundation
#4606
@Lukasa

Description

@Lukasa

Describe the bug

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:

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions