Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 692746

Summary: sys-apps/portage: dev-db/mysql-connector-c-8.0.17-r2::gentoo (masked by: backtracking: slot conflict)
Product: Portage Development Reporter: Zac Medico <zmedico>
Component: Core - Interface (emerge)Assignee: Portage team <dev-portage>
Status: RESOLVED FIXED    
Severity: normal CC: esigra, whissi
Priority: Normal Keywords: InVCS
Version: unspecified   
Hardware: All   
OS: All   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=531656
https://bugs.gentoo.org/show_bug.cgi?id=693836
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on: 693242    
Bug Blocks: 300071, 691278    
Attachments: debug log
debug log for successful calculation with similar configuration
patch which causes some unit test to fail due to slot conflicts that would be solved by downgrades

Description Zac Medico gentoo-dev 2019-08-22 23:56:15 UTC
Created attachment 587812 [details]
debug log

> WARNING: One or more updates/rebuilds have been skipped due to a dependency conflict:
> 
> dev-db/mysql-connector-c:0
> 
>   (dev-db/mysql-connector-c-8.0.17-r2:0/21::gentoo, ebuild scheduled for merge) conflicts with
>     dev-db/mysql-connector-c:0/18[abi_x86_64(-)] required by (virtual/libmysqlclient-18-r1:0/18::gentoo, installed)
>                             ^^^^^               
> 
> 
> !!! The following update(s) have been skipped due to unsatisfied dependencies
> !!! triggered by backtracking:
> 
> virtual/libmysqlclient:0
Comment 1 Zac Medico gentoo-dev 2019-08-24 20:01:58 UTC
Created attachment 587966 [details]
debug log for successful calculation with similar configuration

I've attempted to reproduce the problem, but the calculation succeeds like this:

> # emerge -pvuD @world
> 
> These are the packages that would be merged, in order:
> 
> Calculating dependencies... done!
> [ebuild     U ~] dev-db/mysql-connector-c-8.0.17-r3:0/21::gentoo [6.1.11-r2:0/18::gentoo] USE="-ldap% -libressl -static-libs" ABI_X86="(64) -32 (-x32)" 184885 KiB
> [ebuild  r  U ~] virtual/libmysqlclient-21:0/21::gentoo [18-r1:0/18::gentoo] USE="-static-libs" ABI_X86="(64) -32 (-x32)" 0 KiB
> [ebuild  rR    ] dev-perl/DBD-mysql-4.44.0::gentoo  USE="ssl -test" 0 KiB
> [ebuild     U ~] dev-db/percona-server-5.7.26.29-r1:0/18::gentoo [5.7.26.29:0/18::gentoo] USE="pam perl server -cjk (-client-libs) -cracklib -debug -experimental -jemalloc -latin1 -libressl -numa -profiling -rocksdb (-selinux) -static -static-libs -systemtap -tcmalloc -test -tokudb -tokudb-backup-plugin -yassl" ABI_X86="(64) -32 (-x32)" 0 KiB
> [blocks b      ] <dev-db/percona-server-5.7.26.29-r1 ("<dev-db/percona-server-5.7.26.29-r1" is blocking dev-db/mysql-connector-c-8.0.17-r3)
> 
> Total: 4 packages (3 upgrades, 1 reinstall), Size of downloads: 184885 KiB
> Conflict: 1 block
> 
> The following packages are causing rebuilds:
> 
>   (virtual/libmysqlclient-21:0/21::gentoo, ebuild scheduled for merge) causes rebuilds for:
>     (dev-perl/DBD-mysql-4.44.0:0/0::gentoo, ebuild scheduled for merge)
Comment 2 Zac Medico gentoo-dev 2019-08-24 20:15:01 UTC
I can reproduce the problem after I removed virtual/libmysqlclient from my world file.
Comment 3 Zac Medico gentoo-dev 2019-08-24 21:35:14 UTC
This slot conflict occurs:

> backtracking due to slot conflict:
>    first package:  (dev-db/mysql-connector-c-6.1.11-r2:0/18::gentoo, installed)
>   package to mask: (dev-db/mysql-connector-c-8.0.17-r3:0/21::gentoo, ebuild scheduled for merge)
>       slot: dev-db/mysql-connector-c:0
>    parents: ((dev-db/percona-server-5.7.26.29-r1:0/18::gentoo, ebuild scheduled for merge), 'dev-db/mysql-connector-c[abi_x86_64(-)]'), ((virtual/libmysqlclient-18-r1:0/18::gentoo, installed), 'dev-db/mysql-connector-c:0/18[abi_x86_64(-)]'), ((dev-db/mysql-init-scripts-2.3:0/0::gentoo, installed), 'dev-db/mysql-connector-c')

