Skip to content

PLAN aborts on a dist-info METADATA which is not UTF-8 #89

Open

Description

@morisil

Found in the final review of the fix for #79.

The PLAN script reads distribution.metadata["Name"] of every distribution in the dependency directory,
and a METADATA file which is not valid UTF-8 aborts the whole plan with a UnicodeDecodeError —
so one damaged dist-info makes every later install into that directory fail,
on the base of #79 as well as with it.

Expected: such a distribution is treated like one with unreadable metadata
(not satisfying any requirement, not constrained), and the plan goes on.

Activity

  1. morisil commented on Nov 13, 2026

    @morisil
    MemberAuthor

    Status of the automated fix run: blocked after 3 review rounds (the cap), on branch issue-89-metadata-not-utf8 (stacked on #92), no PR.

    The branch fixes the crash: a METADATA which is not UTF-8 (or missing, or a directory, or unreadable) no longer aborts the plan, in the dependency directory or the base environment, on Python 3.10, 3.12 and 3.14; with well-formed dist-infos the plan output equals the base for 19 real wheels and 12 scenarios; pip and uv converge after one install in all probed cases. Design (round 3): an unreadable distribution of the environment is skipped (as before); one of the dependency directory is identified by its dist-info directory name (validated as a PEP 508 name and PEP 440 version, highest wins); one shared, cached lookup_distribution serves the requirement checks and the constraints.

    The last review found one remaining regression:

    1. Without packaging (e.g. a uv venv without pip, uv as the installer), a dependency-directory dist-info without METADATA cannot be validated, so it counts as not installed: the plan says install six on every run, and uv fails each time with Failed to read metadata … METADATA: No such file or directory — the base treated it as installed.
      Direction: when Version is unavailable, keep the raw version from the directory name (as accepts_version already tolerates a non-PEP 440 version); the name regex needs no packaging.

    And a minor one:

    1. A distribution whose dist-info directory name does not normalize to its Name (a legacy dotted-name .egg, a renamed dist-info) loses its constraint, and such an egg is no longer found for a requirement (installed once into the dependency directory).
      Direction: fill the lookup in one pass over metadata.distributions() keyed by the normalized Name, instead of looking up by name.

    Polish: a non-UTF-8 METADATA could be decoded leniently to keep its (ASCII) Requires-Dist for the #81 check; a METADATA lacking only Version drops its Requires-Dist; the imported_version comment and one test name are out of date.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions