Skip to content

Commit

Permalink
Merge pull request #18997 from JuliaLang/sf/libgit_certfix
Browse files Browse the repository at this point in the history
Expand ssl certificate file search parameters
  • Loading branch information
tkelman authored Oct 19, 2016
2 parents bed6663 + d5d8ac4 commit 90a3740
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
19 changes: 19 additions & 0 deletions base/libgit2/libgit2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,8 @@ end
function __init__()
# Look for OpenSSL env variable for CA bundle (linux only)
# windows and macOS use the OS native security backends
old_ssl_cert_dir = Base.get(ENV, "SSL_CERT_DIR", nothing)
old_ssl_cert_file = Base.get(ENV, "SSL_CERT_FILE", nothing)
@static if is_linux()
cert_loc = if "SSL_CERT_DIR" in keys(ENV)
ENV["SSL_CERT_DIR"]
Expand All @@ -557,6 +559,23 @@ function __init__()
atexit() do
ccall((:git_libgit2_shutdown, :libgit2), Cint, ())
end

@static if is_linux()
if old_ssl_cert_dir != Base.get(ENV, "SSL_CERT_DIR", "")
if old_ssl_cert_dir === nothing
delete!(ENV, "SSL_CERT_DIR")
else
ENV["SSL_CERT_DIR"] = old_ssl_cert_dir
end
end
if old_ssl_cert_file != Base.get(ENV, "SSL_CERT_FILE", "")
if old_ssl_cert_file === nothing
delete!(ENV, "SSL_CERT_FILE")
else
ENV["SSL_CERT_FILE"] = old_ssl_cert_file
end
end
end
end


Expand Down
14 changes: 12 additions & 2 deletions deps/libgit2.mk
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,18 @@ endif

# We need to bundle ca certs on linux now that we're using libgit2 with ssl
ifeq ($(OS),Linux)
ifeq ($(shell [ -e $(shell openssl version -d | cut -d '"' -f 2)/cert.pem ] && echo exists),exists)
CERTFILE=$(shell openssl version -d | cut -d '"' -f 2)/cert.pem
OPENSSL_DIR=$(shell openssl version -d | cut -d '"' -f 2)
# This certfile location observed on Ubuntu 14.04
ifeq ($(shell [ -e $(OPENSSL_DIR)/cert.pem ] && echo exists),exists)
CERTFILE=$(OPENSSL_DIR)/cert.pem
endif
# This certfile location observed on Debian 7
ifeq ($(shell [ -e $(OPENSSL_DIR)/certs/ca.pem ] && echo exists),exists)
CERTFILE=$(OPENSSL_DIR)/certs/ca.pem
endif
# This certfile location observed on openSUSE Leap 42.1
ifeq ($(shell [ -e $(OPENSSL_DIR)/ca-bundle.pem ] && echo exists),exists)
CERTFILE=$(OPENSSL_DIR)/ca-bundle.pem
endif
endif

Expand Down

2 comments on commit 90a3740

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

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

Executing the daily benchmark build, I will reply here when finished:

@nanosoldier runbenchmarks(ALL, isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

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

Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. cc @jrevels

Please sign in to comment.