luckasRanarison / nvim-devdocs

Neovim DevDocs integration
MIT License
270 stars 20 forks source link

Error during download, exit code: 23 #78

Open gabeklavans opened 7 months ago

gabeklavans commented 7 months ago

Every time the plugin tries to use curl to download something, it throws an error from curl

I'm using Linux, OpenSUSE Tumbleweed, so I have a pretty up to date curl and no weird installations.

Even manually trying to download anything from devdocs.io, such as with curl https://devdocs.io/docs.json -o registery.json, just returns an empty output.

➜  devdocs curl https://devdocs.io/docs.json -o registery.json
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0

Replacing curl with wget in my command line, and the download happens as intended. This isn't a solution, though, since all the downloads in this plugin use curl, so manually placing everything everytime would be kind of annoying.

Adding the -sSL flag to my curl command also allows the download to succeed.

Version:

curl --version
curl 8.7.1 (x86_64-suse-linux-gnu) libcurl/8.7.1 OpenSSL/3.1.4 zlib/1.3.1 brotli/1.1.0 zstd/1.5.6 libidn2/2.3.7 libpsl/0.21.5 libssh/0.10.6/openssl/zlib nghttp2/1.61.0 OpenLDAP/2.6.6
Release-Date: 2024-03-27
Protocols: dict file ftp ftps gopher gophers http https imap imaps ipfs ipns ldap ldaps mqtt pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS brotli GSS-API HSTS HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM PSL SPNEGO SSL threadsafe TLS-SRP UnixSockets zstd
luckasRanarison commented 7 months ago

I could reproduce that issue on my phone using termux but it seems that it's caused by missing write access for creating the dump file (by default in tmp directory) used by curl when using the -D argument. And it looks like it cannot be omitted when using plenary, but I'm stuck on trying to use a custom path for it...

EDIT: I think that should be plenary issue (https://github.com/nvim-lua/plenary.nvim/issues/536)

gabeklavans commented 7 months ago

In my case, I'm seeing the "plenary_curl_xxxxxxxx.headers" files being created in my dir set by XDG_RUNTIME_DIR (it was /run/user/1000 for me, which already existed and had proper permissions) and I'm still getting this exit code 23 from plenary. I wonder what else could be causing it.

gabeklavans commented 7 months ago

It definitely has to do with the URL. If I replace it with something simple like https://postman-echo.com/get, I get no error. I'm guessing it has to do with the fact that https://devdocs.io/docs.json is a redirect, but I'm not sure how it was ever working, then.

luckasRanarison commented 7 months ago

I'm guessing it has to do with the fact that https://devdocs.io/docs.json is a redirect

But plenary include -L argument by default and redirect works, the error code 23 is for write error.

jonboh commented 6 months ago

@gabeklavans check if you get the error with:

curl -sSL --compressed -X GET https://devdocs.io/docs.json

In my case the --compressed flag generates the error using

curl --version
curl 8.7.1 (x86_64-pc-linux-gnu) libcurl/8.7.1 OpenSSL/3.0.13 zlib/1.3.1 brotli/1.1.0 zstd/1.5.6 libidn2/2.3.7 libpsl/0.21.5 libssh2/1.11.0 nghttp2/1.61.0
Release-Date: 2024-03-27

However with

curl --version
curl 8.4.0 (x86_64-pc-linux-gnu) libcurl/8.4.0 OpenSSL/3.0.13 zlib/1.3 brotli/1.1.0 zstd/1.5.5 libidn2/2.3.4 libssh2/1.11.0 nghttp2/1.57.0
Release-Date: 2023-10-11

I don't get the error

Disabling the compression in the plenary calls fixes the issue for me

jonboh commented 6 months ago

It seems to be related to this issue: https://github.com/curl/curl/issues/13209 and it seems to already have a fix: https://github.com/curl/curl/pull/13219