Since all of the parent atoms match dev-db/mysql-connector-c-6.1.11-r2:0/18, it masks dev-db/mysql-connector-c-8.0.17-r3:0/21 and prevents the update.

It doesn't recognize that it should trigger a rebuild because none of the parent atoms are := slot operators at this point in the calculation. The slot conflict is triggered solely by the dev-db/mysql-connector-c:0/18[abi_x86_64(-)] atom.
Comment 4 Zac Medico gentoo-dev 2019-08-24 21:52:53 UTC
In fact there are no dev-db/mysql-connector-c:= dependencies, the closest thing is the virtual/libmysqlclient:= dependency of dev-perl/DBD-mysql.
Comment 5 Zac Medico gentoo-dev 2019-08-24 22:38:07 UTC
Created attachment 587974 [details, diff]
patch which causes some unit test to fail due to slot conflicts that would be solved by downgrades

This patch currently causes the following unit test to fail due to slot conflicts that would be solved by downgrades:

> ======================================================================
> FAIL: testSlotOperatorCompleteGraph
> (portage.tests.resolver.test_slot_operator_complete_graph.SlotOperatorCompleteGraphTestCase)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "lib/portage/tests/__init__.py, line 211, in run
>     testMethod()
>   File "lib/portage/tests/resolver/test_slot_operator_complete_graph.py", line 137, in testSlotOperatorCompleteGraph
>     test_case.fail_msg)
> AssertionError: False != True : atoms: (=app-misc/meta-pkg-2, app-misc/C), key: success, expected: True, got: False
> atoms: (=app-misc/meta-pkg-2, app-misc/C), key: slot_collision_solutions, expected: None, got: []
> 
> ======================================================================
> FAIL: testSlotOperatorRuntimePkgMask
> (portage.tests.resolver.test_slot_operator_runtime_pkg_mask.SlotOperatorRuntimePkgMaskTestCase)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "lib/portage/tests/__init__.py", line 211, in run
>     testMethod()
>   File "lib/portage/tests/resolver/test_slot_operator_runtime_pkg_mask.py", line 132, in testSlotOperatorRuntimePkgMask
>     test_case.fail_msg)
> AssertionError: False != True : atoms: (=app-misc/meta-pkg-2), key: success, expected: True, got: False
> atoms: (=app-misc/meta-pkg-2), key: slot_collision_solutions, expected: None, got: []
> 
> ======================================================================
> FAIL: testSonameSkipUpdate (portage.tests.resolver.soname.test_skip_update.SonameSkipUpdateTestCase)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "lib/portage/tests/__init__.py", line 211, in run
>     testMethod()
>   File "lib/portage/tests/resolver/soname/test_skip_update.py", line 82, in testSonameSkipUpdate
>     test_case.fail_msg)
> AssertionError: False != True : atoms: (@world), key: success, expected: True, got: False
> atoms: (@world), key: mergelist, expected: [], got: ['[binary]dev-libs/B-1', '[binary]dev-libs/B-2', '[binary]app-misc/A-1']
> atoms: (@world), key: slot_collision_solutions, expected: None, got: []
Comment 6 Zac Medico gentoo-dev 2019-08-24 22:47:06 UTC
This is similar to bug 531656 in the sense that we need to be more aggressive about trying to prefer updates in the event of a slot conflict.
Comment 7 Zac Medico gentoo-dev 2019-08-25 15:08:16 UTC
This unit test reproduces the issue:

lib/portage/tests/resolver/test_slot_conflict_update_virt.py

https://github.com/zmedico/portage/compare/master..bug_692746_missed_mysql-connector-c_update

With the patch for this bug, the debug log for the slot conflict with impossible upgrade in lib/portage/tests/resolver/soname/test_skip_update.py shows that the backtracker masks installed instances and corresponding binary packages, and never considers unmasking them:

backtracking try 2 

runtime_pkg_mask: {<Package ('binary', '/tmp/tmpwsp8hrj_/', 'dev-libs/B-1', 'merge', 'None', '208', '0', '1566696256')>: {'slot conflict': set()}} 

backtracking try 3

runtime_pkg_mask: {<Package ('binary', '/tmp/tmpwsp8hrj_/', 'dev-libs/B-1', 'merge', 'None', '208', '0', '1566696256')>: {'slot conflict': set()}, <Package ('installed', '/tmp/tmpwsp8hrj_/', 'dev-libs/B-1', 'nomerge', 'installed')>: {'slot conflict': set()}} 

