Bug 8947 - opkg conffile resolution cannot detect unmodified conffiles modified in upgraded package
Summary: opkg conffile resolution cannot detect unmodified conffiles modified in upgra...
Status: RESOLVED WORKSFORME
Alias: None
Product: opkg
Classification: Yocto Project Subprojects
Component: opkg (show other bugs)
Version: unspecified
Hardware: All Multiple
: Undecided major
Target Milestone: 0.4.5
Assignee: Alex Stewart
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2016-01-19 18:28 UTC by Richard Tollerton
Modified: 2021-03-22 16:44 UTC (History)
0 users

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: Don't know


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Tollerton 2016-01-19 18:28:03 UTC
On package upgrade, resolve_conffiles (opkg_install.c, http://git.yoctoproject.org/cgit/cgit.cgi/opkg/tree/libopkg/opkg_install.c?id=7885da3974de2df1baba220200d55920fb530e25#n770) checks whether or not the new conffile should be renamed to *-opkg by comparing the md5sum of the currently existing conffile with the md5sum of the *new* package version. The conffiles of the old package version are not queried. This means that it can't detect if a conffile has not been modified. If the conffile changed in the new version of the package, it still gets renamed to *-opkg, even if the file wasn't changed on disk.

To reproduce, AFAIK:
- Install a package containing a conffile
- Edit the source conffile
- Bump the version number
- Rebuild the package
- Upgrade to the new package version
Comment 1 Alejandro del Castillo 2018-12-20 23:55:26 UTC
Re-targeting in preparation for 0.4 release
Comment 2 Alex Stewart 2021-03-19 13:45:52 UTC
I haven't been able to reproduce this issue. 

I've pushed a regression test here[1] that I think should reproduce, using the steps that Rich has provided, but opkg seems to do the right thing. When the conffile contents changes in v2, the conffile is replaced wholesale. When you modify ("locally") the conffile between upgrades, opkg prints the appropriate info and saves the v2 conffile as `issue8947-a.conf-opkg` instead of overwriting the local copy.

[1] https://gitlab.com/astewart.49c6/opkg/-/blob/b690d6dc4accfb05eb317b367d636038e4645333/tests/regress/issue8947.py

I know it's been a while, but do you have any more insights Rich?


>On package upgrade, resolve_conffiles (opkg_install.c) checks whether or not the new conffile should be renamed to *-opkg by comparing the md5sum of the currently existing conffile with the md5sum of the *new* package version.

resolve_conffiles() is called *after* the new package's conffiles have been copied into place. The MD5SUM comparison to determine if there have been local modifications is done by backup_modified_conffiles() [2].

[2] https://git.yoctoproject.org/cgit/cgit.cgi/opkg/tree/libopkg/opkg_install.c?id=e544c04eeadec7ade2c58c7be506acafb011a4a9#n342
Comment 3 Richard Tollerton 2021-03-22 16:02:04 UTC
I only precisely recall that I filed this after talking with Alejandro about it. It was always a somewhat aspirational bug report. If the code disagrees, close this.
Comment 4 Alex Stewart 2021-03-22 16:44:17 UTC
OK. In that case, I'll close this as not-reproducible. If anyone runs into a similar issue, please file a new bug and (ideally) create a reproducing case in the regression tests.