This is an automated email from the git hooks/post-receive script.

guillem pushed a commit to branch master
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=536a38582a2d92da84f82d850e22f581b00d2082

commit 536a38582a2d92da84f82d850e22f581b00d2082
Author: Guillem Jover <[email protected]>
AuthorDate: Mon Nov 2 09:46:58 2020 +0100

    libdpkg: Ignore not-installed packages for source related virtual fields
    
    The source name and source versions are not available for not-installed
    packages, so we should not try to print anything as that will end up
    being bogus, or produce parsing problems for version related virtual
    fields.
    
    Closes: #972580
---
 lib/dpkg/pkg-format.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/lib/dpkg/pkg-format.c b/lib/dpkg/pkg-format.c
index 07474a211..8af7c4fe3 100644
--- a/lib/dpkg/pkg-format.c
+++ b/lib/dpkg/pkg-format.c
@@ -333,6 +333,9 @@ virt_source_package(struct varbuf *vb,
        const char *name;
        size_t len;
 
+       if (pkg->status == PKG_STAT_NOTINSTALLED)
+               return;
+
        name = pkgbin->source;
        if (name == NULL)
                name = pkg->set->name;
@@ -347,6 +350,9 @@ virt_source_version(struct varbuf *vb,
                     const struct pkginfo *pkg, const struct pkgbin *pkgbin,
                     enum fwriteflags flags, const struct fieldinfo *fip)
 {
+       if (pkg->status == PKG_STAT_NOTINSTALLED)
+               return;
+
        varbuf_add_source_version(vb, pkg, pkgbin);
 }
 
@@ -357,6 +363,9 @@ virt_source_upstream_version(struct varbuf *vb,
 {
        struct dpkg_version version;
 
+       if (pkg->status == PKG_STAT_NOTINSTALLED)
+               return;
+
        pkg_source_version(&version, pkg, pkgbin);
 
        varbuf_add_str(vb, version.version);

-- 
Dpkg.Org's dpkg

Reply via email to