backtracking try 4

runtime_pkg_mask: {<Package ('binary', '/tmp/tmpwsp8hrj_/', 'dev-libs/B-1', 'merge', 'None', '208', '0', '1566696256')>: {'slot conflict': set()}, <Package ('installed', '/tmp/tmpwsp8hrj_/', 'dev-libs/B-1', 'nomerge', 'installed')>: {'slot conflict': set()}, <Package ('binary', '/tmp/tmpwsp8hrj_/', 'app-misc/A-1', 'merge', 'None', '265', '0', '1566696256')>: {'missing dependency': {(<Package ('binary', '/tmp/tmpwsp8hrj_/', 'app-misc/A-1', 'merge', 'None', '265', '0', '1566696256')>, '/tmp/tmpwsp8hrj_/', SonameAtom('x86_32', 'libB.so.1'))}}}  

backtracking try 5

runtime_pkg_mask: {<Package ('binary', '/tmp/tmpwsp8hrj_/', 'dev-libs/B-1', 'merge', 'None', '208', '0', '1566696256')>: {'slot conflict': set()}, <Package ('installed', '/tmp/tmpwsp8hrj_/', 'dev-libs/B-1', 'nomerge', 'installed')>: {'slot conflict': set()}, <Package ('binary', '/tmp/tmpwsp8hrj_/', 'app-misc/A-1', 'merge', 'None', '265', '0', '1566696256')>: {'missing dependency': {(<Package ('binary', '/tmp/tmpwsp8hrj_/', 'app-misc/A-1', 'merge', 'None', '265', '0', '1566696256')>, '/tmp/tmpwsp8hrj_/', SonameAtom('x86_32', 'libB.so.1'))}}, <Package ('installed', '/tmp/tmpwsp8hrj_/', 'app-misc/A-1', 'nomerge', 'installed')>: {'missing dependency': {(<Package ('installed', '/tmp/tmpwsp8hrj_/', 'app-misc/A-1', 'nomerge', 'installed')>, '/tmp/tmpwsp8hrj_/', SonameAtom('x86_32', 'libB.so.1'))}}} 

backtracking aborted after 5 tries
Comment 9 Larry the Git Cow gentoo-dev 2019-09-01 17:54:07 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage.git/commit/?id=994ac00aa764615ec6d319c7c1cb8123cf9f2aa1

commit 994ac00aa764615ec6d319c7c1cb8123cf9f2aa1
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2019-08-24 22:30:29 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2019-09-01 17:33:54 +0000

    _slot_confict_backtrack: consider masking a package matched by all parent atoms (bug 692746)
    
    When a slot conflict occurs involving a package that is matched by all
    involved parent atoms, consider masking the package in order to avoid
    a possible missed update. The included unit test demonstrates the case
    fixed by this patch. There are 2 previously existing unit tests that
    require larger backtracking values in order to succeed with this patch,
    since more possible solutions are now considered.
    
    Bug: https://bugs.gentoo.org/692746
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 lib/_emerge/depgraph.py                            |  5 ++
 lib/_emerge/resolver/backtracking.py               |  9 +++
 .../resolver/test_slot_conflict_update_virt.py     | 79 ++++++++++++++++++++++
 .../resolver/test_slot_operator_complete_graph.py  |  2 +-
 .../test_slot_operator_runtime_pkg_mask.py         |  2 +-
 5 files changed, 95 insertions(+), 2 deletions(-)
Comment 10 Larry the Git Cow gentoo-dev 2019-09-01 21:20:57 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fc1ee19f135a3446d16deac8f783472b464e3a2e

commit fc1ee19f135a3446d16deac8f783472b464e3a2e
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2019-09-01 21:12:24 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2019-09-01 21:20:36 +0000

    sys-apps/portage: Bump to version 2.3.75
    
     #235970 glsa-check: add --reverse option
     #692134 glsa-check: fix truncated CVE ids in listmode
     #692746 missed virtual/libmysqlclient update
     #693242 premature backtracking termination
    
    Bug: https://bugs.gentoo.org/691278
    Bug: https://bugs.gentoo.org/235970
    Bug: https://bugs.gentoo.org/692134
    Bug: https://bugs.gentoo.org/692746
    Bug: https://bugs.gentoo.org/693242
    Package-Manager: Portage-2.3.75, Repoman-2.3.17
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 sys-apps/portage/Manifest              |   1 +
 sys-apps/portage/portage-2.3.75.ebuild | 261 +++++++++++++++++++++++++++++++++
 2 files changed, 262 insertions(+)