Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 578496

Summary: app-portage/gentoolkit: `eshowkw --arch=x86-linux portage` crash: ValueError: max() arg is an empty sequence
Product: Portage Development Reporter: Coacher <itumaykin+gentoo>
Component: ToolsAssignee: Portage Tools Team <tools-portage>
Status: RESOLVED FIXED    
Severity: normal CC: esigra
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 346443    

Description Coacher 2016-03-29 05:58:15 UTC
Hello.

If I call `eshowkw --arch=x86-linux portage` or any other arch that has `-` in its name, I get a crash like this:

$ eshowkw --arch=x86-linux portage
Traceback (most recent call last):
  File "/usr/lib/python-exec/python3.4/eshowkw", line 9, in <module>
    sys.exit(emain(sys.argv[1:]))
  File "/usr/lib64/python3.4/site-packages/gentoolkit/eshowkw/__init__.py", line 103, in main
    keywords = keywords_header(prefix, highlight_arch, order)
  File "/usr/lib64/python3.4/site-packages/gentoolkit/eshowkw/keywords_header.py", line 176, in __init__
    max([len(x) for x in self.keywords]),
ValueError: max() arg is an empty sequence

Please fix.

Reproducible: Always
Comment 1 Coacher 2016-03-29 05:59:18 UTC
I've tried putting arch inside quotes, but it doesn't help.
Comment 2 Coacher 2016-03-29 06:06:45 UTC
I mistakenly CC'ed vapier, but he's in charge of portage-utils, not gentoolkit. Sorry.
Comment 3 Felix Janda 2016-03-29 07:00:13 UTC
Does 'eshowkw -P --arch=x86-linux portage' work? If so, an easy way to
fix this should be to make the option "--arch" imply the option "-P".
Comment 4 Coacher 2016-03-29 07:07:26 UTC
(In reply to Felix Janda from comment #3)
> Does 'eshowkw -P --arch=x86-linux portage' work? If so, an easy way to
> fix this should be to make the option "--arch" imply the option "-P".

Yes. It works properly this way. Thanks for the tip!
Comment 5 Paul Varner (RETIRED) gentoo-dev 2016-03-31 22:15:45 UTC
This has been fixed to not require the -P flag in the following commit:
https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=99bdbe3d832a3dabb7e9fb9c50cb9c4e1baf2f02

I agree that --arch should imply -P as the user is specifying the architecture and it should just be displayed regardless of prefix status.

You can test the changes with app-portage/gentoolkit-9999 and the bug will be resolved when it is released in a new ebuild.
Comment 6 Coacher 2016-03-31 22:21:13 UTC
(In reply to Paul Varner from comment #5)
> This has been fixed to not require the -P flag in the following commit:
> https://gitweb.gentoo.org/proj/gentoolkit.git/commit/
> ?id=99bdbe3d832a3dabb7e9fb9c50cb9c4e1baf2f02
> 
> I agree that --arch should imply -P as the user is specifying the
> architecture and it should just be displayed regardless of prefix status.
> 
> You can test the changes with app-portage/gentoolkit-9999 and the bug will
> be resolved when it is released in a new ebuild.

I can confirm that this change resolves the problem for me. Thank you very much.
Comment 7 Coacher 2016-04-04 01:34:25 UTC
This change has unintended side effects. Now if I call `eshowkw atom` the output is like if I was calling `eshowkw -P atom`. I am sure this isn't the desired behaviour in most situation.

Please adjust this back to normal if possible.
Comment 8 Paul Varner (RETIRED) gentoo-dev 2016-04-06 17:27:41 UTC
I have fixed the fix to be correct.  I accidentally used the wrong variable in the first patch. I double checked both use cases and they appear to be working correctly now.

https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=e4dda3ef193b109f30051f5a116158dfe23922bb