Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 373019 - app-portage/portpeek-2.0.10 crash when handling gentoolkit exception with python 2.7
Summary: app-portage/portpeek-2.0.10 crash when handling gentoolkit exception with pyt...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal major (vote)
Assignee: Mike Pagano
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-25 18:34 UTC by Sven Eden
Modified: 2011-10-21 09:19 UTC (History)
0 users

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


Attachments
portpeek-2.0.11, fix for overlays (portpeek,39.75 KB, text/plain)
2011-09-28 20:47 UTC, Mike Pagano
Details
portpeek-1.9.72 with same fix (portpeek,38.94 KB, text/plain)
2011-09-28 23:01 UTC, Mike Pagano
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sven Eden 2011-06-25 18:34:39 UTC
portpeek-2.0.10 crashes when gentoolkit/query.py throws an exception about a not found exception. portpeek then tries to acces the global name "errors", which is not defined.

The following has been generated with "portpeek -ard":

----------------------------
Analyzing line: =kde-base/kde-l10n-4.6.3*::gentoo
Traceback (most recent call last):
  File "/usr/bin/portpeek", line 190, in parse_line
    pkgs = query.smart_find(True,True,True,True,False,True)
  File "/usr/lib64/python3.1/site-packages/gentoolkit/query.py", line 177, in smart_find
    raise errors.GentoolkitNoMatches(self.query, in_installed=ii)
gentoolkit.errors.GentoolkitNoMatches: No packages matching '=kde-base/kde-l10n-4.6.3*'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/portpeek", line 928, in <module>
    get_recursive_info(USER_CONFIG_PATH + "/package.keywords")
  File "/usr/bin/portpeek", line 354, in get_recursive_info
    get_info(filename)
  File "/usr/bin/portpeek", line 375, in get_info
    diffs_found = parse_line(line, filename)
  File "/usr/bin/portpeek", line 191, in parse_line
    except errors.GentoolkitException as err:
NameError: global name 'errors' is not defined
----------------------------

eix says about the package in question:

----------------------------
# eix -e kde-l10n
[I] kde-base/kde-l10n
     Available versions:  (4) 4.6.2 4.6.3-r1 ~4.6.3-r1[1] (~)4.6.4
        {aqua +handbook kdeenablefinal kdeprefix linguas_ar linguas_bg linguas_ca linguas_ca@valencia linguas_cs linguas_da linguas_de linguas_el linguas_en_GB linguas_es linguas_et linguas_eu linguas_fi linguas_fr linguas_ga linguas_gl linguas_gu linguas_he linguas_hi linguas_hr linguas_hu linguas_ia linguas_id linguas_is linguas_it linguas_ja linguas_kk linguas_km linguas_kn linguas_ko linguas_lt linguas_lv linguas_mai linguas_nb linguas_nds linguas_nl linguas_nn linguas_pa linguas_pl linguas_pt linguas_pt_BR linguas_ro linguas_ru linguas_sk linguas_sl linguas_sr linguas_sv linguas_th linguas_tr linguas_uk linguas_wa linguas_zh_CN linguas_zh_TW}                                                                                                                                                             
     Installed versions:  4.6.4(4)(20:30:31 19.06.2011)(handbook linguas_de linguas_en_GB -aqua -kdeenablefinal -linguas_ar -linguas_bg -linguas_ca -linguas_ca@valencia -linguas_cs -linguas_da -linguas_el -linguas_es -linguas_et -linguas_eu -linguas_fi -linguas_fr -linguas_ga -linguas_gl -linguas_gu -linguas_he -linguas_hi -linguas_hr -linguas_hu -linguas_ia -linguas_id -linguas_is -linguas_it -linguas_ja -linguas_kk -linguas_km -linguas_kn -linguas_ko -linguas_lt -linguas_lv -linguas_mai -linguas_nb -linguas_nds -linguas_nl -linguas_nn -linguas_pa -linguas_pl -linguas_pt -linguas_pt_BR -linguas_ro -linguas_ru -linguas_sk -linguas_sl -linguas_sr -linguas_sv -linguas_th -linguas_tr -linguas_uk -linguas_wa -linguas_zh_CN -linguas_zh_TW)                                                                    
     Homepage:            http://www.kde.org/
     Description:         KDE internationalization package

[1] "SED-Local" /usr/local/portage
----------------------------



Reproducible: Always

Steps to Reproduce:
1. Install gentoolkit-9999 and portpeek 2.0.10
2. unkeyword kde-base/kde-l10n for repository "gentoo" and the versions 4.6.3* and 4.6.4* 
3. install kde-l10n-4.6.4
4. run "portpeek -ard"

I daresay it doesn't matter which package is used, just add a line for a previous than installed and stable version to /etc/portage/package.keywords. It should do.
Actual Results:  
Described crash

Expected Results:  
Removal of the line in question from package.keywords (not installed)

Portage version is 2.2.0_alpha41.

I bet it is a completely different issue than in bug 352909.
Comment 1 Mike Pagano gentoo-dev 2011-06-25 18:47:29 UTC
I have PYTHON_DEPEND="3" to show this version is for python-3. Not sure if that would make a difference. 

