createrepo not creating URLs correctly

Bug #1547474 reported by James
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
createrepo (Ubuntu)
New
Undecided
Unassigned

Bug Description

If the directory you wish to publish to contains characters that need to be escaped for a URL then create repo bombs out and will not work.

Linux ubuntu 3.19.0-15-generic #15-Ubuntu SMP Thu Apr 16 23:32:37 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
Ubuntu 15.04
createrepo 0.10.3-1

e.g.

user@ubuntu:~$ createrepo --update -o "/home/luser/source/a space/packaging/dist/jenkins/1.642/rpm-rc" --baseurl=file:/tmp/wibble "/home/luser/source/a space/packaging/dist/jenkins/1.642/rpm-rc/RPMS/noarch/"
Traceback (most recent call last):
  File "/usr/share/createrepo/genpkgmetadata.py", line 308, in <module>
    main(sys.argv[1:])
  File "/usr/share/createrepo/genpkgmetadata.py", line 276, in main
    mdgen.doPkgMetadata()
  File "/usr/lib/python2.7/dist-packages/createrepo/__init__.py", line 401, in doPkgMetadata
    self._setup_old_metadata_lookup()
  File "/usr/lib/python2.7/dist-packages/createrepo/__init__.py", line 387, in _setup_old_metadata_lookup
    self.oldData = readMetadata.MetadataIndex(old_repo_path, opts)
  File "/usr/lib/python2.7/dist-packages/createrepo/readMetadata.py", line 50, in __init__
    self._repo.baseurl = 'file://' + realpath
  File "/usr/lib/python2.7/dist-packages/yum/config.py", line 99, in __set__
    value, str(e)))
ValueError: Error parsing "baseurl = 'file:///home/luser/source/a space/packaging/dist/jenkins/1.642/rpm-rc'": URL must be http, ftp, file or https not ""

The code is obviously wrong...
/usr/lib/python2.7/dist-packages/createrepo/readMetadata.py:50
    self._repo.baseurl = 'file://' + realpath

You can not assume that an abitrary directory can be converted to a URL by prepending with file:// - characters need to be escaped - this is the whole reason why URL handling functions exist - e.g. https://docs.python.org/3/library/urllib.request.html#urllib.request.pathname2url

Colin Watson (cjwatson)
affects: make-dfsg (Ubuntu) → createrepo (Ubuntu)
Revision history for this message
Mike Miller (mtmiller) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.