when RemoteTransport.mkdir raised PermissionDenied, the path is always None

Bug #299254 reported by Michael Hudson-Doyle
2
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
Medium
Andrew Bennetts

Bug Description

As discussed on #bzr, RemoteTransport.mkdir always loses the path provided by the server and replaces it with "None" when raising PermissionDenied.

<spiv> Ah, so it is. That seems to be a bug in RemoteTransport
<spiv> RemoteTransport didn't exactly handle PermissionDenied gracefully before 1.9 either...
<mwhudson> spiv: yes, that's what i'm finding
<mwhudson> mkdir calls _call2 calls _translate_error without passing on relpath

Revision history for this message
Andrew Bennetts (spiv) wrote :

Here's a quick patch to RemoteTransport that fixes the issue:

$ bzr cdiff bzrlib/transport/remote.py
=== modified file 'bzrlib/transport/remote.py'
--- bzrlib/transport/remote.py 2008-11-03 19:05:06 +0000
+++ bzrlib/transport/remote.py 2008-11-17 22:54:56 +0000
@@ -172,7 +172,12 @@
         try:
             return self._client.call(method, *args)
         except errors.ErrorFromSmartServer, err:
- self._translate_error(err)
+ # The first argument, if present, is always a path.
+ if args:
+ context = {'orig_path': args[0]}
+ else:
+ context = {}
+ self._translate_error(err, **context)

     def _call_with_body_bytes(self, method, args, body):
         """Call a method on the remote server with body bytes."""

It needs tests, obviously.

Changed in bzr:
assignee: nobody → spiv
importance: Undecided → Medium
status: New → In Progress
Andrew Bennetts (spiv)
Changed in bzr:
status: In Progress → Fix Committed
Revision history for this message
Andrew Bennetts (spiv) wrote :

This is in 1.10rc1.

Changed in bzr:
milestone: none → 1.10rc1
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.