JuliaLang / Pkg.jl

Pkg - Package manager for the Julia programming language
https://pkgdocs.julialang.org
Other
609 stars 251 forks source link

Source of failure in `update_registries` should be surfaced to caller #3920

Closed bluesmoon closed 3 weeks ago

bluesmoon commented 3 weeks ago

My disk ran out of space. I did not know this.

Using Julia 1.6 (release-1.6 branch of this repo) I ran:

using Pkg
Pkg.Registry.update()

I got this error:

    Updating registry at `~/.julia/registries/General`
┌ Warning: could not download https://pkg.julialang.org/registry/23338594-aafe-5451-b93e-139f81909106/aa1e69d6574bc554818e14017cc11be092027b24
└ @ Pkg.Types /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Pkg/src/Types.jl:1173
ERROR: "/tmp/jl_4UdMKq/Registry.toml": No such file
Stacktrace:
  [1] error(::String, ::String)
    @ Base ./error.jl:42
  [2] readstring
    @ /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/TOML/src/TOML.jl:21 [inlined]
  [3] parsefile(f::String)
    @ TOML /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/TOML/src/TOML.jl:43
  [4] read_registry(reg_file::String; cache::Bool)
    @ Pkg.Types /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Pkg/src/Types.jl:1092
  [5] (::Pkg.Types.var"#95#98"{Pkg.Types.Context, String, Pkg.Types.RegistrySpec, SubString{String}})(tmp::String)
    @ Pkg.Types /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Pkg/src/Types.jl:1182
  [6] mktempdir(fn::Pkg.Types.var"#95#98"{Pkg.Types.Context, String, Pkg.Types.RegistrySpec, SubString{String}}, parent::String; prefix::String)
    @ Base.Filesystem ./file.jl:729
  [7] mktempdir (repeats 2 times)
    @ ./file.jl:727 [inlined]
  [8] update_registries(ctx::Pkg.Types.Context, regs::Vector{Pkg.Types.RegistrySpec}; force::Bool)
    @ Pkg.Types /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Pkg/src/Types.jl:1169

After looking through the source, I tried this:

Pkg.PlatformEngines.download_verify_unpack("https://pkg.julialang.org/registry/23338594-aafe-5451-b93e-139f81909106/41e6b9829572efa44643d01e894b7a4be27eda46", nothing, "/home/ubuntu/tmp"; ignore_existence = true)

And got this error:

ERROR: SystemError: close: No space left on device

This latter error is far more useful/actionable, so I would recommend we surface this as part of the warning message from line 1173.

IanButterworth commented 3 weeks ago

It's not clear that this issue exists on master. The code has changed quite a bit and the comparable lines to Types.jl 1173 do report the exception https://github.com/JuliaLang/Pkg.jl/blob/4e43058c264e0117478f901e36b2be563418f7d3/src/Registry/Registry.jl#L229 https://github.com/JuliaLang/Pkg.jl/blob/4e43058c264e0117478f901e36b2be563418f7d3/src/Registry/Registry.jl#L191

bluesmoon commented 3 weeks ago

Appears to be fixed on 1.8+ - the source exception is added to the log.