Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 310475 - Introduction of app-portage/epm-1.33 'declare ...' prefaced assignments in environment.bz2 prevents epm from identifying (key,value) pairs
Summary: Introduction of app-portage/epm-1.33 'declare ...' prefaced assignments in e...
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Third-Party Tools (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Portage Tools Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-21 05:25 UTC by Carl Boe
Modified: 2012-05-11 21:35 UTC (History)
2 users (show)

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


Attachments
epm patches for newer portage system (epm-1.33.patch,1.78 KB, patch)
2010-03-30 02:32 UTC, Terra
Details | Diff
smaller patch to fix environment.bz2 handling (epm-1.33-env.patch,949 bytes, patch)
2010-04-06 03:57 UTC, Alexander Miller
Details | Diff
smaller patch to fix environment.bz2 handling (epm-1.33-env.patch,940 bytes, patch)
2010-04-06 04:11 UTC, Alexander Miller
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Carl Boe 2010-03-21 05:25:21 UTC
At some point around Feb. 2010, an update (portage?, bash?) introduced problems into the package query tool, epm.  For recently emerged packages, the information displayed by 'epm -qi' is mostly missing, while for packages installed some time ago, the fields of information are all present.

Reproducible: Always

Steps to Reproduce:
1. emerge a new or update a package 'foo'
2. epm -qi foo


Actual Results:  
epm -qi portage
Use of uninitialized value in printf at /usr/bin/epm line 248.
Use of uninitialized value in printf at /usr/bin/epm line 248.
Use of uninitialized value in printf at /usr/bin/epm line 248.
Use of uninitialized value in printf at /usr/bin/epm line 248.
Use of uninitialized value in printf at /usr/bin/epm line 248.
Use of uninitialized value in printf at /usr/bin/epm line 248.
Use of uninitialized value in printf at /usr/bin/epm line 248.
Use of uninitialized value in printf at /usr/bin/epm line 248.
Name        :
Version     :
Release     :                                     Slot:
Install date: Sat Mar 20 16:34:23 2010      Build Host:
Group       : sys-apps                         License:
Size        : 2053094
Packager    : ranger
URL         :
Summary     :


Expected Results:  
epm -qi portage

Name        : portage
Version     : 2.1.7.17
Release     : r0                                  Slot: 0
Install date: Sat Mar 20 16:34:23 2010      Build Host: BoeCore2
Group       : sys-apps                         License: GPL-2
Size        : 2053094
Packager    : ranger
URL         : http://www.gentoo.org/proj/en/portage/index.xml
Summary     : Portage is the package management and distribution system for Gento


/usr/bin/epm line 208 has a regexp 

while (<F>) {
        next unless (/^(CATEGORY|HOSTNAME|DESCRIPTION|HOMEPAGE|LICENSE|PN|PR|PV|SLOT)=(.*)/);
        ($key, $value) = ($1, $2);
    
The file <F> that it is stepping through is environment.bz2 file (in /var/db/pkg/sys-apps/portage-2.1.7.17 for the example above).  That file used to have assignments such as 
  HOMEPAGE="http://www.gentoo.org/proj/en/portage/index.xml"
which are now of the form
  declare HOMEPAGE="http://www.gentoo.org/proj/en/portage/index.xml"
or
  declare -x HOMEPAGE="http://www.gentoo.org/proj/en/portage/index.xml"


I would think a simple change to the regexp line would fix this bug.
Comment 1 Terra 2010-03-30 02:32:05 UTC
Created attachment 225777 [details, diff]
epm patches for newer portage system

Rework so epm doesn't fail on envariables declared with '(declare( -x)? )?' which balks with 'unintialized value'
Comment 2 Terra 2010-03-30 02:33:09 UTC
I was just going to file a bug on this with an included patch...

Give it a try and let me know if this fixes it for you...

One more thing, it appears that 'HOSTNAME' is not preserved in the build environment which is what epm keys off of to ascertain 'Build Host:'

Here are my notes regarding that:
#TT:Sun 21 Mar 2010 08:21:40 PM EDT

Cannot fix the "Build Host" entry, as epm will look in: /var/db/**/environment.bz2 for the HOSTNAME envariable

The HOSTNAME envariable is no longer available, and this changed between:
2.6.13 => 2.7.16

HOSTNAME is filtered out by: ebuild.sh::filter_readonly_variables()
regardless if 'allow-extra-variables' is defined or not, as HOSTNAME is in bash_misc_vars
Comment 3 Carl Boe 2010-04-02 03:28:04 UTC
(In reply to comment #2)
Thanks.

That patch worked better than my attempted hacks.  I don't miss HOSTNAME. 
I have not tested extensively, but the patch produces expected output for the cases I use the most:
  epm -qa |grep foo   # search among installed packages
  epm -Gqi foo        # what group, URL, maintainer, install date for foo
  epm -ql  foo        # show all installed files for package foo

Odd to have such perl code bridging rpm and emerge, two python arenas.

Comment 4 Alexander Miller 2010-04-06 03:57:56 UTC
Created attachment 226685 [details, diff]
smaller patch to fix environment.bz2 handling

I have created a smaller patch (just a 3 line change) to fix the issue.
I've attached it even when I'm a bit late.
Comment 5 Alexander Miller 2010-04-06 04:11:07 UTC
Created attachment 226687 [details, diff]
smaller patch to fix environment.bz2 handling

patch fixed (extra HOMEPAGE/URL removed)
Comment 6 Peter Weilbacher 2011-01-13 08:28:23 UTC
I can confirm that with it epm -qi finally does something useful again.
It would be great if this patch would finally make it into Gentoo.
Comment 7 Terra 2011-10-08 04:53:31 UTC
The attached patches will fix this issue...

bump issue so it gets another look over...
Comment 8 Paul Varner (RETIRED) gentoo-dev 2012-05-11 21:35:52 UTC
Thanks for the patches.  Fixed in epm-1.33-r1