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=3491a330369d51fe1a1fb5b738082d5e0f83badc

commit 3491a330369d51fe1a1fb5b738082d5e0f83badc
Author: Guillem Jover <[email protected]>
AuthorDate: Wed Aug 15 06:45:56 2018 +0200

    libdpkg: Document in pkg_db_get_pkg() which pkgbin members can be 
initialized
    
    The only member that can be safely initialized in a new pkginfo's
    pkgbin is the arch member, because that's used as part of the lookup.
    Anything else might get overwritten with the data from the new object,
    for example during deb822 parsing.
---
 lib/dpkg/pkg-db.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/dpkg/pkg-db.c b/lib/dpkg/pkg-db.c
index 7135450a3..ab90412a3 100644
--- a/lib/dpkg/pkg-db.c
+++ b/lib/dpkg/pkg-db.c
@@ -179,6 +179,8 @@ pkg_db_get_pkg(struct pkgset *set, const struct dpkg_arch 
*arch)
 
   /* If there's a single unused slot, let's use that. */
   if (pkg->installed.arch->type == DPKG_ARCH_NONE && pkg->arch_next == NULL) {
+    /* We can only initialize the arch pkgbin members, because those are used
+     * to find instances, anything else will be overwritten at parse time. */
     pkg->installed.arch = arch;
     pkg->available.arch = arch;
     return pkg;
@@ -197,6 +199,8 @@ pkg_db_get_pkg(struct pkgset *set, const struct dpkg_arch 
*arch)
   pkg_blank(pkg);
   pkg->set = set;
   pkg->arch_next = NULL;
+  /* We can only initialize the arch pkgbin members, because those are used
+   * to find instances, anything else will be overwritten at parse time. */
   pkg->installed.arch = arch;
   pkg->available.arch = arch;
   *pkgp = pkg;

-- 
Dpkg.Org's dpkg

Reply via email to