Skip to content

[🐛 Bug]: ValueError: ZIP does not support timestamps before 1980 #14143

@milahu

Description

@milahu

What happened?

selenium firefox fails to start
if the firefox profile files have timestamp zero = 1970-01-01

with zipfile.ZipFile(fp, "w", zipfile.ZIP_DEFLATED) as zipped:

fix: add strict_timestamps=False (source)

with zipfile.ZipFile(fp, "w", zipfile.ZIP_DEFLATED, strict_timestamps=False) as zipped:

How can we reproduce the issue?

find firefox-profile -print0 |
xargs -0 touch -m --date=1970-01-01T00:00:00+0000

Relevant log output

File "/nix/store/wjlanzvm75kck4nxq0n2mij926ksp3vv-python3.11-selenium-4.17.0/lib/python3.11/site-packages/selenium/webdriver/firefox/webdriver.py", line 69, in __init__
    super().__init__(command_executor=executor, options=options)
  File "/nix/store/wjlanzvm75kck4nxq0n2mij926ksp3vv-python3.11-selenium-4.17.0/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 188, in __init__
    capabilities = options.to_capabilities()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/wjlanzvm75kck4nxq0n2mij926ksp3vv-python3.11-selenium-4.17.0/lib/python3.11/site-packages/selenium/webdriver/firefox/options.py", line 113, in to_capabilities
    opts["profile"] = self._profile.encoded
                      ^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/wjlanzvm75kck4nxq0n2mij926ksp3vv-python3.11-selenium-4.17.0/lib/python3.11/site-packages/selenium/webdriver/firefox/firefox_profile.py", line 160, in encoded
    zipped.write(filename, filename[path_root:])
  File "/nix/store/k3701zl6gmx3la7y4dnflcvf3xfy88kh-python3-3.11.9/lib/python3.11/zipfile.py", line 1795, in write
    zinfo = ZipInfo.from_file(filename, arcname,
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/k3701zl6gmx3la7y4dnflcvf3xfy88kh-python3-3.11.9/lib/python3.11/zipfile.py", line 550, in from_file
    zinfo = cls(arcname, date_time)
            ^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/k3701zl6gmx3la7y4dnflcvf3xfy88kh-python3-3.11.9/lib/python3.11/zipfile.py", line 391, in __init__
    raise ValueError('ZIP does not support timestamps before 1980')
ValueError: ZIP does not support timestamps before 1980

Operating System

nixos linux

Selenium version

4.17.0

What are the browser(s) and version(s) where you see this issue?

firefox

What are the browser driver(s) and version(s) where you see this issue?

firefox any

Are you using Selenium Grid?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-pyPython BindingsI-defectSomething is not working as intendedJ-staleApplied to issues that become stale, and eventually closed.R-help wantedIssues looking for contributions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions