• Status New
  • Percent Complete
    0%
  • Task Type Bug Report
  • Category ports → core/opt
  • Assigned To
    crux
  • Operating System CRUX
  • Severity Low
  • Priority Very Low
  • Reported Version 3.3
  • Due in Version Undecided
  • Due Date Undecided
  • Votes 1
    • fun (14.04.2017)
  • Private
Attached to Project: CRUX
Opened by alancio - 24.10.2014
Last edited by pedja - 16.06.2017

FS#1074 - package upgrades removes files if they don't exist in the new package, regardless of rejection rules

pkgadd -u removes files if they don't exist in the new package, regardless of the rejection rules in pkgadd.conf.

As a test I create package for app-1.0 with /etc/app.conf, and then app-2.0 without it:

[root@koji ~]# mkdir etc
[root@koji ~]# echo default configuration > etc/app.conf
[root@koji ~]# tar -czf app#1.0-1.pkg.tar.gz etc
[root@koji ~]# rm etc/app.conf
[root@koji ~]# tar -czf app#2.0-1.pkg.tar.gz etc

I will install app-1.0, and then customize my configuration file:

[root@koji ~]# pkgadd app#1.0-1.pkg.tar.gz
[root@koji tmp]# cat /etc/app.conf
default configuration
[root@koji tmp]# echo customized configuration > /etc/app.conf

Now I will upgrade to app-2.0, and my custom configuration file will be gone:

[root@koji tmp]# pkgadd -u app#2.0-1.pkg.tar.gz
[root@koji tmp]# ls -l /etc/app.conf
ls: cannot access /etc/app.conf: No such file or directory

My pkgadd.conf contains:
UPGRADE ^etc/.*$ NO

fun commented on 18.06.2017 14:40

Attached a patch that seems to fix this, with a drawback.

   0001-pkgadd-apply-rejection-r... (2.3 KiB)
fun commented on 16.07.2017 15:24

Re-adding patch

Inserting items into a single keep list is one way to shield them from deletion, but as noted in fun's patch, it has the drawback of allowing stale files to "leak" into the sysroot. When I observed that the two-argument variant of db_rm_pkg was only being used during an upgrade transaction, I asked why this situation wasn't being handled with two keep lists. The keep list for the newer package has to be used during pkg_install, of course, but why not also pass a third argument to db_rm_pkg (and let this function do something more intelligent with the files in one set but not the other)?

Attached is a patch that changes the function signature of db_rm_pkg to prevent the unwanted deletions. I've tested it on a trivial upgrade of mpv (first package built with --sysconfdir=/etc, the later release built with --sysconfdir=/usr/etc, and the directive "UPGRADE ^etc/.*$ NO" in pkgadd.conf). The updated rejmerge (included with the patch) provides an interactive menu for deciding what to do with the stale files.

Loading...

Available keyboard shortcuts

Tasklist

Task Details

Task Editing