Bug 1007870

Summary: can not handle redirection in URL?
Product: [Fedora] Fedora Reporter: Ales Kozumplik <akozumpl>
Component: librepoAssignee: Tomas Mlcoch <tmlcoch>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 20CC: jzeleny, tmlcoch, zpavlas
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: 2013-09-16 09:52:45 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:

Description Ales Kozumplik 2013-09-13 13:22:04 UTC
The following fails:

#! /usr/bin/python

import librepo
import time

MIRROR="""https://mirrors.fedoraproject.org/metalink?repo=updates-released-f19&arch=x86_64"""
DESTDIR="./"
URL="""https://bit.ly/18f4dpR"""

if __name__ == "__main__":
    h = librepo.Handle()
    h.destdir = DESTDIR
    h.interruptible = True
    h.repotype = librepo.LR_YUMREPO
    h.urls = [URL]
    h.yumdlist = ["primary", "filelists", "prestodelta", "group_gz"]
    # h.local = True
    h.perform(librepo.Result())
    print(h.urls)
    print(h.mirrors)

Comment 1 Ales Kozumplik 2013-09-13 13:22:53 UTC
I get:

Traceback (most recent call last):
  File "./main.py", line 20, in <module>
    h.perform(librepo.Result())
  File "/usr/lib64/python2.7/site-packages/librepo/__init__.py", line 916, in perform
    _librepo.Handle.perform(self, result)
librepo.LibrepoException: (19, 'Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried', 'Usable URL not found')

Comment 2 Zdeněk Pavlas 2013-09-16 09:52:45 UTC
What'd you expect?

[~]$ wget https://bit.ly/18f4dpR/repodata/repomd.xml
--2013-09-16 11:52:15--  https://bit.ly/18f4dpR/repodata/repomd.xml
Resolving bit.ly (bit.ly)... 69.58.188.40, 69.58.188.39
Connecting to bit.ly (bit.ly)|69.58.188.40|:443... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://bitly.com/18f4dpR/repodata/repomd.xml [following]
--2013-09-16 11:52:16--  https://bitly.com/18f4dpR/repodata/repomd.xml
Resolving bitly.com (bitly.com)... 69.58.188.33, 69.58.188.34
Connecting to bitly.com (bitly.com)|69.58.188.33|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2013-09-16 11:52:16 ERROR 404: Not Found.

Comment 3 Tomas Mlcoch 2013-09-16 10:45:52 UTC
Tested on /etc/yum.repos.d/fedora-updates.repo:

[updates]
name=Fedora $releasever - $basearch - Updates
failovermethod=priority
baseurl=http://bit.ly/1eFhQlB/pub/fedora/linux/updates/$releasever/$basearch/
#baseurl=http://download.fedoraproject.org/pub/fedora/linux/updates/$releasever/$basearch/
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=updates-released-f$releasever&arch=$basearch
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch

(http://bit.ly/1eFhQlB points to http://download.fedoraproject.org)

$ yum update
...
http://bit.ly/1eFhQlB/pub/fedora/linux/updates/19/x86_64/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found
Trying other mirror.
...

= Not a bug

Comment 4 Ales Kozumplik 2013-09-16 11:58:19 UTC
I see, you are right.

It's actually not possible to clone a git repo either using a generic shortening service:

$ git clone http://bit.ly/186v4AA
Cloning into '186v4AA'...
fatal: http://bit.ly/186v4AA/info/refs not valid: is this a git repository?