Bug 1288960

Summary: [UX] dnf crashes when adding copr repo user/project (sic)
Product: [Fedora] Fedora Reporter: Chris Murphy <bugzilla>
Component: dnfAssignee: rpm-software-management
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 23CC: ignatenko, jsilhan, mbasti, mluscon, packaging-team-maint, pnemade, vmukhame, zbyszek
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-21 13:27:17 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:
Attachments:
Description Flags
strace of crash none

Description Chris Murphy 2015-12-07 06:16:40 UTC
Created attachment 1103019 [details]
strace of crash

Description of problem:

When adding copr repo per https://fedorahosted.org/copr/wiki/HowToEnableRepo dnf crashes with traceback. I took this literally, so it's one part user error, but dnf crashes, rather than failing with some rational error message that it didn't understand what I was asking for.



Version-Release number of selected component (if applicable):
dnf-1.1.4-2.fc23.noarch
hawkey-0.6.2-1.fc23.x86_64

How reproducible:
Always


Steps to Reproduce:
1. dnf copr enable user/project (sic)
2.
3.

Actual results:

# dnf copr enable user/project

You are about to enable a Copr repository. Please note that this
repository is not part of the main Fedora distribution, and quality
may vary.

The Fedora Project does not exercise any power over the contents of
this repository beyond the rules outlined in the Copr FAQ at
<https://fedorahosted.org/copr/wiki/UserDocs#WhatIcanbuildinCopr>, and
packages are not held to any quality or security level.

Please do not file bug reports about these packages in Fedora
Bugzilla. In case of problems, contact the owner of this repository.

Do you want to continue? [y/N]: y
Traceback (most recent call last):
  File "/usr/lib/python3.4/site-packages/dnfpluginscore/lib.py", line 71, in urlopen
    librepo.download_url(url, fo.fileno(), handle)
  File "/usr/lib64/python3.4/site-packages/librepo/__init__.py", line 1517, in download_url
    return _librepo.download_url(handle, url, fd)
librepo.LibrepoException: (10, 'Status code: 404 for https://copr.fedoraproject.org/coprs/user/project/repo/fedora-23/', 'Error HTTP/FTP status code')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.4/site-packages/dnf-plugins/copr.py", line 264, in _download_repo
    f = dnfpluginscore.lib.urlopen(self, None, self.copr_url + api_path, 'w+')
  File "/usr/lib/python3.4/site-packages/dnfpluginscore/lib.py", line 73, in urlopen
    raise IOError(e.args[1])
OSError: Status code: 404 for https://copr.fedoraproject.org/coprs/user/project/repo/fedora-23/

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/bin/dnf", line 57, in <module>
    main.user_main(sys.argv[1:], exit_code=True)
  File "/usr/lib/python3.4/site-packages/dnf/cli/main.py", line 174, in user_main
    errcode = main(args)
  File "/usr/lib/python3.4/site-packages/dnf/cli/main.py", line 60, in main
    return _main(base, args)
  File "/usr/lib/python3.4/site-packages/dnf/cli/main.py", line 112, in _main
    cli.run()
  File "/usr/lib/python3.4/site-packages/dnf/cli/cli.py", line 1091, in run
    return self.command.run(self.base.extcmds)
  File "/usr/lib/python3.4/site-packages/dnf-plugins/copr.py", line 153, in run
    self._download_repo(project_name, repo_filename, chroot)
  File "/usr/lib/python3.4/site-packages/dnf-plugins/copr.py", line 272, in _download_repo
    res = urllib.request.urlopen(self.copr_url + "/coprs/" + project_name, 'w+')
  File "/usr/lib64/python3.4/urllib/request.py", line 161, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib64/python3.4/urllib/request.py", line 461, in open
    req = meth(req)
  File "/usr/lib64/python3.4/urllib/request.py", line 1112, in do_request_
    raise TypeError(msg)
TypeError: POST data should be bytes or an iterable of bytes. It cannot be of type str.




Expected results:

It should fail gracefully.


Additional info:


user/project itself is not valid. If I use the command
dnf copr enable hadrons123/thermald
the repo is added without error

Comment 1 Jaroslav Mracek 2016-01-19 14:00:44 UTC
*** Bug 1298246 has been marked as a duplicate of this bug. ***

Comment 2 Fedora Admin XMLRPC Client 2016-07-08 09:40:20 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 3 Igor Gnatenko 2016-07-21 13:27:17 UTC

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