-
-
Notifications
You must be signed in to change notification settings - Fork 38
Description
I have received an arcane error message when using Downloads.request() with sftp URL (see below, real URL is masked out). I am filing it here because I suspect it has to do with the way Julia uses curl/libssh2 or build options. I couldn't reproduce any of the problematic behaviours using system tools (ssh, sftp, curl, etc) even though system libraries appear to be the same version (Ubuntu 25.04, /usr/lib/x86_64-linux-gnu/libcurl.so.4.8.0, /usr/lib/x86_64-linux-gnu/libssh2.so.1.0.1).
The problem seems to be with the order of the keys in known_hosts file. Specifically, if the first key listed in the file is of ssh-rsa type, the request succeeds. If the first key is of ssh-ed25519, the request fails with the error shown below (which I tracked to this line, but it didn't add any clarity). Also, if the first key in the file is of ecdsa-sha2-nistp256 type, I get yet another error message: ERROR: RequestError: Failure establishing ssh session: -5, Unable to exchange encryption keys while requesting. In all cases the first key in the file is for entirely unrelated host, not the one I'm connecting to.
$ julia -e 'using Downloads; Downloads.request("sftp://127.0.0.1:2221/path/")'
ERROR: RequestError: libssh2: The requested method(s) are not currently supported while requesting sftp://127.0.0.1:2221/path/
Stacktrace:
[1] (::Downloads.var"#9#19"{Base.DevNull, Base.DevNull, Nothing, Vector{Pair{String, String}}, Float64, Nothing, Bool, Nothing, Bool, Nothing, String, Bool, Bool})(easy::Downloads.Curl.Easy)
@ Downloads ~/.julia/juliaup/julia-1.11.5+0.x64.linux.gnu/share/julia/stdlib/v1.11/Downloads/src/Downloads.jl:452
[2] with_handle(f::Downloads.var"#9#19"{Base.DevNull, Base.DevNull, Nothing, Vector{Pair{String, String}}, Float64, Nothing, Bool, Nothing, Bool, Nothing, String, Bool, Bool}, handle::Downloads.Curl.Easy)
@ Downloads.Curl ~/.julia/juliaup/julia-1.11.5+0.x64.linux.gnu/share/julia/stdlib/v1.11/Downloads/src/Curl/Curl.jl:105
[3] #8
@ ~/.julia/juliaup/julia-1.11.5+0.x64.linux.gnu/share/julia/stdlib/v1.11/Downloads/src/Downloads.jl:363 [inlined]
[4] arg_write(f::Downloads.var"#8#18"{Base.DevNull, Nothing, Vector{Pair{String, String}}, Float64, Nothing, Bool, Nothing, Bool, Nothing, String, Bool, Bool}, arg::Base.DevNull)
@ ArgTools ~/.julia/juliaup/julia-1.11.5+0.x64.linux.gnu/share/julia/stdlib/v1.11/ArgTools/src/ArgTools.jl:134
[5] #7
@ ~/.julia/juliaup/julia-1.11.5+0.x64.linux.gnu/share/julia/stdlib/v1.11/Downloads/src/Downloads.jl:362 [inlined]
[6] arg_read
@ ~/.julia/juliaup/julia-1.11.5+0.x64.linux.gnu/share/julia/stdlib/v1.11/ArgTools/src/ArgTools.jl:76 [inlined]
[7] request(url::String; input::Nothing, output::Nothing, method::Nothing, headers::Vector{Pair{String, String}}, timeout::Float64, progress::Nothing, verbose::Bool, debug::Nothing, throw::Bool, downloader::Nothing, interrupt::Nothing)
@ Downloads ~/.julia/juliaup/julia-1.11.5+0.x64.linux.gnu/share/julia/stdlib/v1.11/Downloads/src/Downloads.jl:361
[8] request(url::String)
@ Downloads ~/.julia/juliaup/julia-1.11.5+0.x64.linux.gnu/share/julia/stdlib/v1.11/Downloads/src/Downloads.jl:328
[9] top-level scope
@ none:1
As per the stacktrace I'm running julia 1.11.5 installed via juliaup running on Ubuntu-25.04 x86_64 machine:
julia> versioninfo()
Julia Version 1.11.5
Commit 760b2e5b739 (2025-04-14 06:53 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: Linux (x86_64-linux-gnu)
CPU: 64 × AMD Ryzen Threadripper PRO 7975WX 32-Cores
WORD_SIZE: 64
LLVM: libLLVM-16.0.6 (ORCJIT, znver4)
Threads: 1 default, 0 interactive, 1 GC (on 64 virtual cores)