Bug 767 - pkg client can't talk to repo at a path other than / on a server
: pkg client can't talk to repo at a path other than / on a server
Status: RESOLVED FIXINSOURCE
Product: pkg
cli
: unspecified
: ANY/Generic OpenSolaris
: P3 major (vote)
: ---
Assigned To: johansen
: pkg/cli watcher
:
:
:
:
: 1190
  Show dependency treegraph
 
Reported: 2008-03-13 18:50 UTC by Danek Duvall
Modified: 2008-04-22 17:11 UTC (History)
3 users (show)

See Also:


Attachments
Suggested Fix (552 bytes, patch)
2008-04-22 15:55 UTC, johansen
no flags Details | Diff


Note

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


Description Danek Duvall 2008-03-13 18:50:29 UTC
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
Comment 1 Danek Duvall 2008-03-13 18:54:35 UTC
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).
Comment 2 Danek Duvall 2008-03-13 19:19:06 UTC
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.
Comment 3 Danek Duvall 2008-03-20 14:52:28 UTC
*** Bug 831 has been marked as a duplicate of this bug. ***
Comment 4 Stephen Hahn 2008-04-01 11:07:07 UTC
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.
Comment 5 johansen 2008-04-22 15:30:35 UTC
(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.
Comment 6 johansen 2008-04-22 15:55:58 UTC
Created an attachment (id=207) [details]
Suggested Fix
Comment 7 johansen 2008-04-22 17:11:54 UTC
Integrated 22Apr2008 as 9301d4d853492f072328f4ece37d40049f6891f1