Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-6511] Running swift run Foo has extra environment variables over .build/debug/Foo which can interfere with the spawned executable #4905

Open
ankitspd opened this issue Nov 30, 2017 · 1 comment
Labels

Comments

@ankitspd
Copy link
Member

Previous ID SR-6511
Radar rdar://problem/35771462
Original Reporter @aciidb0mb3r
Type Bug

Attachment: Download

Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels Bug
Assignee None
Priority Medium

md5: 8c5cca3f28f5e8b709e2517147615412

Issue Description:

Filing on behalf of czechboy0 (JIRA User)


I discovered today that running a tool with `swift run Foo` has extra environment variables: CPATH, LIBRARY_PATH and SDKROOT.

These can interfere with the spawned tool. It did for me, as my tool itself called xcodebuild later, and these variables made the sample project not to compile.

A workaround is to instead `swift build` and `.build/debug/Foo` manually, which works fine.

I attached a sample project that contains a script that dumps the two environments and diffs them, where you can clearly see the issue.

My expectation is that the executable spawned by `swift run` does NOT contain these variables (unless they were already present in the caller’s environment).

Steps to reproduce:

  • open the attached sample project

  • run ./dump_environments.sh

  • observe the extra environment variables

@ankitspd
Copy link
Member Author

ankitspd commented Dec 4, 2017

xcrun is injecting these variables and there is probably not a straightforward way to fix this.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants