Package: apt
Severity: normal
Version: 0.7.20.2
Tags: patch
If you have an invalid component name in your sources.list file, e.g. the
"mainy" in:
deb http://http.us.debian.org/debian/ sid mainy
and then you do an "apt-get update", you get this confusing error message:
W: Failed to fetch http://http.us.debian.org/debian/dists/sid/Release
Unable to find expected entry mainy/binary-i386/Packages in Meta-index
file (malformed Release file?)
Suggesting that the problem is (1) "Failed to fetch" and (2) the result of
a malformed Release file is very confusing here, given that the issue here
is a problem with the local configuration, not the remote repository (and
that a typo in sources.list is probably much more common than a malformed
Release file).
I've looked at the code that generates this error, and it is clear from
apt-pkg/algorithms.cc that "Failed to fetch" is printed for essentially
any error in the "apt-get update" process. This seems simply wrong; the
best fix for this issue is probably to change the way the error string is
generated to move the "Failed to fetch" into the individual error messages
related to fetching, and have some other initial error string for errors
related to parsing or finding required components.
As a short-term fix, I think it would be desireable to change
apt-pkg/acquire-item.cc to replace the error message
"Unable to find expected entry " + (*Target)->MetaKey + " in Meta-index file
(malformed Release file?)";
with
"Fetched successfully, but expected entry " + (*Target)->MetaKey + " not
found in Meta-index (misspelled, or Release file malformed?)"
so that the complete error message reads
"W: Failed to fetch http://http.us.debian.org/debian/dists/sid/Release
Fetched successfully, but expected entry mainy/binary-i386/Packages not found
in Meta-index (misspelled, or Release file malformed?)"
which I think is at least more clear. I've attached a patch to do this
simple improvement (though I'd prefer it if the broader problem were fixed
instead).
-Tim Abbott
=== modified file 'apt-pkg/acquire-item.cc'
--- old/apt-pkg/acquire-item.cc 2008-10-29 17:58:48 +0000
+++ new/apt-pkg/acquire-item.cc 2009-04-14 05:47:41 +0000
@@ -1055,8 +1055,8 @@
if (!Record)
{
Status = StatAuthError;
- ErrorText = "Unable to find expected entry "
- + (*Target)->MetaKey + " in Meta-index file (malformed Release file?)";
+ ErrorText = "Fetched successfully, but expected entry "
+ + (*Target)->MetaKey + " not found in Meta-index (misspelled, or Release file malformed?)";
return;
}
ExpectedIndexHash = Record->Hash;