Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3706486

Browse files
committed
Reorder libgit2 initialization and ssl cert location setting
Works around libgit2/libgit2#3935 (comment)
1 parent 48eaf85 commit 3706486

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

base/libgit2/libgit2.jl

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -529,18 +529,15 @@ function set_ssl_cert_locations(cert_loc)
529529
cert_file = isfile(cert_loc) ? cert_loc : Cstring(C_NULL)
530530
cert_dir = isdir(cert_loc) ? cert_loc : Cstring(C_NULL)
531531
cert_file == C_NULL && cert_dir == C_NULL && return
532-
ccall((:git_libgit2_opts, :libgit2), Cint,
533-
(Cint, Cstring, Cstring),
534-
Cint(Consts.SET_SSL_CERT_LOCATIONS), cert_file, cert_dir)
532+
# TODO FIX https://github.com/libgit2/libgit2/pull/3935#issuecomment-253910017
533+
#ccall((:git_libgit2_opts, :libgit2), Cint,
534+
# (Cint, Cstring, Cstring),
535+
# Cint(Consts.SET_SSL_CERT_LOCATIONS), cert_file, cert_dir)
536+
ENV["SSL_CERT_FILE"] = cert_file
537+
ENV["SSL_CERT_DIR"] = cert_dir
535538
end
536539

537540
function __init__()
538-
err = ccall((:git_libgit2_init, :libgit2), Cint, ())
539-
err > 0 || throw(ErrorException("error initializing LibGit2 module"))
540-
atexit() do
541-
ccall((:git_libgit2_shutdown, :libgit2), Cint, ())
542-
end
543-
544541
# Look for OpenSSL env variable for CA bundle (linux only)
545542
# windows and macOS use the OS native security backends
546543
@static if is_linux()
@@ -554,6 +551,12 @@ function __init__()
554551
end
555552
set_ssl_cert_locations(cert_loc)
556553
end
554+
555+
err = ccall((:git_libgit2_init, :libgit2), Cint, ())
556+
err > 0 || throw(ErrorException("error initializing LibGit2 module"))
557+
atexit() do
558+
ccall((:git_libgit2_shutdown, :libgit2), Cint, ())
559+
end
557560
end
558561

559562

deps/libgit2.mk

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ $(SRCDIR)/srccache/$(LIBGIT2_SRC_DIR)/libgit2-openssl-hang.patch-applied: $(SRCD
6565

6666
$(build_datarootdir)/julia/cert.pem: $(CERTFILE)
6767
mkdir -p $(build_datarootdir)/julia
68-
echo "NABIL: Copying over certfile $(CERTFILE)"
6968
-cp $(CERTFILE) $@
7069

7170
$(BUILDDIR)/$(LIBGIT2_SRC_DIR)/build-configured: \

0 commit comments

Comments
 (0)