Bug 4556

Summary: dpkg fails to re-install config files when unchanged
Product: Busybox Reporter: Damion <damion.desoto>
Component: OtherAssignee: unassigned
Status: NEW ---    
Severity: normal CC: busybox-cvs
Priority: P5    
Version: 1.19.x   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Host: Target:
Build:
Attachments: A patch to apply described change

Description Damion 2011-11-29 03:17:59 UTC
dpkg is supposed to check all files in a debian package that are listed in 'conffiles' against the currently installed versions to see if they have been locally modified.  This is done via md5sums.
The current code is broken, and attempts to check the calculated md5sum against the filename, which will never match. (busybox/archival/dpkg.c filter_rename_config(archive_handle_t *archive_handle)).
Thus, local config files are never upgraded.

I assume the correct checking should be done against the contents of the debian package control file named 'md5sums' rather than the current linked list of 'conffiles'
Comment 1 Bobi B. 2012-07-31 08:17:08 UTC
The problem is, that busybox searches for MD5 sum using file's full path, including leading slash

    6583a05c20dfb3784cd48fef2c59aa05  /etc/protocols

whereas in md5sums leading slash is omitted

    6583a05c20dfb3784cd48fef2c59aa05  etc/protocols

On my Debian box md5sums files has no leading slashes, so the quickest fix is to replace

    sprintf(bin2hex(md5line, buf, 16), "  %s", name_ptr);

with

    sprintf(bin2hex(md5line, buf, 16), "  %s", name_ptr + 1);

in archival/dpkg.c:1553. Another option is to look for both.
Comment 2 Bobi B. 2012-07-31 08:18:09 UTC
Created attachment 4472 [details]
A patch to apply described change