Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 724892 - portage-utils-0.87: qlist -F output mangles USE flags.
Summary: portage-utils-0.87: qlist -F output mangles USE flags.
Status: CONFIRMED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Unclassified (show other bugs)
Hardware: All Linux
: High major (vote)
Assignee: Portage Utils Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-24 05:16 UTC by Robin Johnson
Modified: 2020-05-25 11:06 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2020-05-24 05:16:16 UTC
qlist bugs
1. does not populate %{USE} correctly in format templates.
2. hard-append USE flags onto output if -U is passed, breaking format template output.

commands:
# qlist -CIvSR -F '{"cp": "%{CAT}/%{PN}", "pv":"%{PV}", pvr:"%{PVR}", slot: "%{SLOT}", subslot:"%[SUBSLOT]", repo:"%{REPO}", use:"%{USE}"}' portage-utils
# qlist -CIvSRU -F '{"cp": "%{CAT}/%{PN}", "pv":"%{PV}", pvr:"%{PVR}", slot: "%{SLOT}", subslot:"%[SUBSLOT]", repo:"%{REPO}", use:"%{USE}"}' portage-utils

actual output:
{"cp": "app-portage/portage-utils", "pv":"0.80", pvr:"0.80-r0", slot: "0", subslot:"", repo:"gentoo", use:"["}
{"cp": "app-portage/portage-utils", "pv":"0.80", pvr:"0.80-r0", slot: "0", subslot:"", repo:"gentoo", use:"["} -libressl -nls openmp qmanifest qtegrity -static

expected output
{"cp": "app-portage/portage-utils", "pv":"0.80", pvr:"0.80-r0", slot: "0", subslot:"", repo:"gentoo", use:"-libressl -nls openmp qmanifest qtegrity -static"]}
{"cp": "app-portage/portage-utils", "pv":"0.80", pvr:"0.80-r0", slot: "0", subslot:"", repo:"gentoo", use:"-libressl -nls openmp qmanifest qtegrity -static"]}


P.S.:
The bug filing in README tells uses to file to Portage Development/Tools, but the Tools component doesn't seem to available for new bug reports.
Comment 1 Fabian Groffen gentoo-dev 2020-05-24 09:31:34 UTC
This is an interesting case.  Thanks, will review the README directions too.
Comment 2 Fabian Groffen gentoo-dev 2020-05-25 11:06:16 UTC
Ok, just to clarify what happens here.

qlist -U adds a list of USE-flags enabled for the package after printing the package, that is, the string as given in -F.

qlist -vU adds a list of all USE-flags, and flags those not enabled by prefixing them with a '-'.

The %{USE} formatter in -F would print the USE-dependencies specified for the atom.  E.g. this is what would be found in a dependency string:

foo/bar-4[-fnord,ssl:=]

For example:
% ./qatom -F '{"cp": "%{CAT}/%{PN}", "pv":"%{PV}", pvr:"%{PVR}", slot: "%{SLOT}", subslot:"%[SUBSLOT]", repo:"%{REPO}", use:"%[USE]"}' "foo/bar-4[-fnord,ssl:=]"
{"cp": "foo/bar", "pv":"4", pvr:"4", slot: "<unset>", subslot:"", repo:"<unset>", use:"-fnord ssl:="}



What you seem to have found is that %{USE} always prints the starting '[', but doesn't bother to close it if there's no USE-deps specified.  That needs fixing, both your queries should show an empty expansion when used with [] and "<unset>" when used with {}.

What you seem to want to do, is not just possible with qlist right now.  It seems currently a separate step is required.
Comment 3 Larry the Git Cow gentoo-dev 2020-05-25 11:06:24 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=a68b9b4ebc840805f504fe681196e7f15737985d

commit a68b9b4ebc840805f504fe681196e7f15737985d
Author:     Fabian Groffen <grobian@gentoo.org>
AuthorDate: 2020-05-25 11:03:36 +0000
Commit:     Fabian Groffen <grobian@gentoo.org>
CommitDate: 2020-05-25 11:03:36 +0000

    libq/atom: fixup USE-dep printing in atom_format
    
    Bug: https://bugs.gentoo.org/724892
    Signed-off-by: Fabian Groffen <grobian@gentoo.org>

 libq/atom.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)