[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#905527: marked as done (`apt show` fails to parse record for librust-winapi-dev (while `apt-cache show` succeeds))



Your message dated Wed, 15 Aug 2018 11:34:34 +0200
with message-id <20180815093434.GA2981@crossbow>
and subject line Re: Bug#905527: `apt show` fails to parse record for librust-winapi-dev (while `apt-cache show` succeeds)
has caused the Debian Bug report #905527,
regarding `apt show` fails to parse record for librust-winapi-dev (while `apt-cache show` succeeds)
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
905527: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=905527
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: apt
Version: 1.6.3
Severity: normal

~$ apt-cache show librust-winapi-dev
[... stuff ...]
~$ apt show librust-winapi-dev
E: Unable to parse package file /var/lib/apt/lists/ftp.br.debian.org_debian_dists_unstable_main_binary-amd64_Packages (2)
E: Internal Error, Unable to parse a package record

librust-winapi-dev as a massing Provides: field, which could be causing this.

I just reproduced this on a clean sid container with nothing but a
standard sources.list, so I am not attaching a copy of the Packages
file. I have saved a copy locally, however, and can provide one if you
want.


-- System Information:
Debian Release: buster/sid
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'testing-debug'), (500, 'unstable'), (500, 'testing'), (1, 'experimental-debug'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 4.17.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=pt_BR.UTF-8, LC_CTYPE=pt_BR.UTF-8 (charmap=UTF-8), LANGUAGE=pt_BR:pt:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages apt depends on:
ii  adduser                 3.117
ii  debian-archive-keyring  2017.7
ii  gpgv                    2.2.9-1
ii  libapt-pkg5.0           1.6.3
ii  libc6                   2.27-5
ii  libgcc1                 1:8.2.0-3
ii  libgnutls30             3.5.19-1
ii  libseccomp2             2.3.3-3
ii  libstdc++6              8.2.0-3

Versions of packages apt recommends:
ii  ca-certificates  20180409

Versions of packages apt suggests:
pn  apt-doc                      <none>
pn  aptitude | synaptic | wajig  <none>
ii  dpkg-dev                     1.19.0.5
ii  gnupg                        2.2.9-1
ii  powermgmt-base               1.33

-- no debconf information

Attachment: signature.asc
Description: PGP signature


--- End Message ---
--- Begin Message ---
Version: 1.7.0~alpha1

On Mon, Aug 06, 2018 at 05:56:44PM +0200, David Kalnischkies wrote:
> Hence tagging as fixed, but not closed for now & claiming ownership
> until some time later this week.

Took a slight bit longer, but can confirm by now that the 1.7.y rewrite
of the related code fixes this problem for good.

Looking at the 1.6.y it is easy to fix as well, my patch is pushed to
the respective branch and attached for completeness. Should be possible
to backport this into older series's as its a trivial one-liner (+ an
extra I couldn't leave unchanged with the second line), but I have no
plans on doing this as its a rather harmless issue and noone noticed so
far.

Closing with the previously mentioned 1.7.y version as done now.


Best regards

David Kalnischkies
commit 1af83ad5e621f91c6865211563da17f3a6ee06fd
Author: David Kalnischkies <david@kalnischkies.de>
Date:   Wed Aug 15 00:23:37 2018 +0200

    Support records larger than 32kb in 'apt show'
    
    The default buffer size for pkgTagFile is 32kb which should be big
    enough for everything… expect for enormous lists of provides,
    resulting in:
    
    $ apt show librust-winapi-dev
    E: Unable to parse package file /var/lib/apt/lists/ftp.br.debian.org_debian_dists_unstable_main_binary-amd64_Packages (2)
    E: Internal Error, Unable to parse a package record
    
    The "apt-cache show" codepath uses instead a max size for all files,
    which seems a bit excessive, but works – using the max size for the file
    in question seems most appropriate.
    
    The patch is written for the 1.6.y series as a rewrite of the related
    code in the 1.7.y series (commit bf53f39c9a0221b670ffff74053ed36fc502d5a0)
    removed this problem before it was reported.
    
    Closes: #905527
    LP: #1787120

diff --git a/apt-private/private-show.cc b/apt-private/private-show.cc
index afe448a33..0403fbed7 100644
--- a/apt-private/private-show.cc
+++ b/apt-private/private-show.cc
@@ -177,9 +177,9 @@ static bool DisplayRecordV2(pkgCacheFile &CacheFile, pkgCache::VerIterator const
 
    // Read the record
    pkgTagSection Tags;
-   pkgTagFile TagF(&PkgF);
+   pkgTagFile TagF(&PkgF, Vf->Size);
 
-   if (TagF.Jump(Tags, V.FileList()->Offset) == false)
+   if (TagF.Jump(Tags, Vf->Offset) == false)
       return _error->Error("Internal Error, Unable to parse a package record");
 
    // make size nice
diff --git a/test/integration/test-apt-cli-show b/test/integration/test-apt-cli-show
index 935d93d86..a37dbd8e6 100755
--- a/test/integration/test-apt-cli-show
+++ b/test/integration/test-apt-cli-show
@@ -7,11 +7,19 @@ TESTDIR="$(readlink -f "$(dirname "$0")")"
 setupenvironment
 configarchitecture 'i386' 'amd64'
 
+generatelotsofnames() {
+	for i in $(seq 0 10000); do
+		printf ', this-is-a-long-pkg-name-%s (= 0.a.long.version)' "$i"
+	done
+}
+
 DESCR='Some description
  That has multiple lines'
 insertpackage 'unstable' 'foo' 'all' '1.0' '' '' "$DESCR"
 insertpackage 'unstable' 'bar' 'i386,amd64' '1' '' '' "$DESCR"
 insertpackage 'unstable' 'big' 'i386,amd64' '1' 'Installed-Size: 4129421' '' "$DESCR"
+insertpackage 'unstable' 'large' 'all' '1' "Provides: pkga$(generatelotsofnames)" '' "$DESCR"
+insertpackage 'unstable' 'large2' 'all' '1' "Provides: foobar, pkga$(generatelotsofnames)" '' "$DESCR"
 insertinstalledpackage 'foo' 'all' '1.0'
 
 setupaptarchive
@@ -66,6 +74,31 @@ Description: Some description
  That has multiple lines
 " apt show big:amd64
 
+testsuccessequal "Package: large
+Version: 1
+Priority: optional
+Section: other
+Maintainer: Joe Sixpack <joe@example.org>
+Installed-Size: 43.0 kB
+Provides: pkga$(generatelotsofnames)
+Download-Size: unknown
+APT-Sources: file:$APTARCHIVE unstable/main all Packages
+Description: Some description
+ That has multiple lines
+" apt show large
+testsuccessequal "Package: large2
+Version: 1
+Priority: optional
+Section: other
+Maintainer: Joe Sixpack <joe@example.org>
+Installed-Size: 43.0 kB
+Provides: foobar, pkga$(generatelotsofnames)
+Download-Size: unknown
+APT-Sources: file:$APTARCHIVE unstable/main all Packages
+Description: Some description
+ That has multiple lines
+" apt show large2
+
 # this is the default, but disabled by the testcases
 testsuccess apt show foo -o Apt::Cmd::Disable-Script-Warning=0
 cp rootdir/tmp/testsuccess.output aptshow.output

Attachment: signature.asc
Description: PGP signature


--- End Message ---

Reply to: