Bug 1310075 - createrepo bombs out if dir contains characters than need URL escaping.
createrepo bombs out if dir contains characters than need URL escaping.
Status: CLOSED EOL
Product: Fedora
Classification: Fedora
Component: createrepo (Show other bugs)
24
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: packaging-team-maint
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2016-02-19 06:43 EST by James
Modified: 2017-08-08 09:04 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-08-08 09:04:16 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description James 2016-02-19 06:43:13 EST
Description of problem:

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


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

createrepo 0.10.3 
(but offending code is still present in upstream master repo)

How reproducible:

100%

Steps to Reproduce:
1. cd /tmp
2. mkdir -p "a space/RPMS/noarch"
3. curl -o a\ space/RPMS/noarch/asciio-1.51.3-2.fc23.noarch.rpm https://www.mirrorservice.org/sites/dl.fedoraproject.org/pub/fedora/linux/releases/23/Everything/x86_64/os/Packages/a/asciio-1.51.3-2.fc23.noarch.rpm
4. createrepo --update -o "/tmp/a space" --baseurl=file:/tmp/a%20space  "/tmp/a space/RPMS/noarch/"

Actual results:

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:///tmp/a space'": URL must be http, ftp, file or https not ""


Expected results:

it works.

Additional info:

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

Also - workaround of not using directory containing spaces is non trivial in the days of CI systems - where the CWD of the build is based on the job name that may contain arbitrary characters.  writing to a sub directory for the build is required for CD solutions where the repo will be exposed to later stages (and as such needs to be in the builds workspace for archival purposes)
Comment 1 Jan Kurik 2016-02-24 10:27:16 EST
This bug appears to have been reported against 'rawhide' during the Fedora 24 development cycle.
Changing version to '24'.

More information and reason for this action is here:
https://fedoraproject.org/wiki/Fedora_Program_Management/HouseKeeping/Fedora24#Rawhide_Rebase
Comment 2 Fedora End Of Life 2017-07-25 16:14:39 EDT
This message is a reminder that Fedora 24 is nearing its end of life.
Approximately 2 (two) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 24. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '24'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 24 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.
Comment 3 Fedora End Of Life 2017-08-08 09:04:16 EDT
Fedora 24 changed to end-of-life (EOL) status on 2017-08-08. Fedora 24 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Note You need to log in before you can comment on or make changes to this bug.