dpkg/update-alternatives-slavetomaster.patch
Frank Schreiner 4ddd505dd7 Accepting request 863143 from home:lnussel:usrmove
- don't remove slave links that turned into master. Happens on usrmerge
  (boo#1180939, update-alternatives-slavetomaster.patch)

OBS-URL: https://build.opensuse.org/request/show/863143
OBS-URL: https://build.opensuse.org/package/show/system:packagemanager/dpkg?expand=0&rev=77
2021-02-03 15:49:49 +00:00

17 lines
723 B
Diff

Index: dpkg-1.19.0.5/utils/update-alternatives.c
===================================================================
--- dpkg-1.19.0.5.orig/utils/update-alternatives.c
+++ dpkg-1.19.0.5/utils/update-alternatives.c
@@ -1796,7 +1796,10 @@ alternative_prepare_install(struct alter
/* Drop unused slave. */
fn = xasprintf("%s/%s", altdir, sl->name);
if (alternative_path_can_remove(sl->link))
- alternative_add_commit_op(a, OPCODE_RM, sl->link, NULL);
+ if (strcmp(sl->link, a->master_link))
+ alternative_add_commit_op(a, OPCODE_RM, sl->link, NULL);
+ else
+ warning("not removing %s, now master", a->master_link);
else
warning(_("not removing %s since it's not a symlink"),
sl->link);