瀏覽代碼

PR #221 - Merge branch 'issue_139' of https://github.com/ThomasWaldmann/attic into merge

Thomas Waldmann 10 年之前
父節點
當前提交
c8b23b507d
共有 1 個文件被更改,包括 6 次插入2 次删除
  1. 6 2
      attic/archiver.py

+ 6 - 2
attic/archiver.py

@@ -291,7 +291,11 @@ Type "Yes I am sure" if you understand this and want to continue.\n""")
                         size = sum(size for _, size, _ in item[b'chunks'])
                         size = sum(size for _, size, _ in item[b'chunks'])
                     except KeyError:
                     except KeyError:
                         pass
                         pass
-                mtime = format_time(datetime.fromtimestamp(bigint_to_int(item[b'mtime']) / 1e9))
+                try:
+                    mtime = datetime.fromtimestamp(bigint_to_int(item[b'mtime']) / 1e9)
+                except ValueError:
+                    # likely a broken mtime and datetime did not want to go beyond year 9999
+                    mtime = datetime(9999, 12, 31, 23, 59, 59)
                 if b'source' in item:
                 if b'source' in item:
                     if type == 'l':
                     if type == 'l':
                         extra = ' -> %s' % item[b'source']
                         extra = ' -> %s' % item[b'source']
@@ -301,7 +305,7 @@ Type "Yes I am sure" if you understand this and want to continue.\n""")
                 else:
                 else:
                     extra = ''
                     extra = ''
                 print('%s%s %-6s %-6s %8d %s %s%s' % (type, mode, item[b'user'] or item[b'uid'],
                 print('%s%s %-6s %-6s %8d %s %s%s' % (type, mode, item[b'user'] or item[b'uid'],
-                                                  item[b'group'] or item[b'gid'], size, mtime,
+                                                  item[b'group'] or item[b'gid'], size, format_time(mtime),
                                                   remove_surrogates(item[b'path']), extra))
                                                   remove_surrogates(item[b'path']), extra))
         else:
         else:
             for archive in sorted(Archive.list_archives(repository, key, manifest), key=attrgetter('ts')):
             for archive in sorted(Archive.list_archives(repository, key, manifest), key=attrgetter('ts')):