]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
SFTP: fix problem with posix-rename code returning a Deferred for the renamed filenod...
authordavid-sarah <david-sarah@jacaranda.org>
Tue, 25 May 2010 02:02:09 +0000 (19:02 -0700)
committerdavid-sarah <david-sarah@jacaranda.org>
Tue, 25 May 2010 02:02:09 +0000 (19:02 -0700)
src/allmydata/frontends/sftpd.py
src/allmydata/test/test_sftp.py

index c768fd7acc40dc3b9cbaa00c4b0546cb29c3529a..ccf05b24082e9473a5060f7feadd03d8ecaf3abd 100644 (file)
@@ -93,7 +93,7 @@ def _convert_error(res, request):
     logmsg("RAISE %r %r" % (request, err.value), level=OPERATIONAL)
     try:
         if noisy: logmsg(traceback.format_exc(err.value), level=NOISY)
-    except:
+    except:  # pragma: no cover
         pass
 
     # The message argument to SFTPError must not reveal information that
@@ -1398,7 +1398,9 @@ class SFTPUserHandler(ConchUser, PrefixingLogMixin):
 
             fromPathstring = extensionData[4:(4 + fromPathLen)]
             toPathstring = extensionData[(8 + fromPathLen):]
-            return self.renameFile(fromPathstring, toPathstring, overwrite=True)
+            d = self.renameFile(fromPathstring, toPathstring, overwrite=True)
+            d.addCallback(lambda ign: "")
+            return d
 
         if extensionName == 'statvfs@openssh.com' or extensionName == 'fstatvfs@openssh.com':
             return defer.succeed(struct.pack('>11Q',
index 1b4a90321d464a79995f39b0f829beaeadc2d1f9..84d2c8ad51093501e74ed4a3251ca29fd6c0a363 100644 (file)
@@ -1009,7 +1009,9 @@ class Handler(GridTestMixin, ShouldFailMixin, unittest.TestCase):
         def _renameFile(fromPathstring, toPathstring):
             extData = (struct.pack('>L', len(fromPathstring)) + fromPathstring +
                        struct.pack('>L', len(toPathstring))   + toPathstring)
-            return self.handler.extendedRequest('posix-rename@openssh.com', extData)
+            d2 = self.handler.extendedRequest('posix-rename@openssh.com', extData)
+            d2.addCallback(lambda res: self.failUnlessReallyEqual(res, ""))
+            return d2
 
         d = self._set_up("renameFile_posix")
         d.addCallback(lambda ign: self._set_up_tree())