haskell / haskell/cabal

When all Hackage mirrors fail, only the last is reported

Open
#9,516 4 comments 1 reaction 0 assignees View on GitHub
attention: pr-welcome re: user experience type: enhancement
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

**Describe the bug**

When all Hackage mirrors fail, only the last failure is reported. This obscures the reason for the failure.

**To Reproduce**
Steps to reproduce the behavior:

```
$ cabal unpack hermes
Warning: The package list for 'hackage.haskell.org' is 29 days old.
Run 'cabal update' to get the latest list of available packages.
Downloading hermes-1.3.4.3
Unexpected response 403 for http://objects-us-east-1.dream.io/hackage-mirror/package/hermes-1.3.4.3.tar.gz

```

What happened here? Is Dreamhost misbehaving? No. [Hackage returns a 500 for this package](https://github.com/haskell/hackage-server/issues/1023), which of course means no mirror will successfully provide the package.

*Comparison with `cabal -v`*

```
$ cabal -v unpack hermes
Reading available packages of hackage.haskell.org...
Using most recent state specified from most recent cabal update
Warning: The package list for 'hackage.haskell.org' is 29 days old.
Run 'cabal update' to get the latest list of available packages.
index-state(hackage.haskell.org) = 2023-11-13T12:07:58Z
Downloading hermes-1.3.4.3
Writing
/home/b/.cabal/packages/hackage.haskell.org/hermes/1.3.4.3/hermes-1.3.4.3.tar.gz
Selected mirror https://hackage.haskell.org/
Downloading package hermes-1.3.4.3
Running: /run/current-system/sw/bin/curl 'https://hackage.haskell.org/package/hermes-1.3.4.3.tar.gz' --output /tmp/transportAdapterGet510048-1 --location --write-out '%{http_code}' --user-agent 'cabal-install/3.10.1.0 (linux; x86_64)' --silent --show-error --dump-header /tmp/curl-headers510048-2.txt
Exception Unexpected response 500 for
https://hackage.haskell.org/package/hermes-1.3.4.3.tar.gz when using mirror
https://hackage.haskell.org/
Selected mirror http://hackage.fpcomplete.com/
Downloading package hermes-1.3.4.3
Running: /run/current-system/sw/bin/curl 'http://hackage.fpcomplete.com/package/hermes-1.3.4.3.tar.gz' --output /tmp/transportAdapterGet510048-4 --location --write-out '%{http_code}' --user-agent 'cabal-install/3.10.1.0 (linux; x86_64)' --silent --show-error --dump-header /tmp/curl-headers510048-5.txt
Exception Unexpected response 404 for
http://hackage.fpcomplete.com/package/hermes-1.3.4.3.tar.gz when using mirror
http://hackage.fpcomplete.com/
Selected mirror http://objects-us-east-1.dream.io/hackage-mirror/
Downloading package hermes-1.3.4.3
Running: /run/current-system/sw/bin/curl 'http://objects-us-east-1.dream.io/hackage-mirror/package/hermes-1.3.4.3.tar.gz' --output /tmp/transportAdapterGet510048-7 --location --write-out '%{http_code}' --user-agent 'cabal-install/3.10.1.0 (linux; x86_64)' --silent --show-error --dump-header /tmp/curl-headers510048-8.txt
Unexpected response 403 for http://objects-us-east-1.dream.io/hackage-mirror/package/hermes-1.3.4.3.tar.gz
```

**Expected behavior**
When *all* mirrors fail, I would expect something like

```
$ cabal unpack hermes
Warning: The package list for 'hackage.haskell.org' is 29 days old.
Run 'cabal update' to get the latest list of available packages.
Downloading hermes-1.3.4.3

*** Error: no mirror was able to provide this package.

* Unexpected response 500 for https://hackage.haskell.org/package/hermes-1.3.4.3.tar.gz
* Unexpected response 404 for http://hackage.fpcomplete.com/package/hermes-1.3.4.3.tar.gz
* Unexpected response 403 for http://objects-us-east-1.dream.io/hackage-mirror/package/hermes-1.3.4.3.tar.gz
```

**System information**
```
cabal-install version 3.10.1.0
compiled using version 3.10.1.0 of the Cabal library
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.