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) |
Invalid
|
Wishlist
|
Unassigned |
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.
Changed in apport (Ubuntu): | |
status: | New → Triaged |
importance: | Undecided → Wishlist |
To post a comment you must log in.
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'''
try: Popen([ 'dpkg-query' ,'-W',' --showformat= ${Conffiles} ',
package] , stdout= subprocess. PIPE, close_fds=True)
dpkg = subprocess.
except OSError, e:
return 'Error: ' + str(e)
out = dpkg.communicat e()[0]
if dpkg.returncode != 0:
return
for line in out.splitlines():
continue ).split( )[:2]
if not line:
# just take the first two fields, to not stumble over obsolete
# conffiles
path, default_md5sum = line.strip(
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. update( contents)
calculated _md5sum = m.hexdigest()
m = hashlib.md5()
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]'
else: