From: david-sarah Date: Sat, 15 May 2010 00:56:56 +0000 (-0700) Subject: Eliminate Windows newlines from sftpd.py. X-Git-Tag: trac-4400~31 X-Git-Url: https://git.rkrishnan.org/%5B/%5D%20/uri/index.php?a=commitdiff_plain;h=7409d1e01923273eda140c0457988624ef17137e;p=tahoe-lafs%2Ftahoe-lafs.git Eliminate Windows newlines from sftpd.py. --- diff --git a/src/allmydata/frontends/sftpd.py b/src/allmydata/frontends/sftpd.py index 1ec674b4..b06f9606 100644 --- a/src/allmydata/frontends/sftpd.py +++ b/src/allmydata/frontends/sftpd.py @@ -19,7 +19,7 @@ from twisted.cred import portal from twisted.internet import defer from twisted.internet.interfaces import IFinishableConsumer -from foolscap.api import eventually +from foolscap.api import eventually from allmydata.util import deferredutil from allmydata.util.consumer import download_to_data @@ -238,7 +238,7 @@ def _populate_attrs(childnode, metadata, writeable, size=None): attrs["permissions"] = perms # We could set the SSH_FILEXFER_ATTR_FLAGS here: - # ENCRYPTED would always be true ("The file is stored on disk + # ENCRYPTED would always be true ("The file is stored on disk # using file-system level transparent encryption.") # SYSTEM, HIDDEN, ARCHIVE and SYNC would always be false. # READONLY and IMMUTABLE would be set according to @@ -259,12 +259,12 @@ class EncryptedTemporaryFile(PrefixingLogMixin): def _crypt(self, offset, data): # FIXME: use random-access AES (pycryptopp ticket #18) - offset_big = offset // 16 - offset_small = offset % 16 - iv = binascii.unhexlify("%032x" % offset_big) - cipher = AES(self.key, iv=iv) - cipher.process("\x00"*offset_small) - return cipher.process(data) + offset_big = offset // 16 + offset_small = offset % 16 + iv = binascii.unhexlify("%032x" % offset_big) + cipher = AES(self.key, iv=iv) + cipher.process("\x00"*offset_small) + return cipher.process(data) def close(self): self.file.close() @@ -550,11 +550,11 @@ class ShortReadOnlySFTPFile(PrefixingLogMixin): def _read(data): if noisy: self.log("_read(%r) in readChunk(%r, %r)" % (data, offset, length), level=NOISY) - # "In response to this request, the server will read as many bytes as it - # can from the file (up to 'len'), and return them in a SSH_FXP_DATA - # message. If an error occurs or EOF is encountered before reading any - # data, the server will respond with SSH_FXP_STATUS. For normal disk - # files, it is guaranteed that this will read the specified number of + # "In response to this request, the server will read as many bytes as it + # can from the file (up to 'len'), and return them in a SSH_FXP_DATA + # message. If an error occurs or EOF is encountered before reading any + # data, the server will respond with SSH_FXP_STATUS. For normal disk + # files, it is guaranteed that this will read the specified number of # bytes, or up to end of file." # # i.e. we respond with an EOF error iff offset is already at EOF. @@ -684,8 +684,8 @@ class GeneralSFTPFile(PrefixingLogMixin): # This is ok because SFTP makes no guarantee that the request completes # before the write. In fact it explicitly allows write errors to be delayed # until close: - # "One should note that on some server platforms even a close can fail. - # This can happen e.g. if the server operating system caches writes, + # "One should note that on some server platforms even a close can fail. + # This can happen e.g. if the server operating system caches writes, # and an error occurs while flushing cached writes during the close." def _write(ign): @@ -1142,8 +1142,8 @@ class SFTPHandler(PrefixingLogMixin): path_utf8 = pathstring.split("/") # - # "Servers SHOULD interpret a path name component ".." as referring to - # the parent directory, and "." as referring to the current directory." + # "Servers SHOULD interpret a path name component ".." as referring to + # the parent directory, and "." as referring to the current directory." path = [] for p_utf8 in path_utf8: if p_utf8 == "..":