tealdeer-rs / tealdeer

A very fast implementation of tldr in Rust.
https://tealdeer-rs.github.io/tealdeer/
Apache License 2.0
4.17k stars 123 forks source link

Fails to update cache: thread 'main' panicked (Arch Linux) #252

Closed bacteriostat closed 2 years ago

bacteriostat commented 2 years ago

When I run RUST_BACKTRACE=full tldr --update, this is the error I get:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: InvalidArchive("Could not find central directory end")', src/cache.rs:166:33
stack backtrace:
0:     0x560e37b784fd - <unknown>
1:     0x560e379d62ec - <unknown>
2:     0x560e37b76d84 - <unknown>
3:     0x560e37b774d0 - <unknown>
4:     0x560e37b7685a - <unknown>
5:     0x560e37b978f8 - <unknown>
6:     0x560e37b97876 - <unknown>
7:     0x560e37b97832 - <unknown>
8:     0x560e37962b60 - <unknown>
9:     0x560e37962e42 - <unknown>
10:     0x560e37bae307 - <unknown>
11:     0x560e37bc3dd5 - <unknown>
12:     0x560e37bb63a3 - <unknown>
13:     0x560e37bbfb79 - <unknown>
14:     0x7f4d4a849b25 - __libc_start_main
15:     0x560e3796d54e - <unknown>
16:                0x0 - <unknown>

About my system: OS: Arch Linux tealdeer version: 1.5.0

dbrgn commented 2 years ago

Does this happen every time you run this command? It seems like the tldr pages archive is corrupt somehow.

When you download https://tldr.sh/assets/tldr.zip directly, can you open it with a ZIP tool?

(Note to self: Improve error message, do not panic)

bacteriostat commented 2 years ago

Okay thanks for the URL, it made it clear why it did not work. My ISP is for some weird reason blocking https://tldr.sh. I switched my network and the cache update worked.

I think you should run some check on the archive that gets downloaded. The file that got downloaded must be my ISPs html page.

dbrgn commented 2 years ago

I assumed so 🙂 Anyways, I'll reopen the issue, since this should not cause a panic.

niklasmohrin commented 2 years ago

Should be a lot easier to include this information after anyhow PR is merged :)

dbrgn commented 2 years ago

Should be a lot easier to include this information after anyhow PR is merged :)

Yes, definitely, thanks to .context(...).