Bug 649707 - "pydoc -k" searches fail when run as non-root and it cannot access some file
Summary: "pydoc -k" searches fail when run as non-root and it cannot access some file
Keywords:
Status: CLOSED DUPLICATE of bug 461419
Alias: None
Product: Fedora
Classification: Fedora
Component: python
Version: 14
Hardware: x86_64
OS: Linux
low
medium
Target Milestone: ---
Assignee: Dave Malcolm
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: abrt_hash:6d4b909e
Depends On: 526402
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-11-04 11:20 UTC by Matěj Cepl
Modified: 2018-04-11 14:13 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of: 526402
Environment:
Last Closed: 2010-11-04 15:07:14 UTC


Attachments (Terms of Use)

Description Matěj Cepl 2010-11-04 11:20:42 UTC
+++ This bug was initially created as a clone of Bug #526402 +++


abrt detected a crash.


How to reproduce
-----
1.
2.
3.


Comment
-----
I don't know why pydoc on the command line needs gopher. Seems bizzare.

Additional information
======


Attached files
----
backtrace

cmdline
-----
/usr/bin/python2.6 /usr/bin/pydoc -k hmac 


component
-----
python


executable
-----
/usr/bin/pydoc


kernel
-----
2.6.31.1-48.fc12.x86_64


package
-----
python-2.6.2-2.fc12


uuid
-----
6d4b909e

--- Additional comment from mcepl@redhat.com on 2009-09-30 01:44:06 EDT ---

Created attachment 363123 [details]
File: backtrace

--- Additional comment from dmalcolm@redhat.com on 2009-10-12 19:11:48 EDT ---

"pydoc -k" is searching through all modules on your system.

It's failing on "/home/matej/.python-lib/mechanize/_useragent.py", which looks like a locally-installed version of the mechanize package.  What version of mechanize is that?

--- Additional comment from mcepl@redhat.com on 2009-10-13 03:34:10 EDT ---

Yes, that's it. Sorry for the noise.

--- Additional comment from mcepl@redhat.com on 2009-10-13 03:36:40 EDT ---

Well, that was hasty:

bradford:~$ pydoc -k hmac
hmac - HMAC (Keyed-Hashing for Message Authentication) Python module.
Crypto.Hash.HMAC - HMAC (Keyed-Hashing for Message Authentication) Python module.

(process:6115): Gdk-CRITICAL **: gdk_keymap_get_for_display: assertion `GDK_IS_DISPLAY (display)' failed

(process:6115): Gdk-CRITICAL **: gdk_screen_get_root_window: assertion `GDK_IS_SCREEN (screen)' failed

** (process:6115): CRITICAL **: egg_keymap_resolve_virtual_modifiers: assertion `GDK_IS_KEYMAP (keymap)' failed

** (process:6115): CRITICAL **: egg_keymap_resolve_virtual_modifiers: assertion `GDK_IS_KEYMAP (keymap)' failed

** (process:6115): CRITICAL **: egg_keymap_resolve_virtual_modifiers: assertion `GDK_IS_KEYMAP (keymap)' failed
Traceback (most recent call last):
  File "/usr/bin/pydoc", line 5, in <module>
    pydoc.cli()
  File "/usr/lib64/python2.6/pydoc.py", line 2264, in cli
    apropos(val)
  File "/usr/lib64/python2.6/pydoc.py", line 1962, in apropos
    ModuleScanner().run(callback, key)
  File "/usr/lib64/python2.6/pydoc.py", line 1927, in run
    for importer, modname, ispkg in pkgutil.walk_packages(onerror=onerror):
  File "/usr/lib64/python2.6/pkgutil.py", line 110, in walk_packages
    __import__(name)
  File "/usr/lib64/python2.6/site-packages/parted/__init__.py", line 28, in <module>
    from _ped import AlignmentException
RuntimeError: pyparted requires root access
bradford:~$ 

Even when I have no local python library, pydoc fails .... Why in the world it needs parted???

--- Additional comment from dmalcolm@redhat.com on 2009-10-13 11:56:06 EDT ---

Well, it's iterating through all installed packages, importing them.  One of the installed packages is "parted", and parted appears to have a hard requirement on being _imported_ as root.

Looks to me like the parted code should be importable as non-root, but only runnable by root.  Alternatively, perhaps "pydoc -k" could be made to handle this kind of case.

Renaming and reasssiging to "parted".  If it's not feasible to fix there, reassign back to python and I can look at a better onerror handler.

========

Actually I think this comment lead the original bug on the dead way. The issue is not how are particular modules imported, but that pydoc is completely unable to deal with files to which doesn't have an access to. It will always happen that some file for one reason of other is not accessible to mere user, so pydoc -k should be able to deal with such circumstance. Also exceptions should be properly handled and not just thrown out to hopeless user. Especially in case of the program which is targeted towards inexperienced users as well.

See my current reproduction of the same problem:

jakoubek:~ $ LANG=en_US pydoc -k hmac
hmac - HMAC (Keyed-Hashing for Message Authentication) Python module.
Crypto.Hash.HMAC - HMAC (Keyed-Hashing for Message Authentication) Python module.
Crypto.SelfTest.Hash.test_HMAC - Self-test suite for Crypto.Hash.HMAC
** Message: pygobject_register_sinkfunc is deprecated (ClutterActor)
** Message: pygobject_register_sinkfunc is deprecated (ClutterAlpha)
** Message: pygobject_register_sinkfunc is deprecated (ClutterPath)
** Message: pygobject_register_sinkfunc is deprecated (ClutterInterval)
** Message: pygobject_register_sinkfunc is deprecated (GstObject)
gdata.Crypto.Hash.HMAC - HMAC (Keyed-Hashing for Message Authentication) Python module.
gdata.tlslite.utils.hmac - HMAC (Keyed-Hashing for Message Authentication) Python module.
2010-11-04 12:15:09.492289: ERROR: Could not load the stocks from /home/matej/.gnome2/invest-applet/stocks.pickle: [Errno 2] No such file or directory: '/home/matej/.gnome2/invest-applet/stocks.pickle'
You must run this application as root
jakoubek:~ $

Comment 1 Dave Malcolm 2010-11-04 15:07:14 UTC

*** This bug has been marked as a duplicate of bug 461419 ***


Note You need to log in before you can comment on or make changes to this bug.