Bug 157453

Summary: rug with local yum repository: download failed
Product: [openSUSE] SUSE Linux 10.1 Reporter: Andreas Gruenbacher <agruen>
Component: ZenworksAssignee: Klaus Kämpf <kkaempf>
Status: VERIFIED FIXED QA Contact: Eric Waldow <ewaldow>
Severity: Blocker    
Priority: P5 - None CC: mt, suse-beta
Version: Beta 7   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: Other Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: Patch needed to allow a hostname in "dir" and "file" url's

Description Andreas Gruenbacher 2006-03-11 19:10:47 UTC
I am failing to use rug in Beta 7: with a repository on a local file system, I get the below result. With a repository over http, I run into ``Download failed: Download failed: (http://w3.suse.de/~agruen/foo) The request timed out'':

$ cd /var/tmp
$ mkdir -p foo/dir
$ cd foo
$ cp /mounts/dist/install/SLP/SUSE-10.1-Beta7/i386/CD1/suse/i586/novfs-kmp-default-1.2.0_2.6.16_rc5_git9_2-7.i586.rpm dir/
$ createrepo .
$ rug service-add --type=yum file:///var/tmp/foo
$ rug subscribe foo
$ rug search novfs-kmp-default

S | Catalog | Bundle | Name              | Version                   | Arch
--+---------+--------+-------------------+---------------------------+-----
  | foo     |        | novfs-kmp-default | 1.2.0_2.6.16_rc5_git9_2-7 | i586

$ rug install novfs-kmp-default
Resolving Dependencies...

The following packages will be installed:
  novfs-kmp-default 1.2.0_2.6.16_rc5_git9_2-7 (file:///var/tmp/foo)


Downloading Packages...
                                                                             0%

Download failed: Download failed: (file:///var/tmp/foo) File not found: /var/tmp/foo

======================================================

$ rug service-delete foo
$ rug service-add http://w3.suse.de/~agruen/foo foo
$ rug subscribe foo
$ rug install novfs-kmp-default
Resolving Dependencies...

The following packages will be installed:
  novfs-kmp-default 1.2.0_2.6.16_rc5_git9_2-7 (http://w3.suse.de/~agruen/foo)


Downloading Packages...
                                                                             0%

Download failed: Download failed: (http://w3.suse.de/~agruen/foo) The request timed out
Comment 1 Tambet Ingo 2006-03-21 16:28:25 UTC
It might be already fixed, but I'm not sure. There was another bug where zypp helper set the 'local', 'package_filename' and 'package_url' incorrectly. It was a bug about not been able to install local packages, which is related, but not necessary the same code path.

So, in this case, parse-metadata should set local=1, package_url=null, package_filename=/path/to/file

--> Klaus
Comment 2 Klaus Kämpf 2006-03-21 21:53:01 UTC
This was fixed in rev 2508 (2006-03-16)
Comment 3 Eric Waldow 2006-06-16 19:00:57 UTC
Well, download is working now for an http:// service, but I can't get the service-add to work with a YUM service and file:// URI.  It complains that it's an invalid URI scheme.

I can't see a reason to explicitly exclude file:// URI's, so that may be worth revisiting at some point.

Downloads work, so I'm verifying the bug.
Comment 4 Klaus Kämpf 2006-06-16 20:51:59 UTC
IIRC, file: does not allow a hostname, so use file:/foo/bar/baz (single slash after colon).
Marius, maybe you can add some comment here ?!
Comment 5 Marius Tomaschewski 2006-06-19 13:53:10 UTC
The "file" scheme in the Url allows hostname, but the MediaDIR still
rejects it. We can disable/remove this check (ctor in MediaDIR.cc):

        MIL << "MediaDIR::MediaDIR(" << url_r << ")" << endl;
+#if 0
        if( !url_r.getHost().empty())
        {
          ZYPP_THROW(MediaBadUrlException(url_r,
            "Hostname not allowed in the Url"
          ));
        }
+#endif
    }

Should I do it?
Comment 6 Marius Tomaschewski 2006-06-19 14:03:21 UTC
Ahm... There is also a differece between "dir" and "file" zypp::Url
scheme - "dir" does not allow a hostname. This would need a change
as well.
Comment 7 Marius Tomaschewski 2006-06-19 14:07:18 UTC
Created attachment 90228 [details]
Patch needed to allow a hostname in "dir" and "file" url's