Bug 12223 - opkg marks package as installed despite a dependency failing to install
Summary: opkg marks package as installed despite a dependency failing to install
Status: ACCEPTED
Alias: None
Product: opkg
Classification: Yocto Project Subprojects
Component: opkg (show other bugs)
Version: 0.3.5
Hardware: All Multiple
: Undecided minor
Target Milestone: next-patch
Assignee: Alex Stewart
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2017-10-13 19:00 UTC by Michael Hansen
Modified: 2021-07-08 15:05 UTC (History)
0 users

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments
Test case for 12223 (1.29 KB, text/x-python)
2017-10-13 19:01 UTC, Michael Hansen
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Hansen 2017-10-13 19:00:06 UTC
What steps will reproduce the problem?
######################################

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

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

Observed:  Opkg correctly reports an error and non-zero exit status after
attempting to install 'b'.  However, 'b' is marked as installed despite its
dependency 'c' not being installed.
Comment 1 Michael Hansen 2017-10-13 19:01:36 UTC
Created attachment 4080 [details]
Test case for 12223
Comment 2 Alejandro del Castillo 2017-10-17 22:44:07 UTC
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 '/usr/myfile', 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.