SFTP: fix problem with posix-rename code returning a Deferred for the renamed filenode, not for the result of the request (an empty string).
This commit is contained in:
parent
210578da63
commit
8f86490d48
|
@ -93,7 +93,7 @@ def _convert_error(res, request):
|
||||||
logmsg("RAISE %r %r" % (request, err.value), level=OPERATIONAL)
|
logmsg("RAISE %r %r" % (request, err.value), level=OPERATIONAL)
|
||||||
try:
|
try:
|
||||||
if noisy: logmsg(traceback.format_exc(err.value), level=NOISY)
|
if noisy: logmsg(traceback.format_exc(err.value), level=NOISY)
|
||||||
except:
|
except: # pragma: no cover
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# The message argument to SFTPError must not reveal information that
|
# The message argument to SFTPError must not reveal information that
|
||||||
|
@ -1398,7 +1398,9 @@ class SFTPUserHandler(ConchUser, PrefixingLogMixin):
|
||||||
|
|
||||||
fromPathstring = extensionData[4:(4 + fromPathLen)]
|
fromPathstring = extensionData[4:(4 + fromPathLen)]
|
||||||
toPathstring = extensionData[(8 + 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':
|
if extensionName == 'statvfs@openssh.com' or extensionName == 'fstatvfs@openssh.com':
|
||||||
return defer.succeed(struct.pack('>11Q',
|
return defer.succeed(struct.pack('>11Q',
|
||||||
|
|
|
@ -1009,7 +1009,9 @@ class Handler(GridTestMixin, ShouldFailMixin, unittest.TestCase):
|
||||||
def _renameFile(fromPathstring, toPathstring):
|
def _renameFile(fromPathstring, toPathstring):
|
||||||
extData = (struct.pack('>L', len(fromPathstring)) + fromPathstring +
|
extData = (struct.pack('>L', len(fromPathstring)) + fromPathstring +
|
||||||
struct.pack('>L', len(toPathstring)) + toPathstring)
|
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 = self._set_up("renameFile_posix")
|
||||||
d.addCallback(lambda ign: self._set_up_tree())
|
d.addCallback(lambda ign: self._set_up_tree())
|
||||||
|
|
Loading…
Reference in New Issue