Bug 663183

Summary: [abrt] mercurial-1.7.2-1.fc13: cmdutil.py:28:findpossible:AttributeError: 'NoneType' object has no attribute 'keys'
Product: [Fedora] Fedora Reporter: Ville Skyttä <ville.skytta>
Component: mercurialAssignee: Neal Becker <ndbecker2>
Status: CLOSED UPSTREAM QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 13CC: dennis, mads, mmcgrath, ndbecker2, vvitek
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:9475a643
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-12-25 23:48:38 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
File: backtrace none

Description Ville Skyttä 2010-12-14 21:47:54 UTC
abrt version: 1.1.14
architecture: x86_64
cmdline: /usr/bin/python /usr/bin/hg otu
component: mercurial
executable: /usr/bin/hg
kernel: 2.6.34.7-63.fc13.x86_64
package: mercurial-1.7.2-1.fc13
reason: cmdutil.py:28:findpossible:AttributeError: 'NoneType' object has no attribute 'keys'
release: Fedora release 13 (Goddard)
time: 1292363109
uid: 500

backtrace
-----
cmdutil.py:28:findpossible:AttributeError: 'NoneType' object has no attribute 'keys'

Traceback (most recent call last):
  File "/usr/bin/hg", line 38, in <module>
    mercurial.dispatch.run()
  File "/usr/lib64/python2.6/site-packages/mercurial/dispatch.py", line 16, in run
    sys.exit(dispatch(sys.argv[1:]))
  File "/usr/lib64/python2.6/site-packages/mercurial/dispatch.py", line 36, in dispatch
    return _runcatch(u, args)
  File "/usr/lib64/python2.6/site-packages/mercurial/dispatch.py", line 116, in _runcatch
    commands.help_(ui, inst.args[0], unknowncmd=True)
  File "/usr/lib64/python2.6/site-packages/mercurial/commands.py", line 2059, in help_
    f(name)
  File "/usr/lib64/python2.6/site-packages/mercurial/commands.py", line 2038, in helpextcmd
    cmd, ext, mod = extensions.disabledcmd(name, ui.config('ui', 'strict'))
  File "/usr/lib64/python2.6/site-packages/mercurial/extensions.py", line 286, in disabledcmd
    ext = findcmd(cmd, name, path)
  File "/usr/lib64/python2.6/site-packages/mercurial/extensions.py", line 266, in findcmd
    getattr(mod, 'cmdtable', {}), strict)
  File "/usr/lib64/python2.6/site-packages/mercurial/cmdutil.py", line 51, in findcmd
    choice = findpossible(cmd, table, strict)
  File "/usr/lib64/python2.6/site-packages/mercurial/cmdutil.py", line 28, in findpossible
    for e in table.keys():
AttributeError: 'NoneType' object has no attribute 'keys'

Local variables in innermost frame:
cmd: 'otu'
strict: None
choice: {}
table: None
debugchoice: {}

How to reproduce
-----
1. Type an unknown hg command, for example "hg foo"
2. Crash

Comment 1 Ville Skyttä 2010-12-14 21:47:56 UTC
Created attachment 468709 [details]
File: backtrace

Comment 2 Mads Kiilerich 2010-12-14 22:08:19 UTC
This must have been caused by an invalid extension.

Please check "hg showconfig --debug extensions" and see if the problem goes away by disabling one of the extensions.

Comment 3 Ville Skyttä 2010-12-14 22:49:16 UTC
$ hg showconfig --debug extensions
read config from: /usr/etc/mercurial/hgrc
read config from: /etc/mercurial/hgrc
read config from: /etc/mercurial/hgrc.d/mergetools.rc
read config from: /home/scop/.hgrc
/home/scop/.hgrc:5: extensions.hgext.convert=
/home/scop/.hgrc:6: extensions.hgext.fetch=

If I read that correctly, I have the convert and fetch extensions enabled.  Disabling them does not make any difference, it still backtraces the same way with "hg foo".

$ hg showconfig --debug extensions
read config from: /usr/etc/mercurial/hgrc
read config from: /etc/mercurial/hgrc
read config from: /etc/mercurial/hgrc.d/mergetools.rc
read config from: /home/scop/.hgrc
$ hg foo
hg: unknown command 'foo'
Traceback (most recent call last):
  File "/usr/bin/hg", line 38, in <module>
    mercurial.dispatch.run()
[...same backtrace as before...]

Comment 4 Mads Kiilerich 2010-12-14 23:29:11 UTC
Hmm, yeah. When the command isn't found it tries to load all extensions even though they haven't been enabled to see if the command is defined by any of these.

Can you try to add some debugging to mercurial/extensions.py around line 260 and print cmd, name and path and see when the problem happens?

Is there some extension-like file somewhere with some special content that makes it bail out?

Comment 5 Ville Skyttä 2010-12-15 07:29:52 UTC
I didn't add any debugging yet, but removed the mercurial-forest extension I had installed and that got rid of the problem (source and binary rpms at http://cachalot.mine.nu/ if you're interested).

Seems to me that hg should be more careful when doing what it does for unknown commands; disabled extensions might be disabled for a reason after all :)

Comment 6 Mads Kiilerich 2010-12-25 23:48:38 UTC
http://hg.intevation.org/mercurial/crew/rev/1aea66b71f4f has been committed upstream and will be included in Mercurial 1.8.