Bug 1196902

Summary: mock: fails with NameError when bad chroot name is given
Product: [Fedora] Fedora Reporter: Zbigniew Jędrzejewski-Szmek <zbyszek>
Component: mockAssignee: Clark Williams <williams>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 21CC: jdisnard, mebrown, Mikhail_Campos-Guadamuz, msimacek, msuchy, praiskup, williams
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-02-27 14:03:30 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Zbigniew Jędrzejewski-Szmek 2015-02-26 23:54:21 UTC
Description of problem:
$ mock -r xxx python-matplotlib-1.4.3-4.fc23.src.rpm
ERROR: Could not find required config file: /etc/mock/xxx.cfg
ERROR: global name 'name' is not defined
Traceback (most recent call last):
  File "/usr/sbin/mock", line 829, in <module>
    main()
  File "/usr/lib/python2.7/site-packages/mockbuild/trace_decorator.py", line 84, in trace
    result = func(*args, **kw)
  File "/usr/sbin/mock", line 588, in main
    config_opts = util.load_config(config_path, options.chroot, uidManager, __VERSION__, PKGPYTHONDIR)
  File "/usr/lib/python2.7/site-packages/mockbuild/trace_decorator.py", line 84, in trace
    result = func(*args, **kw)
  File "/usr/lib/python2.7/site-packages/mockbuild/util.py", line 1013, in load_config
    do_update_config(log, config_opts, chroot_cfg_path, uidManager, skipError=False)
  File "/usr/lib/python2.7/site-packages/mockbuild/trace_decorator.py", line 84, in trace
    result = func(*args, **kw)
  File "/usr/lib/python2.7/site-packages/mockbuild/util.py", line 980, in do_update_config
    if name == "default":
NameError: global name 'name' is not defined


Version-Release number of selected component (if applicable):
mock-1.2.7-1.fc21.noarch

How reproducible:
100%

Comment 1 Mikhail Campos 2015-02-27 13:12:00 UTC
-r (--root) option is used to point config, but not to specify name of chroot

Comment 2 Zbigniew Jędrzejewski-Szmek 2015-02-27 13:45:42 UTC
The code uses a variable ("name") which is not declared anywhere.

Comment 3 Mikhail Campos 2015-02-27 14:03:30 UTC
Ok, sorry for misunderstanding.  
This has been already fixed in 168954d for #1194171

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