magic-wormhole icon indicating copy to clipboard operation
magic-wormhole copied to clipboard

ERROR: ZIP does not support timestamps before 1980

Open theronic opened this issue 5 years ago • 2 comments

I installed Magic Wormhole to send some files from my MBP15 by running brew install magic-wormhole. When I run wormhole send <folder> I get the following error:

wormhole send Code                          ✔  10028  11:25:08
Building zipfile..
Traceback (most recent call last):
  File "/usr/local/Cellar/magic-wormhole/0.12.0_1/libexec/lib/python3.9/site-packages/twisted/internet/defer.py", line 654, in _runCallbacks
    current.result = callback(current.result, *args, **kw)
  File "/usr/local/Cellar/magic-wormhole/0.12.0_1/libexec/lib/python3.9/site-packages/twisted/internet/defer.py", line 1475, in gotResult
    _inlineCallbacks(r, g, status)
  File "/usr/local/Cellar/magic-wormhole/0.12.0_1/libexec/lib/python3.9/site-packages/twisted/internet/defer.py", line 1416, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/usr/local/Cellar/magic-wormhole/0.12.0_1/libexec/lib/python3.9/site-packages/twisted/python/failure.py", line 512, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
--- <exception caught here> ---
  File "/usr/local/Cellar/magic-wormhole/0.12.0_1/libexec/lib/python3.9/site-packages/wormhole/cli/cli.py", line 122, in _dispatch_command
    yield maybeDeferred(command)
  File "/usr/local/Cellar/magic-wormhole/0.12.0_1/libexec/lib/python3.9/site-packages/twisted/internet/defer.py", line 1416, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/usr/local/Cellar/magic-wormhole/0.12.0_1/libexec/lib/python3.9/site-packages/twisted/python/failure.py", line 512, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
  File "/usr/local/Cellar/magic-wormhole/0.12.0_1/libexec/lib/python3.9/site-packages/wormhole/cli/cmd_send.py", line 93, in go
    yield d
  File "/usr/local/Cellar/magic-wormhole/0.12.0_1/libexec/lib/python3.9/site-packages/twisted/internet/defer.py", line 1418, in _inlineCallbacks
    result = g.send(result)
  File "/usr/local/Cellar/magic-wormhole/0.12.0_1/libexec/lib/python3.9/site-packages/wormhole/cli/cmd_send.py", line 107, in _go
    offer, self._fd_to_send = self._build_offer()
  File "/usr/local/Cellar/magic-wormhole/0.12.0_1/libexec/lib/python3.9/site-packages/wormhole/cli/cmd_send.py", line 365, in _build_offer
    zf.write(localfilename, archivename)
  File "/usr/local/Cellar/[email protected]/3.9.0/Frameworks/Python.framework/Versions/3.9/lib/python3.9/zipfile.py", line 1727, in write
    zinfo = ZipInfo.from_file(filename, arcname,
  File "/usr/local/Cellar/[email protected]/3.9.0/Frameworks/Python.framework/Versions/3.9/lib/python3.9/zipfile.py", line 517, in from_file
    zinfo = cls(arcname, date_time)
  File "/usr/local/Cellar/[email protected]/3.9.0/Frameworks/Python.framework/Versions/3.9/lib/python3.9/zipfile.py", line 361, in __init__
    raise ValueError('ZIP does not support timestamps before 1980')
builtins.ValueError: ZIP does not support timestamps before 1980
ERROR: ZIP does not support timestamps before 1980

theronic avatar Oct 18 '20 10:10 theronic

This has been fixed with https://github.com/python/cpython/pull/8270 in Python 3.8 and above by passing strict_timestamps=False

tirkarthi avatar Oct 19 '20 07:10 tirkarthi

Hm, according to https://docs.python.org/3/library/zipfile.html#zipfile-objects , that setting causes older timestamps to be truncated: any files older than 1980 will arrive on the new machine with a timestamp of january 1st 1980.

@theronic which would be better, having the transfer fail, or having the timestamps get silently changed?

I'm happy to take a patch that adds strict_timestamps=false to cmd_send.py (https://github.com/magic-wormhole/magic-wormhole/blob/d517a10282d5e56f300db462b1a6eec517202af7/src/wormhole/cli/cmd_send.py#L351), assuming of course that it doesn't break compatibility with any older versions of Python, if you think timestamp truncation is the best option.

warner avatar Jan 11 '21 00:01 warner