LocalTransport has readonly+ in the file path

Bug #1097567 reported by Patrick Hetu
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
loggerhead
Triaged
Critical
Unassigned

Bug Description

I was getting 404 no matter what I did so I started investigating and this is what I found so far:

Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/paste/httpserver.py", line 1068, in process_request_in_thread
    self.finish_request(request, client_address)
  File "/usr/lib/python2.7/SocketServer.py", line 334, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python2.7/SocketServer.py", line 649, in __init__
    self.handle()
  File "/usr/lib/python2.7/dist-packages/paste/httpserver.py", line 442, in handle
    BaseHTTPRequestHandler.handle(self)
  File "/usr/lib/python2.7/BaseHTTPServer.py", line 340, in handle
    self.handle_one_request()
  File "/usr/lib/python2.7/dist-packages/paste/httpserver.py", line 437, in handle_one_request
    self.wsgi_execute()
  File "/usr/lib/python2.7/dist-packages/paste/httpserver.py", line 287, in wsgi_execute
    self.wsgi_start_response)
  File "/usr/lib/python2.7/dist-packages/paste/translogger.py", line 68, in __call__
    return self.application(environ, replacement_start_response)
  File "/usr/lib/python2.7/dist-packages/loggerhead/apps/error.py", line 31, in __call__
    return self.application(environ, start_response)
  File "/usr/lib/python2.7/dist-packages/paste/httpexceptions.py", line 633, in __call__
    return self.application(environ, start_response)
  File "/usr/lib/python2.7/dist-packages/paste/deploy/config.py", line 291, in __call__
    return self.app(environ, start_response)
  File "/usr/lib/python2.7/dist-packages/loggerhead/apps/transport.py", line 165, in __call__
    transport, self)(environ, start_response)
  File "/usr/lib/python2.7/dist-packages/loggerhead/apps/transport.py", line 114, in __call__
    assert False, self.transport
AssertionError: <bzrlib.transport.local.LocalTransport url=file:///var/lib/loggerhead/trunk-rich/readonly%2B./>

Is it normal that readonly+ is in the file path? Could it be a middleware that is not working?

/etc/serve-branches.conf :

served_branches=/var/lib/loggerhead
port=8090
prefix=/

loggerhead 1.19~bzr479-2
python-paste 1.7.5.1-4.1ubuntu1
python-pastedeploy 1.5.0-3
python-pastescript 1.7.5-2

Ask me if you need more info.

Changed in loggerhead:
status: New → Triaged
importance: Undecided → Critical
Revision history for this message
John A Meinel (jameinel) wrote : Re: [Bug 1097567] [NEW] LocalTransport have readonly+ in the file path

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

...

AssertionError: <bzrlib.transport.local.LocalTransport
url=file:///var/lib/loggerhead/trunk-rich/readonly%2B./>
>
> Is it normal that readonly+ is in the file path? Could it be a
> middleware that is not working?

Do you know where the '.' is coming from? It is, actually, expected to
have readonly+, but only at the beginning. So: "readonly+file:///...".
The issue is that somehow we are getting a simple relative path "."
rather than the expected URL file:///...

readonly+file:/// is our way to make sure to disallow write actions on
paths.

Offhand 'serve-branches' isn't a very maintained way of service
Loggerhead. (bzr serve --http IIRC is the recommended way.)

So there is probably a bug in here, but I'm not sure whether it is
that we aren't canonicalizing some input from the user, or whether it
is a configuration thing.

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (Cygwin)
Comment: Using GnuPG with undefined - http://www.enigmail.net/

iEYEARECAAYFAlDuXpMACgkQJdeBCYSNAAP5HwCfYCEChlNdxBD0Fzi/BC9gfaen
4v4AnR0jCrBPyJw3Q8svJRILGibegNn7
=QWyp
-----END PGP SIGNATURE-----

Revision history for this message
Kevin Bulgrien (kevin-bulgrien-z) wrote : Re: LocalTransport have readonly+ in the file path

Regarding the comment about serve-branches being not really maintained... and that the plugin is the recommended way, I worry a bit about the plugin... as it contains code that might assert --allow-writes behind my back:

$ cd /path/to/python2.7/site-packages/bzrlib/plugins/loggerhead
$ grep --context=3 readonly __init__.py
        if port is None:
            port = DEFAULT_PORT
        argv = ['--host', host, '--port', str(port), '--', transport.base]
        if not transport.is_readonly():
            argv.insert(0, '--allow-writes')
        config = LoggerheadConfig(argv)
        setup_logging(config)
--
                    if allow_writes:
                        transport = get_transport(path)
                    else:
                        transport = get_transport('readonly+' + path)
                    serve_http(transport, host, port)
                else:
                    super(cmd_serve, self).run(*args, **kw)

summary: - LocalTransport have readonly+ in the file path
+ LocalTransport has readonly+ in the file path
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.