/* */
 unsigned long debSourcesIndex::Size() const
 {
-   struct stat S;
-   if (stat(IndexFile("Sources").c_str(),&S) != 0)
+   FileFd f = FileFd (IndexFile("Sources"), FileFd::ReadOnlyGzip);
+
+   if (f.Failed())
       return 0;
-   return S.st_size;
+   return f.Size();
 }
                                                                        /*}}}*/
 
 /* This is really only used for progress reporting. */
 unsigned long debPackagesIndex::Size() const
 {
-   struct stat S;
-   if (stat(IndexFile("Packages").c_str(),&S) != 0)
+   FileFd f = FileFd (IndexFile("Packages"), FileFd::ReadOnlyGzip);
+
+   if (f.Failed())
       return 0;
-   return S.st_size;
+   return f.Size();
 }
                                                                        /*}}}*/
 // PackagesIndex::Merge - Load the index file into a cache             /*{{{*/
 /* This is really only used for progress reporting. */
 unsigned long debTranslationsIndex::Size() const
 {
-   struct stat S;
-   if (stat(IndexFile(Language).c_str(),&S) != 0)
+   FileFd f = FileFd (IndexFile(Language), FileFd::ReadOnlyGzip);
+
+   if (f.Failed())
       return 0;
-   return S.st_size;
+
+   return f.Size();
 }
                                                                        /*}}}*/
 // TranslationsIndex::Merge - Load the index file into a cache         /*{{{*/
 
   * Wrong translation for "showauto" fixed. Thanks to RaphaĆ«l Hertzog
     Closes: #599265
 
+  [ Martin Pitt ]
+  * apt-pkg/deb/debindexfile.cc:
+    - Use FileFd::Size() instead of stat()ing the sources/binary/translations
+      indexes directly, so that we have transparent handling of gzipped
+      indexes.
+
  -- Christian Perrier <bubulle@debian.org>  Tue, 05 Oct 2010 05:35:58 +0200
 
 apt (0.8.6) unstable; urgency=low