From 2dcb62de909342cef84e377fd686f3aecc22a286 Mon Sep 17 00:00:00 2001 From: david-sarah Date: Wed, 2 Jun 2010 16:45:14 -0700 Subject: [PATCH] SFTP: possible fix for metadata times being shown as the epoch. --- src/allmydata/frontends/sftpd.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) 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']) -- 2.45.2