Can you downgrade portpeek to 1.9.70 and test?
Comment 2 Sven Eden 2011-06-26 10:38:16 UTC
(In reply to comment #1)
> I have PYTHON_DEPEND="3" to show this version is for python-3. Not sure if that
> would make a difference. 
> 
> Can you downgrade portpeek to 1.9.70 and test?

I have Python-3 installed, and portage is installed with python3 USE-Flag. However, the downgraded portpeek produces a completely different error:

------------------------------
=kde-base/ark-4.6.3*::gentoo: Not Installed                                                                                                                                           
Traceback (most recent call last):
  File "/usr/bin/portpeek", line 930, in <module>
    get_recursive_info(USER_CONFIG_PATH + "/package.keywords")
  File "/usr/bin/portpeek", line 354, in get_recursive_info
    get_info(filename)
  File "/usr/bin/portpeek", line 375, in get_info
    diffs_found = parse_line(line, filename)
  File "/usr/bin/portpeek", line 323, in parse_line
    print_output(info,portage.output.green("\n" + fields[0] + ": ") + portage.output.yellow("Not Installed"),current_package)
UnboundLocalError: local variable 'current_package' referenced before assignment
------------------------------

So kde-base/ark is analyzed and confirmed to not being installed. The next line in package.keywords is:

=kde-base/kde-l10n-4.6.3*::gentoo

So it is bailing out on the same line.

==========

What is the difference between thos to lines?

[I] kde-base/ark
     Available versions:  (4) 4.6.2 ~4.6.2-r1 4.6.3-r1 (~)4.6.4

versus

[I] kde-base/kde-l10n
     Available versions:  (4) 4.6.2 4.6.3-r1 ~4.6.3-r1[1] (~)4.6.4

So basically both have a stable 4.6.3-r1 and an unstable 4.6.4, which is the version installed. The only real difference is, that I have an unstable version of kde-l10n-4.6.3-r1 in my local overlay.

When I remove this unstable ebuild from my local overlay, the following happens:

portpeek-1.9.70: Works without errors
portpeek-2.0.10: Works without errors

---

Wild guess: portpeek in both versions has problems heeding the repository extension. The line in question states to unkeyword the package from the main tree, but both versions get confused by the presence of a similar package in another overlay.
Comment 3 Marco Schaefer 2011-09-28 08:09:22 UTC
Hello Mike,

i have exactly the same problem (and  same output) with portpeek -ard as Sven Eden described it in his last comment.

There are only two differences:
1.I didn't add a local overlay.I use only overlays via layman.
2.Portpeek isn't complaining about a specific line of an uninstalled application.

My Portage version is 2.1.10.11 build with python3 USE-Flag.
My Portpeek is in version 1.9.70.

So, if it is helpful to give you more Information about my Gentoo - configuration, let me know.

Thank you very much for your work

Marco
Comment 4 Marco Schaefer 2011-09-28 16:31:09 UTC
Ok, i could locate the Problem:

I unmasked the package lxde-base/lxdm with autounmask:

After that, autounmask added all overlays containing this package to my package.keywords file.

# ---
# BEGIN: lxde-base/lxdm-0.4.1-r1
# ---
=lxde-base/lxdm-0.4.1-r1::sabayon ~amd64
=lxde-base/lxdm-0.4.1-r1::gentoo ~amd64
# ---
# END: lxde-base/lxdm-0.4.1-r1
# ---

After deleting the line of the sabayon - overlay (=lxde-base/lxdm-0.4.1-r1::sabayon ~amd64) everything works fine.

I'm sorry that I havn't seen the duplicate entries before I leaved my comments in here.

Thank you

Marco
Comment 5 Mike Pagano gentoo-dev 2011-09-28 18:39:15 UTC
Having a difficult time replicating.

Here's my package.accept_keywords


=app-portage/portpeek-2.0.10
=app-portage/portpeek-2.0.10::hello
=app-portage/portpeek-2.0.10::gentoo
=kde-base/kde-l10n-4.6.3*::gentoo
=lxde-base/lxdm-0.4.1-r1::sabayon ~amd64
=lxde-base/lxdm-0.4.1-r1::gentoo ~amd64
=kde-base/kde-l10n-4.6.3*::gentoo

Here's the output


14:37:08-mike@kiowa{chroot}:~/projects/python/portpeek$ portpeek -ard

package.keywords:
Could not find file /etc/portage/package.keywords
No ebuild options found.

package.accept_keywords:
Analyzing line: =app-portage/portpeek-2.0.10
Checking package: app-portage/portpeek-2.0.8.pkgmask is 4
Checking package: app-portage/portpeek-2.0.9.pkgmask is 4
Checking package: app-portage/portpeek-1.9.70.pkgmask is 0
Checking package: app-portage/portpeek-1.9.71.pkgmask is 4
Checking package: app-portage/portpeek-1.5.8.4.pkgmask is 0
Checking package: app-portage/portpeek-1.5.9.3.pkgmask is 4
Analyzing line: =app-portage/portpeek-2.0.10::local

Package: =app-portage/portpeek-2.0.10::local not found. Please check /etc/portage/package.accept_keywords to validate entry                                                                                                       
Analyzing line: =app-portage/portpeek-2.0.10::gentoo
Checking package: app-portage/portpeek-2.0.8.pkgmask is 4
Checking package: app-portage/portpeek-2.0.9.pkgmask is 4
Checking package: app-portage/portpeek-1.9.70.pkgmask is 0
Checking package: app-portage/portpeek-1.9.71.pkgmask is 4
Checking package: app-portage/portpeek-1.5.8.4.pkgmask is 0
Checking package: app-portage/portpeek-1.5.9.3.pkgmask is 4
Analyzing line: =kde-base/kde-l10n-4.6.3*::gentoo

=kde-base/kde-l10n-4.6.3*::gentoo: Not Installed                                                                 
Analyzing line: =lxde-base/lxdm-0.4.1-r1::sabayon ~amd64

Package: =lxde-base/lxdm-0.4.1-r1::sabayon not found. Please check /etc/portage/package.accept_keywords to validate entry                                                                                                         
Analyzing line: =lxde-base/lxdm-0.4.1-r1::gentoo ~amd64

=lxde-base/lxdm-0.4.1-r1::gentoo: Not Installed                                                                  
Analyzing line: =kde-base/kde-l10n-4.6.3*::gentoo

=kde-base/kde-l10n-4.6.3*::gentoo: Not Installed                                                                 

package.unmask:
Analyzing line: =app-portage/portpeek-2.0.10
Checking package: app-portage/portpeek-2.0.8.pkgmask is 4
Checking package: app-portage/portpeek-2.0.9.pkgmask is 4
Checking package: app-portage/portpeek-1.9.70.pkgmask is 0
Checking package: app-portage/portpeek-1.9.71.pkgmask is 4
Checking package: app-portage/portpeek-1.5.8.4.pkgmask is 0
Checking package: app-portage/portpeek-1.5.9.3.pkgmask is 4

package.mask:
Could not find file /etc/portage/package.mask
No ebuild options found.

package.use:
Could not find file /etc/portage/package.use
No ebuild options found.

Done
Comment 6 Mike Pagano gentoo-dev 2011-09-28 18:40:17 UTC
I should have added versions here:
portage 2.1.10.11

portpeek 2.0.10

python 3.1.3-r1

eselect python list
Available Python interpreters:
  [1]   python2.7
  [2]   python3.1 *
Comment 7 Mike Pagano gentoo-dev 2011-09-28 18:57:33 UTC
Nevermind, I was able to follow Marco's steps exactly and I got the error. I will take a look at it.

Thanks, guys.
Comment 8 Mike Pagano gentoo-dev 2011-09-28 20:47:43 UTC
Created attachment 288131 [details]
portpeek-2.0.11, fix for overlays

portpeek 2.0.10 has a dependency on python3.

That said, here's a attempt at fixing this issue. Please use python3 and you can use the latest stable portage.
Comment 9 Mike Pagano gentoo-dev 2011-09-28 23:01:10 UTC
Created attachment 288139 [details]
portpeek-1.9.72 with same fix

Here's a python2 version (1.9.72) with the same fix
Comment 10 Mike Pagano gentoo-dev 2011-10-11 14:45:52 UTC
No one reported any test results, but my testing looked good so I released 2.0.11 and 1.9.72 with the fix.
Comment 11 Sven Eden 2011-10-21 09:19:50 UTC
(In reply to comment #10)
> No one reported any test results, but my testing looked good so I released
> 2.0.11 and 1.9.72 with the fix.

Sorry, I was extremely blind there, I did not see the 2.0.11 attachment.

However, I just tested 2.0.12, as I have found another case where 2.0.10 crashed with the reported error.

The crash was:
==========
Analyzing line: =app-emulation/vmware-workstation-7.1.5.491717::gentoo
Traceback (most recent call last):
  File "/usr/bin/portpeek", line 190, in parse_line
    pkgs = query.smart_find(True,True,True,True,False,True)
  File "/usr/lib64/python3.1/site-packages/gentoolkit/query.py", line 177, in smart_find
    raise errors.GentoolkitNoMatches(self.query, in_installed=ii)
gentoolkit.errors.GentoolkitNoMatches: No packages matching '=app-emulation/vmware-workstation-7.1.5.491717'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/portpeek", line 928, in <module>
    get_recursive_info(USER_CONFIG_PATH + "/package.keywords")
  File "/usr/bin/portpeek", line 354, in get_recursive_info
    get_info(filename)
  File "/usr/bin/portpeek", line 375, in get_info
    diffs_found = parse_line(line, filename)
  File "/usr/bin/portpeek", line 191, in parse_line
    except errors.GentoolkitException as err:
NameError: global name 'errors' is not defined
==========

And the current version does this:
==========
Analyzing line: =app-emulation/vmware-workstation-7.1.5.491717::gentoo

=app-emulation/vmware-workstation-7.1.5.491717::gentoo: Not Installed
==========

So here's the feedback that everything is fine.;-)

Great Job! (Can't say that often enough! :D)