<?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>12223</bug_id>
          
          <creation_ts>2017-10-13 19:00:06 +0000</creation_ts>
          <short_desc>opkg marks package as installed despite a dependency failing to install</short_desc>
          <delta_ts>2021-07-08 15:05:24 +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.3.5</version>
          <rep_platform>All</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>minor</bug_severity>
          <target_milestone>next-patch</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Michael Hansen">michael.j.hansen</reporter>
          <assigned_to name="Alex Stewart">alex.stewart</assigned_to>
          
          
          
          <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>77573</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Hansen">michael.j.hansen</who>
    <bug_when>2017-10-13 19:00:06 +0000</bug_when>
    <thetext>What steps will reproduce the problem?
######################################

1. Create package &apos;a&apos;, which includes conflict_file.
2. Create package &apos;b&apos;, which DEPENDS on &apos;c&apos;.
3. Create package &apos;c&apos;, which also includes conflict_file.
4. Install &apos;a&apos;
5. Install &apos;b&apos;

What is the expected output? What do you see instead?
######################################
Expected:  Packages &apos;b&apos; and &apos;c&apos; should not be installed.

Observed:  Opkg correctly reports an error and non-zero exit status after
attempting to install &apos;b&apos;.  However, &apos;b&apos; is marked as installed despite its
dependency &apos;c&apos; not being installed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>77574</commentid>
    <comment_count>1</comment_count>
      <attachid>4080</attachid>
    <who name="Michael Hansen">michael.j.hansen</who>
    <bug_when>2017-10-13 19:01:36 +0000</bug_when>
    <thetext>Created attachment 4080
Test case for 12223</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>77649</commentid>
    <comment_count>2</comment_count>
    <who name="Alejandro del Castillo">alejandro.delcastillo</who>
    <bug_when>2017-10-17 22:44:07 +0000</bug_when>
    <thetext>So I tried the same case on dpkg, and this is what I got 

root@29d4823d742c:/tmp# apt-get install b                                                                                                                                                                          
Reading package lists... Done                                                                                                                                                                                      
Building dependency tree                                                                                                                               
Reading state information... Done                                                                                                                                                                                  
The following additional packages will be installed:                                                                                                                                                               
  c                                                                                                                                                                 
The following NEW packages will be installed:                                                                                                                                                                      
  b c                                                                                                                                                        
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.                                                                                                                                                     
Need to get 0 B/1274 B of archives.                                                                                                                  
After this operation, 0 B of additional disk space will be used.                                                                                                                                                   
Do you want to continue? [Y/n] Y                                                                                                                                                                                   
WARNING: The following packages cannot be authenticated!                                                                                                                                                           
  c b                                                                                                                                                                                                              
Install these packages without verification? [y/N] y                                                                                                                                                               
Get:1 file:/tmp feed/ c 1.0 [630 B]                                                                                                                                                                                
Get:2 file:/tmp feed/ b 1.0 [644 B]                                                                                                                            
debconf: delaying package configuration, since apt-utils is not installed                                                                                   
Selecting previously unselected package c.                                                                                                                  
(Reading database ... 16254 files and directories currently installed.)                                                                                            
Preparing to unpack /tmp/feed/c_1.0.deb ...                                                                                                                              
Unpacking c (1.0) ...                                                                                                                                         
dpkg: error processing archive /tmp/feed/c_1.0.deb (--unpack):                                                                                               
 trying to overwrite &apos;/usr/myfile&apos;, which is also in package a 1.0                                                                                        
Selecting previously unselected package b.                                                                                                             
Preparing to unpack /tmp/feed/b_1.0.deb ...                                                                                                                       
Unpacking b (1.0) ...                                                                                                                                         
Errors were encountered while processing:                                                                                                                 
 /tmp/feed/c_1.0.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)


Running dpkg --list:

ii  a   1.0    amd64        this is a                                                                                                                                    
iU  b   1.0    amd64        this is b      

Which is saying that package a is fully installed, package b is in unpacked state and package c is not installed at all. In opkg, we get package a and b installed, and C half-installed, which is a state that makes sense (but not ideal). Opkg state diagram is simpler than dpkg, so this is more or less by design. An improvement over the current state would be to be able to rollback C, but that is probably going to be fairly hard.

I am not opposed to opkg becoming more resilient, and more dpkg-wise, but its probably low on the priority list as its main purpose is to be a simplified version of dpkg, which means some corners are cut. but would certainly take that change in, if someone else take the task on.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>4080</attachid>
            <date>2017-10-13 19:01:36 +0000</date>
            <delta_ts>2017-10-13 19:01:36 +0000</delta_ts>
            <desc>Test case for 12223</desc>
            <filename>issue12223.py</filename>
            <type>text/x-python</type>
            <size>1318</size>
            <attacher name="Michael Hansen">michael.j.hansen</attacher>
            
              <data encoding="base64">IyEvdXNyL2Jpbi9lbnYgcHl0aG9uMwoKIyBXaGF0IHN0ZXBzIHdpbGwgcmVwcm9kdWNlIHRoZSBw
cm9ibGVtPwojIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjCiMKIyAxLiBD
cmVhdGUgcGFja2FnZSAnYScsIHdoaWNoIGluY2x1ZGVzIGNvbmZsaWN0X2ZpbGUuCiMgMi4gQ3Jl
YXRlIHBhY2thZ2UgJ2InLCB3aGljaCBERVBFTkRTIG9uICdjJy4KIyAzLiBDcmVhdGUgcGFja2Fn
ZSAnYycsIHdoaWNoIGluY2x1ZGVzIGNvbmZsaWN0X2ZpbGUuCiMgNC4gS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