Branching a read-only HTTP branch (with no working tree) fails with bzr-1.4

Bug #220453 reported by René 'Necoro' Neumann
4
Affects Status Importance Assigned to Milestone
Bazaar
Invalid
Undecided
Unassigned
Gentoo Overlay for Bazaar
Fix Released
High
Mark Lee

Bug Description

Using bzr-1.4, branching from the overlay fails:

 % bzr branch http://bzr.malept.com/bazaar-overlay
bzr: ERROR: Not a branch: "http://www.malept.com/404.html".

It works when using the normal LP mirror:

% bzr branch http://bazaar.launchpad.net/~malept/bzr-gentoo-overlay/overlay-main
Branched 114 revision(s).

Don't know if this is related to bzr (worked fine with 1.3) or to your server.

Revision history for this message
Mark Lee (malept) wrote :

Strange. I just tried with an old bzr 1.1 install, and it works, whereas with bzr-1.4rc2 doesn't work.

Changed in bzr-gentoo-overlay:
assignee: nobody → malept
importance: Undecided → High
status: New → Confirmed
Revision history for this message
Mark Lee (malept) wrote :

It should be noted that there is no working tree with this remote branch.

Console output:

$ bzr branch http://bzr.malept.com/bazaar-overlay/
bzr: ERROR: Not a branch: "http://www.malept.com/404.html".
$ bzr --version
Bazaar (bzr) 1.4rc2
  Python interpreter: /usr/bin/python 2.4.4
  Python standard library: /usr/lib/python2.4
  bzrlib: /usr/lib/python2.4/site-packages/bzrlib

Copyright 2005, 2006, 2007, 2008 Canonical Ltd.
http://bazaar-vcs.org/

bzr comes with ABSOLUTELY NO WARRANTY. bzr is free software, and
you may use, modify and redistribute it under the terms of the GNU
General Public License version 2 or later.

Relevant seciton of ~/.bzr.log output:

0.213 encoding stdout as sys.stdout encoding 'UTF-8'
0.214 bzr arguments: [u'branch', u'http://bzr.malept.com/bazaar-overlay/']
0.215 looking for plugins in /home/malept/.bazaar/plugins
0.485 looking for plugins in /usr/lib/python2.4/site-packages/bzrlib/plugins
0.486 Plugin name __init__ already loaded
0.486 Plugin name __init__ already loaded
0.689 encoding stdout as sys.stdout encoding 'UTF-8'
1.093 Traceback (most recent call last):
  File "/usr/lib/python2.4/site-packages/bzrlib/commands.py", line 846, in run_bzr_catch_errors
    return run_bzr(argv)
  File "/usr/lib/python2.4/site-packages/bzrlib/commands.py", line 802, in run_bzr
    ret = run(*run_argv)
  File "/usr/lib/python2.4/site-packages/bzrlib/commands.py", line 504, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/usr/lib/python2.4/site-packages/bzrlib/builtins.py", line 923, in run
    accelerator_tree, br_from = bzrdir.BzrDir.open_tree_or_branch(
  File "/usr/lib/python2.4/site-packages/bzrlib/bzrdir.py", line 813, in open_tree_or_branch
    bzrdir = klass.open(location)
  File "/usr/lib/python2.4/site-packages/bzrlib/bzrdir.py", line 691, in open
    return BzrDir.open_from_transport(t, _unsupported=_unsupported)
  File "/usr/lib/python2.4/site-packages/bzrlib/bzrdir.py", line 728, in open_from_transport
    redirected)
  File "/usr/lib/python2.4/site-packages/bzrlib/lazy_import.py", line 125, in __call__
    return obj(*args, **kwargs)
  File "/usr/lib/python2.4/site-packages/bzrlib/transport/__init__.py", line 1662, in do_catching_redirections
    transport = redirected(transport, e, redirection_notice)
  File "/usr/lib/python2.4/site-packages/bzrlib/bzrdir.py", line 712, in redirected
    raise errors.NotBranchError(path=e.target)
NotBranchError: Not a branch: "http://www.malept.com/404.html".

1.093 return code 3

