From: david-sarah Date: Wed, 2 Jun 2010 23:45:14 +0000 (-0700) Subject: SFTP: possible fix for metadata times being shown as the epoch. X-Git-Url: https://git.rkrishnan.org/components/com_hotproperty/reliability?a=commitdiff_plain;h=2dcb62de909342cef84e377fd686f3aecc22a286;p=tahoe-lafs%2Ftahoe-lafs.git SFTP: possible fix for metadata times being shown as the epoch. --- diff --git a/src/allmydata/frontends/sftpd.py b/src/allmydata/frontends/sftpd.py index 8c2a38ad..b10f9d14 100644 --- a/src/allmydata/frontends/sftpd.py +++ b/src/allmydata/frontends/sftpd.py @@ -236,14 +236,13 @@ def _populate_attrs(childnode, metadata, size=None): if metadata.get('no-write', False): perms &= S_IFDIR | S_IFREG | 0555 # clear 'w' bits - # see webapi.txt for what these times mean + # See webapi.txt for what these times mean. + # We would prefer to omit atime, but SFTP version 3 can only + # accept mtime if atime is also set. if 'linkmotime' in metadata.get('tahoe', {}): - attrs['mtime'] = _to_sftp_time(metadata['tahoe']['linkmotime']) + attrs['mtime'] = attrs['atime'] = _to_sftp_time(metadata['tahoe']['linkmotime']) elif 'mtime' in metadata: - # We would prefer to omit atime, but SFTP version 3 can only - # accept mtime if atime is also set. - attrs['mtime'] = _to_sftp_time(metadata['mtime']) - attrs['atime'] = attrs['mtime'] + attrs['mtime'] = attrs['atime'] = _to_sftp_time(metadata['mtime']) if 'linkcrtime' in metadata.get('tahoe', {}): attrs['createtime'] = _to_sftp_time(metadata['tahoe']['linkcrtime'])