cabal-install should probably do a quick sanity check on downloaded tarballs
- Dominant language
- Haskell
- Stars
- 1.7k
- Forks
- 750
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 28
Description
I sometimes develop in an environment where downloaded file contents often get silently replaced by error text in XML -- don't ask why.
In this situation, `cabal` will
- Download the corrupt `tar.gz`,
- Not create/download (?) a `tar.gz.etag`.
This is understandable so far.
Then `cabal` will merrily try to install (I assume) this corrupt file, and fail, but without producing a `log` file:
```
Failed to install zlib-0.6.1.1
Build log ( /home/thejanet/.cabal/logs/zlib-0.6.1.1.log ):
cabal: /home/thejanet/.cabal/logs/zlib-0.6.1.1.log: does not exist
```
It seems to me that `cabal` somehow _knows_ that the file was not downloaded properly, thus the lack of an `etag` and `log` file, so it would be nice if:
- `cabal` would give a better, more precise, error message that the file is corrupt, and
- It would try to re-download the file the next time I attempt to `cabal install` or `cabal fetch` it.
My main issue really, apart from the lack of a good error message, is the fact that the user needs to go and manually delete the corrupt download to prompt `cabal` to try again.
I appreciate that if we can't fetch the file then we probably won't be able to fetch its hash, but can we at least use a simple heuristic which at least tries to expand the file to make sure it is a valid `tar.gz`?
Contributor guide
Research direction
Reproduce the report by giving cabal-install a corrupt downloaded tar.gz and trying cabal install or cabal fetch. Trace the download, archive validation, cache, and retry handling; done means a precise corruption error is reported and the next attempt retries the download without manual deletion.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100