Skip to content

NetworkOptions.jl serializes SYSTEM_CA_ROOTS during precompilation? #33

Closed
@benlorenz

Description

@benlorenz

With the latest julia nightly binaries I cannot update the registry or do any git operations.
Note that this does not happen if I built nightly myself. I can also work around this by explicitly setting JULIA_SSL_CA_ROOTS_PATH.

lorenz@dragon /tmp/jv $ ./julia-3fc4f6bb24/bin/julia 
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.11.0-DEV.435 (2023-09-09)
 _/ |\__'_|_|_|\__'_|  |  Commit 3fc4f6bb243 (4 days old master)
|__/                   |

(@v1.11) pkg> up
┌ Warning: could not download https://pkg.julialang.org/registries
│   exception = RequestError: Error reading ca cert file /etc/ssl/certs/ca-certificates.crt - mbedTLS: (-0x3E00) PK - Read/write of file failed while requesting https://pkg.julialang.org/registries
└ @ Pkg.Registry /tmp/jv/julia-3fc4f6bb24/share/julia/stdlib/v1.11/Pkg/src/Registry/Registry.jl:69
    Updating registry at `/home/datastore/lorenz/software/julia/depot/registries/General`
ERROR: GitError(Code:ERROR, Class:SSL, failed to load CA certificates: 0xffffc200 - PK - Read/write of file failed)

On my system (openSUSE) the certificates are stored in /etc/ssl/ca-bundle.pem but julia seems to assume /etc/ssl/certs/ca-certificates.crt which does not exist.

I bisected this with the available nightlies to the Downloads.jl bump in 3fc4f6bb243.
I would guess that the added precompile workload for Downloads.jl (added in JuliaLang/Downloads.jl#226) causes the value from the build system to be stored in some precompiled files:

lorenz@dragon /tmp/jv $ ./julia-3fc4f6bb24/bin/julia
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.11.0-DEV.435 (2023-09-09)
 _/ |\__'_|_|_|\__'_|  |  Commit 3fc4f6bb243 (4 days old master)
|__/                   |

julia> using NetworkOptions

julia> NetworkOptions.SYSTEM_CA_ROOTS
Base.RefValue{String}("/etc/ssl/certs/ca-certificates.crt")

This path is accepted without any checks by NetworkOptions.

While on the previous commit the value is not assigned and I get the correct path:

lorenz@dragon /tmp/jv $ ./julia-8e77b63fa7/bin/julia
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.11.0-DEV.434 (2023-09-08)
 _/ |\__'_|_|_|\__'_|  |  Commit 8e77b63fa76 (5 days old master)
|__/                   |

julia> using NetworkOptions

julia> NetworkOptions.SYSTEM_CA_ROOTS
Base.RefValue{String}(#undef)

julia> NetworkOptions.ca_roots()
"/etc/ssl/ca-bundle.pem"

PS: Not sure if this bug should be here, in Downloads.jl, or NetworkOptions.jl.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions