Fix severe performance issue affecting "cabal update"

This patch improves `cabal update` performance by 10x(!) on my system.  Due to this issue, `cabal update` was using an extreme amount of CPU, while it should be I/O-bound.  The reverse was taking 79s, now it takes 0.01s.