nosmart+http interacts badly with http redirects

Bug #245964 reported by Jonathan Lange
8
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
High
Vincent Ladeuil
Launchpad itself
Fix Released
Critical
Jonathan Lange

Bug Description

Since we changed the puller to use nosmart+http for all http branches, we've been getting errors like:
    PathNotChild: Path "http://pocoo.org/%7Emitsuhiko/bzr/ruty/.bzr/branch-format" is not a child of path "nosmart+http://pocoo.org/%7Emitsuhiko/bzr/ruty/"

See OOPS-917SMPM113 for a full stack trace.

Given the traceback and that only a few branches have been hit with this, I guess that only affects things with branch references or redirects.

Let's back out the nosmart+ thing and repull the affected branches.

Tags: http lp-code
Jonathan Lange (jml)
Changed in launchpad-bazaar:
assignee: nobody → jml
importance: Undecided → Critical
status: New → Triaged
Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Seems to be to do with http redirects.

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

I think this is a problem in bzr itself -- try 'bzr get nosmart+http://pocoo.org/~mitsuhiko/bzr/ruty' for example.

Revision history for this message
Jonathan Lange (jml) wrote :

Workaround submitted to PQM.

Changed in launchpad-bazaar:
status: Triaged → In Progress
Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote : Re: Using nosmart+ in puller interacts redirects

Having chatted a bit about this with Aaron in #bzr, I've got as far as seeing that the code in do_catching_redirections in bzrdir.py to see if the end of the path bzr is being redirected to is the same as the end of the path bzr asked for is a bit screwy.

Maybe transport.get should remember the relpath it was asked for and stash this on the redirect exception. Or something.

Revision history for this message
Jonathan Lange (jml) wrote :

The Launchpad workaround has been cherrypicked onto production.

Changed in launchpad-bazaar:
status: In Progress → Fix Released
Vincent Ladeuil (vila)
Changed in bzr:
status: New → Confirmed
Revision history for this message
John A Meinel (jameinel) wrote :

I believe Michael has proposed a change for it on the list, which is pending review and maybe some updates.

Changed in bzr:
assignee: nobody → mwhudson
importance: Undecided → High
status: Confirmed → In Progress
Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

I don't remember submitting any patches for this!

Revision history for this message
John A Meinel (jameinel) wrote :

Yeah, I was remembering:
http://thread.gmane.org/gmane.comp.version-control.bazaar-ng.general/44276

bug #129307

I was remembering the wrong thing. (That also has to do with redirection handling and nosmart, though in a different way.)

I guess I'm a bit confused as to what the specific issue is for bzr, then. Is it that the nosmart+ wrapper isn't able to prefix redirected requests? So they appear to be separate URLs?

Changed in bzr:
assignee: mwhudson → nobody
status: In Progress → Incomplete
Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Yeah, I don't think it's anything to do with nosmart+ specifically -- "bzr get readonly+http://pocoo.org/~mitsuhiko/bzr/ruty" fails in the same way.

I'm also a bit confused about what the core issue is, but something that definitely should work definitely doesn't, so I think that's a Confirmed rather than Incomplete bug.

Changed in bzr:
status: Incomplete → Confirmed
Revision history for this message
Vincent Ladeuil (vila) wrote :

Long story short: decorators are incompatible with redirects.

Long story:
- only http is concerned by redirects (obviously)
- an http server can redirect urls to anything (not only http), but AFAIK, it will never add back bzr decorators (so, for example, using nosmart+ disable the hpss probing but when redirection occurs, the probing will be done again since we now use a simple http:// scheme)
- bzr never follows redirections *except* in bzrdir.py
- bzrdir redirection handling was meant to be used only at *first* access (which was for the branch format file (which explains the otherwise weird e.target.endswith(relpath)) all other uses are undefined

This should be fixed.

Until then, redirection works if you're lucky (and we have been lucky for a long time)

The FIXME in that part of the code is about the fact that decorators are lost here, which, at the time, meant that an http+urllib, when redirected became an http+pycurl because pycurl was (and still is) the default http transport returned by get_transport(). This now applies equally well for nosmart+ and readonly+ or any decorator: they are lost and their associated semantic with them.

Vincent Ladeuil (vila)
Changed in bzr:
assignee: nobody → vila
status: Confirmed → In Progress
Revision history for this message
Vincent Ladeuil (vila) wrote :

Fix available in associated branch, tests appreciated before I submit since I want to fix related bugs in the same submission ( I derogate to the usual one-bug-one-fix rule because several bugs are closely related).

Vincent Ladeuil (vila)
Changed in bzr:
status: In Progress → Fix Committed
Vincent Ladeuil (vila)
Changed in bzr:
milestone: none → 1.11rc1
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.