Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.

Bug 1152952

Summary: [mock] UnicodeEncodeError: 'ascii' codec can't encode characters in position 6-7: ordinal not in range(128)
Product: [Fedora] Fedora Reporter: Marcin Juszkiewicz <mjuszkie>
Component: mockAssignee: Miroslav Suchý <msuchy>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: akozumpl, jdisnard, jsilhan, kdudka, mebrown, mluscon, msimacek, msuchy, packaging-team-maint, pnemade, praiskup, rholy, tla, williams
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: mock-1.2.3-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-12-12 04:08:09 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 Marcin Juszkiewicz 2014-10-15 09:24:00 UTC
Description of problem:

Switched mock to use dnf. The "no, will not use Python 3" bug appeared again:

Traceback (most recent call last):
  File "/usr/sbin/mock", line 809, 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 647, in main
    run_command(options, args, config_opts, commands, buildroot, state)
  File "/usr/lib/python2.7/site-packages/mockbuild/trace_decorator.py", line 84, in trace
    result = func(*args, **kw)
  File "/usr/sbin/mock", line 722, in run_command
    do_rebuild(config_opts, commands, buildroot, args)
  File "/usr/lib/python2.7/site-packages/mockbuild/trace_decorator.py", line 84, in trace
    result = func(*args, **kw)
  File "/usr/sbin/mock", line 493, in do_rebuild
    post=createrepo_on_rpms, clean=clean)
  File "/usr/lib/python2.7/site-packages/mockbuild/trace_decorator.py", line 84, in trace
    result = func(*args, **kw)
  File "/usr/sbin/mock", line 446, in rebuild_generic
    ret = cmd(item)
  File "/usr/sbin/mock", line 481, in build
    check=config_opts['check'])
  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/backend.py", line 216, in build
    rebuilt_srpm = self.rebuild_installed_srpm(spec_path, timeout)
  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/backend.py", line 396, in rebuild_installed_srpm
    printOutput=True)
  File "/usr/lib/python2.7/site-packages/mockbuild/buildroot.py", line 165, in doChroot
    env=self.env, shell=shell, *args, **kargs)
  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 421, in do
    printOutput=printOutput, child=child, chrootPath=chrootPath)
  File "/usr/lib/python2.7/site-packages/mockbuild/util.py", line 332, in logOutput
    print(input, end='')
UnicodeEncodeError: 'ascii' codec can't encode characters in position 6-7: ordinal not in range(128)


Version-Release number of selected component (if applicable):

dnf.noarch      0.6.2-1.fc22
mock.noarch     1.2.0-1.fc22

How reproducible:

randomly

Steps to Reproduce:
1. fedpkg clone -a gettext
2. cd gettext
3. fedpkg srpm
4. mock --verbose --dnf *src.rpm

Actual results:

fails with traceback above

Expected results:

just works

Additional info:

Time to switch to Python3 with dnf in Fedora?

Comment 1 Kamil Dudka 2014-10-15 16:46:56 UTC
I am getting such a failure reliably, without the --dnf option.  Downgrade to mock-1.1.41-3.fc20.noarch makes it work again.  A minimal example follows:

$ mock --init
$ mock --chroot "printf '\x80'" > /dev/null
INFO: mock.py version 1.2.0 starting (python version = 2.7.5)...
Start: init plugins
INFO: selinux enabled
Finish: init plugins
Start: run
Start: chroot init
INFO: calling preinit hooks
INFO: enabled root cache
INFO: enabled yum cache
Start: cleaning yum metadata
Finish: cleaning yum metadata
INFO: enabled ccache
Finish: chroot init
INFO: Running in chroot: printf '\x80'
Start: chroot printf '\x80'
Finish: chroot printf '\x80'
ERROR: 'ascii' codec can't encode character u'\ufffd' in position 0: ordinal not in range(128)
Traceback (most recent call last):
  File "/usr/sbin/mock", line 809, 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 647, in main
    run_command(options, args, config_opts, commands, buildroot, state)
  File "/usr/lib/python2.7/site-packages/mockbuild/trace_decorator.py", line 84, in trace
    result = func(*args, **kw)
  File "/usr/sbin/mock", line 686, in run_command
    commands.chroot(args, options)
  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/backend.py", line 289, in chroot
    self.buildroot.doChroot(args, shell=shell, cwd=options.cwd, printOutput=True)
  File "/usr/lib/python2.7/site-packages/mockbuild/buildroot.py", line 165, in doChroot
    env=self.env, shell=shell, *args, **kargs)
  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 421, in do
    printOutput=printOutput, child=child, chrootPath=chrootPath)
  File "/usr/lib/python2.7/site-packages/mockbuild/util.py", line 332, in logOutput
    print(input, end='')
UnicodeEncodeError: 'ascii' codec can't encode character u'\ufffd' in position 0: ordinal not in range(128)

Comment 2 Miroslav Suchý 2014-10-17 08:49:28 UTC
Fix commited to master as 5ed45a8. Contributed by Michael Šimáček.

Comment 3 Fedora Update System 2014-11-16 17:37:33 UTC
mock-1.2.1-1.fc21 has been submitted as an update for Fedora 21.
https://admin.fedoraproject.org/updates/mock-1.2.1-1.fc21

Comment 4 Fedora Update System 2014-11-16 17:38:55 UTC
mock-1.2.1-1.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/mock-1.2.1-1.fc20

Comment 5 Fedora Update System 2014-11-16 17:39:47 UTC
mock-1.2.1-1.el7 has been submitted as an update for Fedora EPEL 7.
https://admin.fedoraproject.org/updates/mock-1.2.1-1.el7

Comment 6 Fedora Update System 2014-11-16 17:40:47 UTC
mock-1.2.1-1.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/mock-1.2.1-1.el6

Comment 7 Fedora Update System 2014-11-17 06:29:54 UTC
Package mock-1.2.1-1.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing mock-1.2.1-1.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-15217/mock-1.2.1-1.fc20
then log in and leave karma (feedback).

Comment 8 Fedora Update System 2014-12-04 12:07:12 UTC
mock-1.2.3-1.fc21 has been submitted as an update for Fedora 21.
https://admin.fedoraproject.org/updates/mock-1.2.3-1.fc21

Comment 9 Fedora Update System 2014-12-04 12:10:40 UTC
mock-1.2.3-1.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/mock-1.2.3-1.fc20

Comment 10 Fedora Update System 2014-12-04 12:11:38 UTC
mock-1.2.3-1.el7 has been submitted as an update for Fedora EPEL 7.
https://admin.fedoraproject.org/updates/mock-1.2.3-1.el7

Comment 11 Fedora Update System 2014-12-12 04:08:09 UTC
mock-1.2.3-1.fc21 has been pushed to the Fedora 21 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 12 Fedora Update System 2014-12-17 04:43:11 UTC
mock-1.2.3-1.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 13 Fedora Update System 2015-01-06 02:06:57 UTC
mock-1.2.3-1.el7 has been pushed to the Fedora EPEL 7 stable repository.  If problems still persist, please make note of it in this bug report.