Bugzilla – Bug 767
pkg client can't talk to repo at a path other than / on a server
Last modified: 2008-04-22 17:11:54 UTC
You need to log in before you can comment on or make changes to this bug.
If I say pkg image-create -a auth=http://ipkg.eng/myrepo/ /tmp/myimage pkg still ends up grabbing the catalog from http://ipkg.eng/catalog/0 instead of from http://ipkg.eng/myrepo/catalog/0
The problem is in pkg.misc.versioned_urlopen(), where we call urlparse.urljoin() on (what ends up being) the authority URL and the path to the versioned operation (like "catalog/0"). Even more frustratingly than os.path.join(), in which a component starting with "/" will cancel out all previous components, urljoin() ends up removing any path component of the URL from the first argument. In order to fix this, we'll have to extract the path from base_uri, and prepend it to operation (or put it in another element to come between the two).
Er, the description of urljoin() in the above comment is a bit off. It removes the last component of the path in the first argument if that argument doesn't end with a slash -- it's simplifying the task of taking one URL and joining the target of "href" to it to get the correct URL. It's still not the correct behavior we want here. You can work around this problem by ensuring that the origin URL has a trailing slash.
*** Bug 831 has been marked as a duplicate of this bug. ***
I think the most appropriate way to handle this is to clean prefix and mirror URLs prior to use, so we should change image.set_attrs(), which is called during "pkg image-create", and imageconfig.read(), which is called from all other paths.
(In reply to comment #2) > You can work around this problem by ensuring that the origin URL has a trailing > slash. This seems like the most feasible approach for now. Stephen says we need this for May. I'm marking it as a blocker.
Created an attachment (id=207) [details] Suggested Fix
Integrated 22Apr2008 as 9301d4d853492f072328f4ece37d40049f6891f1