JuliaLang / MbedTLS.jl

Wrapper around mbedtls
Other
41 stars 50 forks source link

Cannot find cert.pem in compiled applications #251

Closed vitornesello closed 2 years ago

vitornesello commented 2 years ago

Hello,

MbedTLS.jl is used as a dependency in one of my applications. We deploy a compiled version of this app using PackageCompiler.jl and everything was working just fine until one of the latest releases of the month of July.

What happens is that this function (code copied below) is trying to access the file cert.pem using the variable Sys.BINDIR as reference path. The problem is that in the compiled app the certificate does not exist in the expected directory.

How could I fix it? I am keen to opening a PR if the problem really comes from this package

function __sslinit__()
    c_send[] = @cfunction(f_send, Cint, (Ptr{Cvoid}, Ptr{UInt8}, Csize_t))
    c_recv[] = @cfunction(f_recv, Cint, (Ptr{Cvoid}, Ptr{UInt8}, Csize_t))
    c_dbg[] = @cfunction(f_dbg, Cvoid, (Any, Cint, Ptr{UInt8}, Cint, Ptr{UInt8}))
    # Note: `MozillaCACerts_jll.cacert` is filled by `__init__`
    fallback = abspath(joinpath(Sys.BINDIR, "..", "share", "julia", "cert.pem"))
    if isfile(MozillaCACerts_jll.cacert)
        DEFAULT_CERT[] = read(MozillaCACerts_jll.cacert, String)
    else
        DEFAULT_CERT[] = read(fallback, String)
    end
    return
end
KwatMDPhD commented 2 years ago

Hi, I have the exact same issue her ehttps://github.com/KwatMDPhD/GSEA.jl/issues/59. I hope you could help take care of this.

KwatMDPhD commented 2 years ago

And this is the same issue https://github.com/JuliaLang/MbedTLS.jl/issues/242

KwatMDPhD commented 2 years ago

This is fixed.

vitornesello commented 2 years ago

Thanks, guys