<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>14628</bug_id>
          
          <creation_ts>2021-11-12 18:24:35 +0000</creation_ts>
          <short_desc>opkg incorrectly fails to upgrade packages when an owned file has been transferred to a dependency.</short_desc>
          <delta_ts>2023-01-26 16:17:10 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>6</classification_id>
          <classification>Yocto Project Subprojects</classification>
          <product>opkg</product>
          <component>opkg</component>
          <version>0.4.5</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>ACCEPTED</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Undecided</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>next-minor</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Alex Stewart">alex.stewart</reporter>
          <assigned_to name="Alex Stewart">alex.stewart</assigned_to>
          <cc>dylan.turner</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>91996</commentid>
    <comment_count>0</comment_count>
      <attachid>4843</attachid>
    <who name="Alex Stewart">alex.stewart</who>
    <bug_when>2021-11-12 18:24:35 +0000</bug_when>
    <thetext>Created attachment 4843
Reproducing regression test

Suppose a system has installed pkgs &apos;a_1&apos; and &apos;b_1&apos;, where &apos;a&apos; depends on &apos;b&apos;. Pkg &apos;a_1&apos; owns a file &apos;/conflict_file&apos;.

Suppose the feed contains pkgs &apos;a_2&apos; and &apos;b_2&apos;, with similar dependencies. However, in the *version 2* relationship, ownership of &apos;/conflict_file&apos; has been moved from &apos;a&apos; to &apos;b&apos;. The package maintainers have correctly asserted that &apos;b_2&apos; conflicts with &apos;a (&lt;&lt;2.0)&apos;.

When the user asks that opkg install &apos;a_2&apos;, either by upgrade or directly, opkg *should* identify that it must also install &apos;b_2&apos;, and that &apos;b_2&apos;s ownership of &apos;/conflict_file&apos; doesn&apos;t impact &apos;a_1&apos;, because &apos;a_1&apos; is being uninstalled. However, opkg instead fails and - when using libsolv - reports the file conflict as the cause.


The attached python test reproduces this error.

This bug reproduces using both the internal solver and libsolv. It only needs to be solved for libsolv.

This bug has been migrated from NI&apos;s internal backlog.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94815</commentid>
    <comment_count>1</comment_count>
    <who name="Dylan Turner">dylan.turner</who>
    <bug_when>2023-01-26 16:17:10 +0000</bug_when>
    <thetext>This issue happens because essentially, opkg is trying to install packages (other than the primary one) too early. b_2 is getting installed before a_1 can be removed and replaced with a_2.

The conflict occurs because unlike dpkg, opkg does not make a backup of files to restore, instead attempting to catch and handle potential file conflicts before installing the final package.

Some of these, like file ownership transfer in an upgrade scenario, are handled, but not so with file ownership transfer to a completely different package as in this bug.

This is an issue that any lightweight package manager could run into because it&apos;s a result of not having enough information about the resulting file system in order to fix the conflict.

It may be possible for a quick fix similar to what happened for another case as seen in &quot;check_data_file_clashes_change&quot; in opkg_install.c, but really, a more thorough solution is probably needed.

Two potential options are:
1) implementing a backup system like dpkg where we do the install and check for conflicts after, backtracking if there&apos;s an actual issue.
  - This is not that lightweight however, so it may not be a good option for opkg, hence the reason it&apos;s not currently used.
2) implementing a system that can do a calculation of the final file system to check before our current conflict check</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>4843</attachid>
            <date>2021-11-12 18:24:35 +0000</date>
            <delta_ts>2021-11-12 18:24:35 +0000</delta_ts>
            <desc>Reproducing regression test</desc>
            <filename>issueV2.py</filename>
            <type>text/x-python</type>
            <size>1931</size>
            <attacher name="Alex Stewart">alex.stewart</attacher>
            
              <data encoding="base64">IyEvdXNyL2Jpbi9lbnYgcHl0aG9uMwojIFNQRFgtTGljZW5zZS1JZGVudGlmaWVyOiBHUEwtMi4w
LW9ubHkKIwojIFdoYXQgc3RlcHMgd2lsbCByZXByb2R1Y2UgdGhlIHByb2JsZW0/CiMjIyMjIyMj
IyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMKIwojIDEuIHBrZyAnZm9vJyBvd25zIGEg
ZmlsZSBjYWxsZWQgJ2NvbmZsaWN0X2ZpbGUnIGFuZCBkZXBlbmRzIG9uIHBrZyAnYmFyJwojIDIu
IHBrZyAnZm9vJyBhbmQgJ2JhcicgYXJlIGluc3RhbGxlZC4KIyAzLiBwa2cgJ2Zvb18yJyBpcyBh
ZGRlZCB0byB0aGUgZmVlZCwgYW5kIGRvZXMgbm90IG93biAnY29uZmxpY3RfZmlsZSc7CiMgICAg
J2Zvb18yJyBkZXBlbmRzIG9uICdiYXJfMicuCiMgNC4gcGtnICdiYXJfMicgaXMgYWRkZWQgdG8g
dGhlIGZlZWQsIGFuZCBub3cgb3ducyAnY29uZmxpY3RfZmlsZSc7ICdiYXJfMicgY29uZmxpY3Rz
IHdpdGggJ2Zvbzw8MicKIyA1LiB1c2VyIGNhbGxzICdvcGtnIHVwZ3JhZGUnIG9yICdvcGtnIGlu
c3RhbGwgZm9vJwojCiMgV2hhdCBpcyB0aGUgZXhwZWN0ZWQgb3V0cHV0PyBXaGF0IGRvIHlvdSBz
ZWUgaW5zdGVhZD8KIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIwojIEV4
cGVjdGVkOgojICBPcGtnIHNob3VsZCBkZXRlY3QgdGhhdCBgY29uZmxpY3RfZmlsZWAgb3duZXIg
c2hpcCBoYXMgYmVlbiBwYX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