Skip to content

Drop cpython#104135 sitecustomize into onedir Python during CI Deps#69490

Merged
dwoz merged 2 commits into
saltstack:3006.xfrom
dwoz:dwoz/fix/onedir-sitecustomize-104135-3006.x
Jun 19, 2026
Merged

Drop cpython#104135 sitecustomize into onedir Python during CI Deps#69490
dwoz merged 2 commits into
saltstack:3006.xfrom
dwoz:dwoz/fix/onedir-sitecustomize-104135-3006.x

Conversation

@dwoz

@dwoz dwoz commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Summary

#69486's "3.14" → "3.14.6" pin did not fix the Windows nightlies (run 27799109831 still fails the same way) - the venv that pip is running in isn't created from the runner-host Python at all.

noxfile.py:1182 defines the ci-test-onedir session as python=str(ONEDIR_PYTHON_PATH), so the venv's interpreter is the salt onedir's relenv-bundled Python - 3.10.20 on 3006.x. Python 3.10's stdlib ssl._load_windows_store_certs concatenates every cert in the Windows root store and feeds them to load_verify_locations(cadata=...) as one blob, which OpenSSL 3.5.x (relenv ≥ 0.22.13) refuses to parse if any single cert is ASN.1-malformed - exactly cpython#104135. pip's first HTTPS GET to pypi.org dies with [ASN1: NOT_ENOUGH_DATA] and the dep install never starts.

dwoz's salt/__init__.py monkey-patch (`4d1e4db01a`, `e68db2220d`, `f222fe37e7`) fires correctly at salt-runtime but cannot help during build-deps-ci: salt is not yet installed when pip first runs in the new venv.

Fix

Ship the iter-and-skip patch as cicd/windows-ssl-104135-sitecustomize.py and add a workflow step in the Windows job of build-deps-ci-action.yml that copies it to artifacts/salt/Lib/site-packages/sitecustomize.py between Decompress Onedir Tarball and Install Nox. Because the ci-test-onedir nox session creates its venv with --system-site-packages (noxfile.py:1184), the venv inherits the onedir's site-packages directory, so Python loads the sitecustomize at every interpreter start - including the pip invocation that's been failing - before any TLS code runs.

The new file self-disables on Python 3.11+ (whose stdlib already has the upstream iter-and-skip fix), so it's safe to forward-merge as a no-op into branches whose onedir uses Python 3.14.

Also reverts the "3.14" → "3.14.6" pin from #69486 - that targeted the wrong Python and only adds churn.

Cleanup discipline

All three Python-3.10-only work-arounds now cross-reference each other in their comments:

  • salt/__init__.py (salt-runtime monkey-patch)
  • salt/ext/tornado/netutil.py (certifi pin on Windows)
  • cicd/windows-ssl-104135-sitecustomize.py + the Apply-sitecustomize step in build-deps-ci-action.yml

When 3006.x's onedir eventually moves off Python 3.10 (or these get forward-merged to a branch whose onedir Python is ≥ 3.11), drop them as a unit.

Test plan

  • CI Deps / Windows (amd64) and CI Deps / Windows (x86) go green on this branch's CI run.
  • 3006.x nightly recovers.
  • No regression on Linux/macOS CI Deps (the new workflow step is gated on the Windows job only).

3006.x's Windows CI Deps job has continued failing on 3.14.6 (saltstack#69486
didn't help): the venv that pip runs in isn't created from the runner-
host Python at all - noxfile.py's ci-test-onedir session uses the
onedir's relenv-bundled Python (3.10.20 on 3006.x). Python 3.10's
ssl._load_windows_store_certs concatenates every Windows-root-store
cert and hands them to load_verify_locations as one blob; OpenSSL 3.5.x
(relenv >= 0.22.13) rejects the whole blob on a single bad cert, so
pip's TLS to pypi.org dies with [ASN1: NOT_ENOUGH_DATA] before any
deps land. dwoz's salt/__init__.py monkey-patch (4d1e4db, e68db22,
f222fe3) cannot help here - salt is not yet importable when pip
first runs.

Fix: ship the same iter-and-skip patch as cicd/windows-ssl-104135-
sitecustomize.py and copy it into the onedir's Lib/site-packages
between Decompress-Onedir-Tarball and Install-Nox in the Windows
build-deps-ci job. With nox's --system-site-packages the venv
inherits it, so the patch fires at every Python start-up before pip
touches the network. Self-disables on Python 3.11+, which has the
upstream fix in stdlib.

Revert saltstack#69486's "3.14" -> "3.14.6" pin in layout.yml.jinja: that
chose the runner-host Python, which never participates in the failing
TLS - the pin was based on the wrong hypothesis and only added churn.

Cross-link the three Python-3.10-only work-arounds in their comments
so a future forward-merge drops them as a unit on any branch whose
onedir Python is >= 3.11.
@dwoz dwoz requested a review from a team as a code owner June 19, 2026 07:13
@dwoz dwoz added the test:full Run the full test suite label Jun 19, 2026
@dwoz dwoz added this to the Sulphur v3006.26 milestone Jun 19, 2026
@dwoz dwoz merged commit a4f5886 into saltstack:3006.x Jun 19, 2026
24 of 26 checks passed
dwoz added a commit that referenced this pull request Jun 19, 2026
…#104135

After #69490 landed, the `ci-test-onedir` job got past Install Deps, but the
next session - `pre-archive-cleanup` (noxfile.py:1397-1402) - failed at the
same step with the same `[ASN1: NOT_ENOUGH_DATA]`. That session also uses
the onedir Python but creates its virtualenv WITHOUT `--system-site-packages`,
so the `sitecustomize.py` we dropped in `artifacts/salt/Lib/site-packages/`
isn't loaded by it and the buggy `_load_windows_store_certs` is back.

Patch `Lib/ssl.py` in the onedir itself instead: virtualenv's venvs always
read stdlib from the base Python's `Lib/` (with or without
`--system-site-packages`), so a `Lib/ssl.py` append covers every venv launched
from the onedir, plus the onedir Python directly.

Verified on a local relenv 0.22.14 build (Python 3.10.20, OpenSSL 3.5.7):
both a `--system-site-packages` venv and an isolated venv now report
`_salt_safe_load_windows_store_certs` as the qualname for
`ssl.SSLContext._load_windows_store_certs`, and a synthetic truncated cert
injected via a monkey-patched `_ssl.enum_certificates` no longer aborts
`load_default_certs()`.

Drops `cicd/windows-ssl-104135-sitecustomize.py` (now redundant) and adds
`cicd/windows-ssl-104135-patch.py` (idempotent in-place patcher; takes the
ssl.py path as argv). The CI step swaps `cp ... -> sitecustomize.py` for
`python3 cicd/windows-ssl-104135-patch.py artifacts/salt/Lib/ssl.py`.

Cross-references in `salt/__init__.py` and `salt/ext/tornado/netutil.py`
updated to point at the new filename so the trio still drops together when
this branch's onedir Python moves off 3.10.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:full Run the full test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant