Bug 28815

Summary: provides/conflicts/requires/obsoletes not parsed properly when they contain square brackets
Product: Mageia Reporter: Pascal Terjan <pterjan>
Component: RPM PackagesAssignee: Thierry Vignaud <thierry.vignaud>
Status: NEW --- QA Contact:
Severity: normal    
Priority: Normal    
Version: Cauldron   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Source RPM: perl-URPM CVE:
Status comment:
Attachments: Patch adding a test reproducing the problem
Patch adding the test and a fix making it pass

Description Pascal Terjan 2021-04-20 21:30:14 CEST
For example "python3dist(fonttools[ufo])[== 4.18.2]" gets parsed as "python3dist(fonttools" being the name of it.
Comment 1 Pascal Terjan 2021-04-20 21:32:02 CEST
Created attachment 12658 [details]
Patch adding a test reproducing the problem

Reading the source, it should not happen when the header is present.

A test using synthesis reproduced the problem, attaching it.
Comment 2 Pascal Terjan 2021-04-20 21:40:07 CEST
The assumption that [] can not be in the name part is at several places unfortunately.

Pkg_obsoletes_overlap
Urpm_ranges_overlap
callback_list_str_overlap
return_list_str
update_provides
update_obsoletes
Comment 3 Jani Välimaa 2021-04-21 16:20:15 CEST
Assigning to perl-URPM maintainer.

Assignee: bugsquad => thierry.vignaud

Comment 4 Pascal Terjan 2021-04-21 16:30:23 CEST
I started looking into it yesterday, I wanted to create a new parsing function but it was less easy than expected as the code currently modifies original string to add '\0' and use parts of it and then restores the string so I think a separate function would need to allocate new strings and they would need to be released afterwards.
Comment 5 Pascal Terjan 2021-04-21 16:31:00 CEST
Alternatively it could give a struct name, namelen or end of name, etc
Comment 6 Pascal Terjan 2021-04-22 15:03:22 CEST
Created attachment 12663 [details]
Patch adding the test and a fix making it pass

Here is what I wrote last night, it makes the test pass but should be cleaned up.

Attachment 12658 is obsolete: 0 => 1