apport should always check if a package's conffiles are modified

Bug #803963 reported by Steve Langasek
This bug affects 1 person
Affects Status Importance Assigned to Milestone
apport (Ubuntu)

Bug Description

Several per-package apport hooks grab the conffiles for their particular package. But in general, we should always check whether a package that includes conffiles has had those conffiles modified by the admin. This information is available in the dpkg database; and while we can't assume it's safe to attach all modified conffiles (due to possibly sensitive contents), we can at least mention in the bug report if they've been modified.

Steve Langasek (vorlon)
Changed in apport (Ubuntu):
status: New → Triaged
importance: Undecided → Wishlist
Revision history for this message
Brian Murray (brian-murray) wrote :

This is actually done already in apport for all apport-package bug reports:

def attach_conffiles(report, package, conffiles=None):
    '''Attach information about any modified or deleted conffiles'''

       dpkg = subprocess.Popen(['dpkg-query','-W','--showformat=${Conffiles}',
           package], stdout=subprocess.PIPE, close_fds=True)
    except OSError, e:
       return 'Error: ' + str(e)

    out = dpkg.communicate()[0]
    if dpkg.returncode != 0:

    for line in out.splitlines():
        if not line:
        # just take the first two fields, to not stumble over obsolete
        # conffiles
        path, default_md5sum = line.strip().split()[:2]

        if conffiles and path not in conffiles: continue

        key = 'modified.conffile.' + path_to_key(path)

        if os.path.exists(path):
            contents = open(path).read()
            m = hashlib.md5()
            calculated_md5sum = m.hexdigest()

            if calculated_md5sum != default_md5sum:
                report[key] = contents
                statinfo = os.stat(path)
                mtime = datetime.datetime.fromtimestamp(statinfo.st_mtime)
                mtime_key = 'mtime.conffile.' + path_to_key(path)
                report[mtime_key] = mtime.isoformat()
            report[key] = '[deleted]'

Revision history for this message
Brian Murray (brian-murray) wrote :

I'm working on a branch to that'll ask a user whether or not a modified conffile should be attached to the bug report and this is being tracked in bug 811203.

Changed in apport (Ubuntu):
status: Triaged → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.