On Tue, Oct 05, 2021 at 08:44:06PM -0300, Antonio Terceiro wrote: > Control: tag -1 + patch > > On Fri, Mar 11, 2011 at 06:56:58PM -0300, Rogério Brito wrote: > > Package: apt-show-versions > > Version: 0.17 > > Severity: important > > > > Hi. > > > > On my system, apt-show-versions started complaining with the message: > > > > Error: No information about packages! (Maybe no deb entries?) > > > > Of course, I do have deb entries in my system. Reading the source code, I > > saw that there was this snippet of code: > > > > ,---- > > | @files = map { $list_dir . $_} grep /Packages$/, readdir(DIR); > > `---- > > > > right there in the initialization of the cache. Since my system only has > > gzipped files as shown by "ls /var/lib/apt/lists/*Packages*", > > apt-show-versions goes on to say that it found no informations about the > > packages, but the files are there, only gzipped (that is, ending with > > Packages.gz extension, instead of only Packages). > > Dear maintainer, > > The attached patch fixes this issue.
Of course I forgot the the attachment.
From e04c948c2075930387e258e4d3e3068302544768 Mon Sep 17 00:00:00 2001 From: Antonio Terceiro <terce...@debian.org> Date: Tue, 5 Oct 2021 20:27:11 -0300 Subject: [PATCH 1/2] Fix indexing with compressed APT Packages files APT can be configured to keep its Packages files compressed after downloading, and these days this is even a common setup. Therefore, one cannot assume that *Packages files under /var/lib/apt/lists/ exist, or can be read as plain text. Instead, use the documented APT interfaces for listing and getting the contents of the Packages files, that work whether they are compressed or not. Closes: #617856 --- apt-show-versions | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apt-show-versions b/apt-show-versions index 9bfa3b0..240ca7c 100755 --- a/apt-show-versions +++ b/apt-show-versions @@ -193,7 +193,7 @@ if (-e $filescachefile and -M $filescachefile < -M $list_dir) { # Test also to be sure $filescachefile is not corrupt and returns a ref to it if (!-e $filescachefile or -M $list_dir < -M $filescachefile or !ref($filesref)) { opendir(DIR, $list_dir) or &die("Can't opendir $list_dir: $!\n"); - @files = map { $list_dir . $_} grep /Packages$/, readdir(DIR); + @files = split(/\s/, `apt-get indextargets -o Dir::State::lists=${list_dir} --format='\$(FILENAME)' 'Created-By: Packages'`); ($< == 0) and (nstore(\@files, $filescachefile) or warn "Can't write $filescachefile\n"); ($< == 0) and (chmod($cachefilemode, $filescachefile) or @@ -569,7 +569,7 @@ sub parse_file { my ($key, $value, $package, $packages); my $release = &determine_pkgfile_release($file); - open FILE, $file or &die("Can't open file $file: $!\n"); + open FILE, "/usr/lib/apt/apt-helper cat-file $file|" or &die("Can't open file $file: $!\n"); if ($opts{'verbose'}) {print "Parsing $file...";}; while (<FILE>) { if (/^$/){ -- 2.33.0
signature.asc
Description: PGP signature