Skip to content

Pass SSH_AUTH_SOCK variable for ssh authentication while cloning repo… #118

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

Merged
merged 1 commit into from
Feb 17, 2016

Conversation

aciidgh
Copy link
Contributor

@aciidgh aciidgh commented Jan 26, 2016

@@ -91,10 +91,14 @@ class Git {
}

do {
var environment = [String:String]()
if let sshAuthSockPath = getenv("SSH_AUTH_SOCK") { //for auto ssh authentication if possible
environment["SSH_AUTH_SOCK"] = sshAuthSockPath
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are also other env variables that might be nice to replicate.

  • GIT_ASKPASS (git-credentials)
  • SSH_ASKPASS
  • XDG_CONFIG_HOME (used for git-credenitials lookup)

In which, I wonder why not just inherit all environ variables?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is a conversation about inheriting all variables here : https://bugs.swift.org/browse/SR-588

@ddunbar
Copy link
Contributor

ddunbar commented Jan 26, 2016

I think we intentionally want to limit the variables in some places (during builds), but when we are talking to a third party tool like git, I agree we should probably default to inheriting the full process environment.

@aciidgh
Copy link
Contributor Author

aciidgh commented Jan 26, 2016

ok, I can convert this to inherit the full list.
What would be the best way to get the environ without Foundation's NSProcessInfo ?

@ddunbar
Copy link
Contributor

ddunbar commented Jan 26, 2016

We are only going to be able to do this via C, unfortunately. What we could do is try and get environ support added to the Swift stdlib (in the Process enum, next to the arguments fields). If someone wanted to push that through, its a good addition for everyone and then we can just use it.

@gribozavr
Copy link
Contributor

You'd also want to inherit various environment variables that set the locale. Git is localized to many languages.

@mxcl
Copy link
Contributor

mxcl commented Jan 26, 2016

@gribozavr can you point us at a list?

@gribozavr
Copy link
Contributor

All LC_* variables, LANG, and also LANGUAGE on Linux.

Passing through EDITOR and PAGER also makes sense, in the case git wants to do something interactively.

And we also want to pass through TERM, too.

@mxcl
Copy link
Contributor

mxcl commented Jan 27, 2016

Thanks, will apply.

@aciidgh
Copy link
Contributor Author

aciidgh commented Jan 27, 2016

what is preferable? copying entire environ or only useful subset ?

@mxcl
Copy link
Contributor

mxcl commented Jan 27, 2016

It is preferable to copy as little as possible as the environment can have unforeseen consequences on the execution of tools.

@kostiakoval
Copy link
Contributor

is @swift-ci is only available for main swift repo?

@aciidgh
Copy link
Contributor Author

aciidgh commented Feb 4, 2016

In the meanwhile, updated to pass list of envs commented here

@mxcl
Copy link
Contributor

mxcl commented Feb 16, 2016

Post my refactor this needs to be merged, I am happy to do the merge, since I caused the problem, let me know.

@aciidgh
Copy link
Contributor Author

aciidgh commented Feb 17, 2016

@mxcl Done

mxcl added a commit that referenced this pull request Feb 17, 2016
Pass SSH_AUTH_SOCK variable for ssh authentication while cloning repo…
@mxcl mxcl merged commit 151a973 into swiftlang:master Feb 17, 2016
@aciidgh aciidgh deleted the patch-1 branch February 17, 2016 07:30
aciidgh pushed a commit to aciidgh/swift-package-manager that referenced this pull request Jan 11, 2019
…mputation

[BuildSystem] Fix bug where directory contents were always recomputed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants