Bug 11332

Summary: opkg does not trim Provides strings and may miss Provides with Windows line endings
Product: [Yocto Project Subprojects] opkg Reporter: Paul Spangler <paul.spangler>
Component: opkgAssignee: Alejandro del Castillo <alejandro.delcastillo>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Undecided    
Version: 0.3.4   
Target Milestone: 0.3.5   
Hardware: x86   
OS: x86_64   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Don't know
Attachments:
Description Flags
Example reproduction feed none

Description Paul Spangler 2017-04-11 16:32:07 UTC
Created attachment 3708 [details]
Example reproduction feed

opkg is tolerant for Windows line endings in a feed, but appears to have missed trimming the Provides string before processing it, unlike other relationship strings. Installing a package from a feed that uses Windows line endings results in the Provides string keeping an extra \r at the end, which prevents the solver from detecting other relationships such as a conflicts.

See the attached example feed with two empty packages that conflict using a virtual package. For example, I see the following in /var/lib/opkg/status:

Package: test-package-1
Version: 1.0.0-0
Provides: test-virtual-package^M
Replaces: test-virtual-package
Conflicts: test-virtual-package
Status: install ok installed
Architecture: x64
Installed-Time: 1491928274

Expectation
-----------
# opkg install test-package-1 test-package-2
Solver encountered 1 problem(s):
Problem 1/1:
  - package test-package-2-1.0.0-1.x64 conflicts with test-virtual-package provided by test-package-1-1.0.0-0.x64

Solution 1:
  - do not ask to install a package providing test-package-2

Solution 2:
  - do not ask to install a package providing test-package-1

Actual Result
-------------
# opkg -v
opkg version 0.3.4 (libsolv 0.6.24)
# opkg install test-package-1 test-package-2
Installing test-package-1 (1.0.0) on root
Installing test-package-2 (1.0.0) on root
Configuring test-package-1.
Configuring test-package-2.
Comment 1 Alejandro del Castillo 2017-04-19 21:36:29 UTC
fixed on commit f6f0aee288bf4cdd56fb355ba90d95039782528b