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

guillem pushed a commit to branch master
in repository dpkg.

commit 43c42496d0bc3bcbd12def7fff8f0935b1de3dc3
Author: Guillem Jover <[email protected]>
Date:   Thu May 10 15:04:39 2018 +0200

    dpkg-divert: Do not assume that diversions are always present
    
    Several code paths assumed that the fsys nodes were only present when
    they contained diversions, and no other nodes would be present, thus
    did not make sure to check whether the divert struct members were valid.
    
    With the switch to a single fsys underlying implementation now triggers
    can vivify namenodes in the hash, so we need to check whether the members
    are valid all the time.
    
    Fixes: commit 2d7566140335d5338e5a98278d4df762936f67f4
    Reported-by: Sven Joachim <[email protected]>
    Bisected-by: Sven Joachim <[email protected]>
---
 src/divertcmd.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/divertcmd.c b/src/divertcmd.c
index e7bb5ad..170c9e9 100644
--- a/src/divertcmd.c
+++ b/src/divertcmd.c
@@ -685,7 +685,7 @@ diversion_list(const char *const *argv)
                struct diversion *altname;
                const char *pkgname;
 
-               if (contest->useinstead == NULL)
+               if (contest == NULL || contest->useinstead == NULL)
                        continue;
 
                altname = contest->useinstead->divert;
@@ -722,7 +722,7 @@ diversion_truename(const char *const *argv)
        namenode = findnamenode(filename, fnn_nonew);
 
        /* Print the given name if file is not diverted. */
-       if (namenode && namenode->divert->useinstead)
+       if (namenode && namenode->divert && namenode->divert->useinstead)
                printf("%s\n", namenode->divert->useinstead->name);
        else
                printf("%s\n", filename);
@@ -744,7 +744,7 @@ diversion_listpackage(const char *const *argv)
        namenode = findnamenode(filename, fnn_nonew);
 
        /* Print nothing if file is not diverted. */
-       if (namenode == NULL)
+       if (namenode == NULL || namenode->divert == NULL)
                return 0;
 
        if (namenode->divert->pkgset == NULL)

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/dpkg/dpkg.git

Reply via email to