Repository navigation
Add static version to setup.cfg (unblock Windows build of 3.1.0+security.1) - #2
Merged
Merged
Conversation
The AS Windows builder (windows-2025-msvc-builder) does not run setuptools_scm's finalize_distribution_options hook, so filelock's version -- which had no static declaration anywhere -- silently fell back to distutils' 0.0.0 and the wheel was rejected with "Distribution name and/or version could not be determined". setuptools_scm's PKG-INFO fallback and SETUPTOOLS_SCM_PRETEND_VERSION both live behind that hook, so neither an sdist nor an env var can recover the version there. A static version in setup.cfg is read by plain setuptools with no scm involvement at all; where the hook does run it resolves to the same string, so both paths agree.
icanhasmath
added a commit
that referenced
this pull request
Nov 5, 2026
โฆr hard-linked onto the lock path) (#3) * CVE-2026-112909 Don't truncate a file renamed or hard-linked onto the lock path GHSA-69hj-f68j-2879: UnixFileLock opened the lock file with O_RDWR | O_CREAT | O_TRUNC. O_NOFOLLOW (the CVE-2025-68146 fix) refuses a symlink, but not a regular file that another local user renames or hard-links onto the lock path while the lock file does not exist. The lock user's next acquire then emptied that file -- under every name it has -- with the lock user's privileges. Because O_TRUNC is applied by open(), even an attempt that went on to lose the flock truncated the file. Backport the upstream 4.2.1 fix (tox-dev#835, e1e825b), adapted to this 3.1.0 single-module layout: open without O_TRUNC, so an existing file is locked as found. The lock never stores data in the file, so nothing depended on the truncation. The advisory's second half -- fchmod of the found file to an explicit `mode` -- does not apply: 3.1.0 has no `mode` parameter (added in 3.10.0) and never chmods the lock file. WindowsFileLock opened with O_TRUNC too in 3.1.0, so drop it there as well (same reasoning; Windows lets a user rename or hard-link a file into a shared directory). SoftFileLock opens with O_EXCL, which refuses an existing path, so it never truncated a found file; left unchanged. Regression tests (both lock types): a file renamed onto the lock path, a file hard-linked onto it, and a holder's lock file seen by a losing contender all keep their content. Py2.7-safe: no new syntax or imports. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Ship src/filelock/version.py as a tracked static file Since the static setup.cfg version (#2), setuptools_scm sees the version already set ("version of filelock already set"), skips version inference, and so never runs its write_to step. The generated, gitignored src/filelock/version.py is then missing from a clean checkout's sdist and wheel, while filelock/__init__.py does `from .version import version`: a wheel built from the 3.1.0+security.1 tag in a fresh clone fails with "ModuleNotFoundError: No module named 'filelock.version'". Track version.py with the static version (kept in step with setup.cfg), un-ignore it, and drop write_to so setuptools_scm never overwrites it. No setuptools_scm hook is needed for either value, which keeps the Windows builder (which does not run that hook) working. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Release 3.1.0.post2: fix CVE-2026-112909 Set the static version in setup.cfg and src/filelock/version.py to 3.1.0.post2 (PEP 440 post-release; the line moves from the +security.N scheme to .postN) and add CHANGELOG.md recording every advisory's status on the 3.1.0 line. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The AS Windows build of ingredient
filelock 3.1.0.1fails onwindows-2025-msvc-builder:0.0.0is distutils'get_version()fallback forversion is None. filelock 3.1.0 declares its version nowhere statically โ it comes solely from setuptools_scm'sfinalize_distribution_optionshook (infer_version), driven by[tool.setuptools_scm]. That hook does not run on this builder, andinfer_versionswallows every failure (except Exception: return trace_exception()), so the version silently staysNoneandActiveStateWheel/steps.pyrejects the resulting wheel.Two things that do not fix it, both ruled out empirically:
filelock-3.1.0+security.1.tar.gz(sha256a582574โฆ, byte-identical to the release asset) with a correct rootPKG-INFO. Plain setuptools never reads an sdist's PKG-INFO for the version; only setuptools_scm's PKG-INFO fallback parser does, and that lives behind the dead hook.SETUPTOOLS_SCM_PRETEND_VERSIONโ tried on build 2 (4ef58fcc,--env-var=SETUPTOOLS_SCM_PRETEND_VERSION=3.1.0). Stillfilelock-0.0.0. The env var is read inside_do_parse, which is also behind the hook.Not filelock-specific: the pristine PyPI sdist of
backports.functools_lru_cache 1.6.6fails identically on the same builder image (8d62bf93), while an otherwise-identical Windows build of it succeeds (f11ceddc). Worth a platform ticket of its own โ this breaks any setuptools_scm +pyproject-only package there.Fix
One line: a static
versioninsetup.cfg [metadata], which plain setuptools reads with no scm, no toml, and no cooperation from the builder.setuptools_scm is deliberately kept in
pyproject.tomlโ removing it also removes its git file-finder, which shrinks the sdist from 586KB to 8KB (droppingtests/,docs/,example/).Verification
Rebuilt sdist, extracted with no
.git, on 2.7.18:setup.py --version3.1.0+security.13.1.0+security.1tomlunimportable3.1.0+security.1Both paths converge because scm's PKG-INFO fallback reads back the same string it wrote.
filelock-3.1.0+security.1-py2.py3-none-any.whlโ clears the builder'sparts[1] == "0.0.0"gate.filelock.__version__ == '3.1.0+security.1';_is_reparse_point(CVE-2025-68146 fix) present.25/25tests pass on 2.7.18 โ matches the release baseline.No version change, no behaviour change:
3.1.0+security.1is unaffected, as are the virtualenv pin, Jira DE-8131, and the CVE override rows.๐ค Generated with Claude Code