Subject: Re: [alpine-devel] [PATCH 0/1] apk upgrade has issues when old deps still available

From: Timo Teras <[email-masked]>
Date: Mon, 3 Jun 2019 14:57:53 +0300

Hi,

On Mon, 3 Jun 2019 05:04:30 -0500
"A. Wilcox" <[email-masked]> wrote:

> The easiest way that I can think of for you to duplicate it would be
> to install Adélie beta2 with qt5-qtbase-dev in a chroot, then attempt
> to upgrade it to beta3:
> 
> # mkdir /test
> 
> # apk --root /test -X
> https://distfiles.adelielinux.org/adelie/1.0-beta2/system -X
> https://distfiles.adelielinux.org/adelie/1.0-beta2/user
> --allow-untrusted --initdb add adelie-base qt5-qtbase-dev
> 
> # apk --root /test -X
> https://distfiles.adelielinux.org/adelie/1.0-beta3/system -X
> https://distfiles.adelielinux.org/adelie/1.0-beta3/user upgrade -al
> 
> On the x86_64 machine I tested this on, there was a slightly different
> error, but the same cause/effect:

Thanks for this.

Does this look like the correct answer?

$ make && src/apk --root ~/test/  -X http://distfiles.adelielinux.org/adelie/1.0-beta3/system -X http://distfiles.adelielinux.org/adelie/1.
0-beta3/user upgrade -al --simulate --no-self-upgrade 
(1/184) Upgrading musl (1.1.21-r3 -> 1.1.22-r0)
(2/184) Upgrading ncurses-terminfo-base (6.1_p20181020-r0 -> 6.1.20190413-r0)
(3/184) Upgrading ncurses-terminfo (6.1_p20181020-r0 -> 6.1.20190413-r0)
(4/184) Upgrading ncurses-libs (6.1_p20181020-r0 -> 6.1.20190413-r0)
(5/184) Upgrading bash (4.4.23-r0 -> 4.4.23-r1)
(6/184) Upgrading bash-binsh (4.4.23-r0 -> 4.4.23-r1)
(7/184) Replacing libacl (2.2.53-r0 -> 2.2.53-r0)
(8/184) Replacing libattr (2.4.48-r0 -> 2.4.48-r0)
(9/184) Upgrading coreutils (8.30-r0 -> 8.31-r0)
(10/184) Downgrading mawk (20171017-r0 -> 1.3.4.20171017-r0)
(11/184) Upgrading debianutils (4.8.6-r1 -> 4.8.6.1-r0)
(12/184) Replacing zlib (1.2.11-r1 -> 1.2.11-r1)
(13/184) Upgrading libcrypto1.0 (1.0.2p-r0 -> 1.0.2r-r0)
(14/184) Upgrading ca-certificates (20180411-r1 -> 20190131-r0)
(15/184) Upgrading libssl1.0 (1.0.2p-r0 -> 1.0.2r-r0)
(16/184) Upgrading apk-tools (2.10.3-r0 -> 2.10.3-r1)
(17/184) Replacing adelie-keys (1.0-r0 -> 1.0-r0)
(18/184) Replacing scanelf (1.2.3-r0 -> 1.2.3-r0)
(19/184) Upgrading musl-utils (1.1.21-r3 -> 1.1.22-r0)
(20/184) Upgrading linux-pam (1.3.1-r1 -> 1.3.1-r2)
(21/184) Replacing shadow (4.6-r2 -> 4.6-r2)
(22/184) Upgrading shimmy (0.5-r0 -> 0.6-r0)
(23/184) Upgrading pcre (8.42-r1 -> 8.43-r0)
(24/184) Upgrading grep (3.1-r2 -> 3.3-r0)
(25/184) Replacing libproc (3.3.15-r1 -> 3.3.15-r1)
(26/184) Replacing procps (3.3.15-r1 -> 3.3.15-r1)
(27/184) Upgrading diffutils (3.6-r2 -> 3.7-r0)
(28/184) Replacing findutils (4.6.0-r2 -> 4.6.0-r2)
(29/184) Replacing libcap-ng (0.7.9-r0 -> 0.7.9-r0)
(30/184) Upgrading libuuid (2.32.1-r1 -> 2.33.2-r0)
(31/184) Upgrading libfdisk (2.32.1-r1 -> 2.33.2-r0)
(32/184) Upgrading util-linux (2.32.1-r1 -> 2.33.2-r0)
(33/184) Replacing mii-tool (1.60_git20140218-r3 -> 1.60_git20140218-r3)
(34/184) Replacing net-tools (1.60_git20140218-r3 -> 1.60_git20140218-r3)
(35/184) Replacing nvi (1.79-r1 -> 1.79-r1)
(36/184) Replacing sed (4.7-r0 -> 4.7-r0)
(37/184) Upgrading psmisc (23.1-r0 -> 23.1-r1)
(38/184) Replacing less (530-r0 -> 530-r0)
(39/184) Upgrading tzdata (2018g-r0 -> 2019a-r0)
(40/184) Upgrading adelie-core (0.9.1-r2 -> 0.9.2-r0)
(41/184) Upgrading binutils-libs (2.31.1-r2 -> 2.32-r0)
(42/184) Upgrading binutils (2.31.1-r2 -> 2.32-r0)
(43/184) Replacing kbd (2.0.4-r1 -> 2.0.4-r1)
(44/184) Upgrading console-setup (1.187-r0 -> 1.191-r0)
(45/184) Upgrading libmagic (5.35-r0 -> 5.36-r0)
(46/184) Upgrading file (5.35-r0 -> 5.36-r0)
(47/184) Upgrading execline (2.5.0.1-r2 -> 2.5.1.0-r0)
(48/184) Upgrading s6 (2.7.2.2-r0 -> 2.8.0.0-r0)
(49/184) Replacing sysvinit (2.88-r5 -> 2.88-r5)
(50/184) Replacing gettys-openrc (0.0.1.0-r3 -> 0.0.1.0-r3)
(51/184) Replacing libbz2 (1.0.6-r7 -> 1.0.6-r7)
(52/184) Replacing expat (2.2.6-r0 -> 2.2.6-r0)
(53/184) Upgrading lz4-libs (1.8.2-r0 -> 1.8.3-r0)
(54/184) Replacing xz-libs (5.2.4-r1 -> 5.2.4-r1)
(55/184) Replacing libarchive-tools (3.3.3-r0 -> 3.3.3-r0)
(56/184) Upgrading libgcc (6.4.0-r9 -> 8.3.0-r0)
(57/184) Upgrading libstdc++ (6.4.0-r9 -> 8.3.0-r0)
(58/184) Upgrading groff (1.22.3-r2 -> 1.22.4-r0)
(59/184) Upgrading gzip (1.9-r1 -> 1.10-r0)
(60/184) Upgrading db (5.3.28-r0 -> 5.3.28-r1)
(61/184) Upgrading libpipeline (1.5.0-r0 -> 1.5.1-r0)
(62/184) Upgrading man-db (2.8.4-r1 -> 2.8.5-r0)
(63/184) Replacing patch (2.7.6-r3 -> 2.7.6-r3)
(64/184) Replacing bzip2 (1.0.6-r7 -> 1.0.6-r7)
(65/184) Replacing sharutils (4.15.2-r1 -> 4.15.2-r1)
(66/184) Replacing sysklogd (1.5.1-r2 -> 1.5.1-r2)
(67/184) Upgrading zsh (5.6.2-r1 -> 5.7.1-r0)
(68/184) Upgrading adelie-base (0.9.1-r2 -> 0.9.2-r0)
(69/184) Upgrading pkgconf (1.5.4-r0 -> 1.6.1-r0)
(70/184) Upgrading util-linux-dev (2.32.1-r1 -> 2.33.2-r0)
(71/184) Upgrading dbus-libs (1.12.10-r0 -> 1.12.12-r0)
(72/184) Upgrading dbus-dev (1.12.10-r0 -> 1.12.12-r0)
(73/184) Replacing libpng (1.6.36-r0 -> 1.6.36-r0)
(74/184) Upgrading freetype (2.9.1-r2 -> 2.10.0-r0)
(75/184) Replacing fontconfig (2.13.1-r0 -> 2.13.1-r0)
(76/184) Replacing expat-dev (2.2.6-r0 -> 2.2.6-r0)
(77/184) Replacing zlib-dev (1.2.11-r1 -> 1.2.11-r1)
(78/184) Replacing libpng-dev (1.6.36-r0 -> 1.6.36-r0)
(79/184) Upgrading freetype-dev (2.9.1-r2 -> 2.10.0-r0)
(80/184) Replacing fontconfig-dev (2.13.1-r0 -> 2.13.1-r0)
(81/184) Replacing perl (5.26.3-r0 -> 5.26.3-r0)
(82/184) Replacing libffi (3.2.1-r4 -> 3.2.1-r4)
(83/184) Upgrading sqlite-libs (3.26.0-r0 -> 3.28.0-r0)
(84/184) Replacing python3 (3.6.5-r0 -> 3.6.5-r0)
(85/184) Replacing attr-dev (2.4.48-r0 -> 2.4.48-r0)
(86/184) Replacing bzip2-dev (1.0.6-r7 -> 1.0.6-r7)
(87/184) Replacing libffi-dev (3.2.1-r4 -> 3.2.1-r4)
(88/184) Upgrading glib (2.58.1-r0 -> 2.60.2-r0)
(89/184) Upgrading libpcre16 (8.42-r1 -> 8.43-r0)
(90/184) Upgrading libpcre32 (8.42-r1 -> 8.43-r0)
(91/184) Upgrading libpcrecpp (8.42-r1 -> 8.43-r0)
(92/184) Upgrading pcre-dev (8.42-r1 -> 8.43-r0)
(93/184) Upgrading glib-dev (2.58.1-r0 -> 2.60.2-r0)
(94/184) Replacing libice (1.0.9-r3 -> 1.0.9-r3)
(95/184) Replacing util-macros (1.19.2-r0 -> 1.19.2-r0)
(96/184) Upgrading xorgproto-dev (2018.4-r0 -> 2018.4-r1)
(97/184) Replacing libice-dev (1.0.9-r3 -> 1.0.9-r3)
(98/184) Replacing libsm (1.2.3-r0 -> 1.2.3-r0)
(99/184) Replacing libsm-dev (1.2.3-r0 -> 1.2.3-r0)
(100/184) Upgrading xtrans (1.3.5-r1 -> 1.4.0-r0)
(101/184) Upgrading libxau (1.0.8-r3 -> 1.0.9-r0)
(102/184) Replacing libbsd (0.9.1-r0 -> 0.9.1-r0)
(103/184) Upgrading libxdmcp (1.1.2-r5 -> 1.1.3-r0)
(104/184) Replacing libxcb (1.13.1-r0 -> 1.13.1-r0)
(105/184) Replacing libx11 (1.6.7-r0 -> 1.6.7-r0)
(106/184) Upgrading libxau-dev (1.0.8-r3 -> 1.0.9-r0)
(107/184) Replacing xcb-proto (1.13-r0 -> 1.13-r0)
(108/184) Replacing libpthread-stubs (0.4-r0 -> 0.4-r0)
(109/184) Upgrading libxdmcp-dev (1.1.2-r5 -> 1.1.3-r0)
(110/184) Replacing libxcb-dev (1.13.1-r0 -> 1.13.1-r0)
(111/184) Replacing libx11-dev (1.6.7-r0 -> 1.6.7-r0)
(112/184) Upgrading libxext (1.3.3-r3 -> 1.3.4-r0)
(113/184) Upgrading libxext-dev (1.3.3-r3 -> 1.3.4-r0)
(114/184) Replacing linux-headers (4.14.88-r13 -> 4.14.88-r13)
(115/184) Replacing libpciaccess (0.14-r0 -> 0.14-r0)
(116/184) Upgrading libdrm (2.4.96-r0 -> 2.4.98-r0)
(117/184) Upgrading libdrm-dev (2.4.96-r0 -> 2.4.98-r0)
(118/184) Upgrading libxdamage (1.1.4-r2 -> 1.1.5-r0)
(119/184) Replacing libxfixes (5.0.3-r2 -> 5.0.3-r2)
(120/184) Replacing libxfixes-dev (5.0.3-r2 -> 5.0.3-r2)
(121/184) Upgrading libxdamage-dev (1.1.4-r2 -> 1.1.5-r0)
(122/184) Replacing libxshmfence (1.3-r0 -> 1.3-r0)
(123/184) Replacing libxshmfence-dev (1.3-r0 -> 1.3-r0)
(124/184) Upgrading mesa-gbm (18.3.2-r2 -> 18.3.6-r0)
(125/184) Upgrading mesa-glapi (18.3.2-r2 -> 18.3.6-r0)
(126/184) Upgrading mesa-egl (18.3.2-r2 -> 18.3.6-r0)
(127/184) Replacing libxxf86vm (1.1.4-r2 -> 1.1.4-r2)
(128/184) Upgrading mesa-gl (18.3.2-r2 -> 18.3.6-r0)
(129/184) Upgrading mesa-gles (18.3.2-r2 -> 18.3.6-r0)
(130/184) Upgrading mesa-osmesa (18.3.2-r2 -> 18.3.6-r0)
(131/184) Replacing libexecinfo (1.1-r1 -> 1.1-r1)
(132/184) Replacing icu-libs (63.1-r1 -> 63.1-r1)
(133/184) Upgrading libxml2 (2.9.8-r1 -> 2.9.9-r0)
(134/184) Installing llvm8-libs (8.0.0-r0)
(135/184) Upgrading mesa-xatracker (18.3.2-r2 -> 18.3.6-r0)
(136/184) Replacing libxv (1.0.11-r2 -> 1.0.11-r2)
(137/184) Upgrading libxvmc (1.0.10-r2 -> 1.0.11-r0)
(138/184) Replacing libelf (0.8.13-r4 -> 0.8.13-r4)
(139/184) Upgrading mesa (18.3.2-r2 -> 18.3.6-r0)
(140/184) Replacing libxxf86vm-dev (1.1.4-r2 -> 1.1.4-r2)
(141/184) Upgrading mesa-dev (18.3.2-r2 -> 18.3.6-r0)
(142/184) Upgrading openssl-dev (1.0.2p-r0 -> 1.0.2r-r0)
(143/184) Upgrading sqlite-dev (3.26.0-r0 -> 3.28.0-r0)
(144/184) Replacing libpcre2-16 (10.32-r0 -> 10.32-r0)
(145/184) Replacing qt5-qtbase (5.9.7-r0 -> 5.9.7-r0)
(146/184) Replacing qt5-qtbase-sqlite (5.9.7-r0 -> 5.9.7-r0)
(147/184) Replacing libltdl (2.4.6-r6 -> 2.4.6-r6)
(148/184) Replacing unixodbc (2.3.7-r0 -> 2.3.7-r0)
(149/184) Replacing qt5-qtbase-odbc (5.9.7-r0 -> 5.9.7-r0)
(150/184) Replacing libsasl (2.1.27-r0 -> 2.1.27-r0)
(151/184) Upgrading libldap (2.4.46-r0 -> 2.4.47-r0)
(152/184) Replacing libpq (10.5-r0 -> 10.5-r0)
(153/184) Replacing qt5-qtbase-postgresql (5.9.7-r0 -> 5.9.7-r0)
(154/184) Upgrading freetds (1.00.109-r0 -> 1.00.111-r0)
(155/184) Replacing qt5-qtbase-tds (5.9.7-r0 -> 5.9.7-r0)
(156/184) Replacing hicolor-icon-theme (0.17-r0 -> 0.17-r0)
(157/184) Replacing libxi (1.7.9-r2 -> 1.7.9-r2)
(158/184) Replacing gmp (6.1.2-r1 -> 6.1.2-r1)
(159/184) Replacing nettle (3.4.1-r0 -> 3.4.1-r0)
(160/184) Replacing libtasn1 (4.13-r0 -> 4.13-r0)
(161/184) Replacing p11-kit (0.23.15-r0 -> 0.23.15-r0)
(162/184) Replacing libunistring (0.9.10-r0 -> 0.9.10-r0)
(163/184) Upgrading gnutls (3.6.6-r0 -> 3.6.7.1-r0)
(164/184) Upgrading cups-libs (2.2.10-r1 -> 2.2.11-r0)
(165/184) Replacing graphite2 (1.3.13-r0 -> 1.3.13-r0)
(166/184) Upgrading harfbuzz (1.8.8-r1 -> 2.4.0-r0)
(167/184) Replacing libevdev (1.6.0-r0 -> 1.6.0-r0)
(168/184) Replacing mtdev (1.1.5-r3 -> 1.1.5-r3)
(169/184) Replacing eudev-libs (3.2.7-r0 -> 3.2.7-r0)
(170/184) Replacing libgudev (232-r0 -> 232-r0)
(171/184) Upgrading libwacom (0.32-r0 -> 0.33-r0)
(172/184) Upgrading libinput-libs (1.12.3-r0 -> 1.13.1-r0)
(173/184) Upgrading libjpeg-turbo (1.5.3-r2 -> 2.0.2-r0)
(174/184) Replacing xcb-util-wm (0.4.1-r2 -> 0.4.1-r2)
(175/184) Replacing xcb-util (0.4.0-r2 -> 0.4.0-r2)
(176/184) Replacing xcb-util-image (0.4.0-r1 -> 0.4.0-r1)
(177/184) Replacing xcb-util-keysyms (0.4.0-r2 -> 0.4.0-r2)
(178/184) Replacing xcb-util-renderutil (0.3.9-r2 -> 0.3.9-r2)
(179/184) Upgrading libxkbcommon (0.8.2-r0 -> 0.8.4-r0)
(180/184) Replacing qt5-qtbase-x11 (5.9.7-r0 -> 5.9.7-r0)
(181/184) Replacing qt5-qtbase-dev (5.9.7-r0 -> 5.9.7-r0)
(182/184) Purging utmps (0.0.2.0-r2)
(183/184) Purging skalibs (2.7.0.0-r1)
(184/184) Purging llvm6-libs (6.0.1-r0)
OK: 554 MiB in 183 packages

This is achieved with the following change:

--- a/src/solver.c
+++ b/src/solver.c
@@ -462,6 +462,8 @@ static void reconsider_name(struct apk_solver_state *ss, struct apk_name *name)
                                                   name->name, name0->name);
                                        name0->ss.requirers++;
                                        name_requirers_changed(ss, name0);
+                                       foreach_array_item(p, name0->providers)
+                                               inherit_pinning_and_flags(ss, p->pkg, pkg);
                                }
                        }
                }

If you think the output and the fix are good, I'll write a proper commit
message (and perhaps include some of the additional debug changes I
made) and push this.

Thanks,
Timo

---

From: Timo Teras <[email-masked]>
Date: Wed, 5 Jun 2019 13:43:29 +0300

On Mon, 3 Jun 2019 14:57:53 +0300
Timo Teras <[email-masked]> wrote:

> > On the x86_64 machine I tested this on, there was a slightly
> > different error, but the same cause/effect:  
> 
> Thanks for this.
>[snip]
> 
> If you think the output and the fix are good, I'll write a proper
> commit message (and perhaps include some of the additional debug
> changes I made) and push this.

Fixed in commit 
https://git.alpinelinux.org/apk-tools/commit/?id=b0be9f610c02bb2d5e681a3904940d311e9de298

Thanks for the report/analysis!

Timo