Plugins installed: bisect (1.0), builddev (0.92.0dev0), bzrtools (1.4.0), dbus, gnulog, gtk (0.93.0), hg, launchpad, rebase (0.2.0), svn (0.4.9), vimdiff

René: could you post the same information?

Revision history for this message
Mark Lee (malept) wrote :

By "builddev", I meant "builddeb".

Revision history for this message
Mark Lee (malept) wrote :

OK, I figured it out. There's a change in bzr-1.4, which I've excerpted from NEWS:

> The smart protocol client is slightly faster, because it now only queries the server
> for the protocol version once per connection. Also, the HTTP transport will now
> automatically probe for and use a smart server if one is present. You can use the
> new nosmart+ transport decorator to get the old behaviour. (Andrew Bennetts)

Apparently, for now you need to use `bzr branch nosmart+http://bzr.malept.com/bazaar-overlay/` to retrieve my overlay. I'm going to look into turning that branch into a smart server, so setting as "Confirmed".

Revision history for this message
René 'Necoro' Neumann (necoro) wrote :

Ok - thanks. Works with adding "nosmart".

But I'm wondering why bzr fails nevertheless. Because the NEWS message says, that it only uses smart server if one is present... And as there is no smart server present on your server, it should continue with old behavior...

Revision history for this message
Mark Lee (malept) wrote :

> But I'm wondering why bzr fails nevertheless. Because the NEWS message says,
> that it only uses smart server if one is present... And as there is no smart server
> present on your server, it should continue with old behavior...

Yes, I agree. I'm adding the bzr project to this bug to see if any of the bzr developers can give any insight as to whether this is a regression in functionality or not.

Revision history for this message
Matt Nordhoff (mnordhoff) wrote :

When a file doesn't exist, instead of returning a 404 Not Found, your web server does a 302 redirect to http://www.malept.com/404.html. This is incorrect. You should fix it.

Revision history for this message
James Westby (james-w) wrote :

Hi,

It appears as though the problem is that even though
you are redirecting to a page named "404.html" you
actually return a 200 response code, so bzr doesn't realise
that it has done something wrong.

The change is because bzr now probes for the smart server
by looking for .bzr/smart, which doesn't exist here, but
it's told that it does exist (200 response), but it's not able
to query it for branch info, so it assumes that it isn't really
a branch.

With a 200 reponse code I'm not sure what can be done.

Is it reasonable to expect that if .bzr/smart exists it is a branch,
and so if it then appears not to be we should fall back an
try the dumb transport?

Thanks,

James

Revision history for this message
Mark Lee (malept) wrote :

It uses a standard Apache configuration option to do that.
ErrorDocument 404 http://www.malept.com/404.html

I'll fix it, but I would imagine that redirecting the 404 to a page on a different domain might be mandatory for certain webhosts.

Revision history for this message
Matt Nordhoff (mnordhoff) wrote : Re: [Bug 220453] Re: Branching a read-only HTTP branch (with no working tree) fails with bzr-1.4

Quoting from the Apache docs:

> Note that when you specify an ErrorDocument that points to a remote
> URL (ie. anything with a method such as http in front of it), Apache
> will send a redirect to the client to tell it where to find the
> document, even if the document ends up being on the same server. This
> has several implications, the most important being that the client
> will not receive the original error status code, but instead will
> receive a redirect status code. This in turn can confuse web robots
> and other clients which try to determine if a URL is valid using the
> status code.

<http://httpd.apache.org/docs/2.2/mod/core.html#errordocument>

If 404.html is on the same server, you could put a symlink to it inside
<http://bzr.malept.com/> or Alias it or something.

Revision history for this message
Mark Lee (malept) wrote :

Based on the comments, I'm marking this as invalid in bzr.

Changed in bzr:
status: New → Invalid
Revision history for this message
Mark Lee (malept) wrote :

`bzr branch http://bzr.malept.com/bazaar-overlay` should now work, as I got rid of the external 404 page and implemented smart server (bzr+http) support.

Changed in bzr-gentoo-overlay:
status: Confirmed → 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.