Skip to content

Docker generator reports false drift on non-UTF-8 Windows locales #1116

Description

@dajiaohuang

System Info

  • VeOmni commit: aa0fd736958a34fb40880a0b701407192fbcc67e
  • OS: Windows
  • Python: 3.13.13
  • Locale preferred encoding: cp1252

Information

The repository's documented Dockerfile drift check reports changes on Windows even when all generated Dockerfiles are up to date.

Reproduction

git checkout aa0fd736958a34fb40880a0b701407192fbcc67e
python docker/generate.py --check
python -X utf8 docker/generate.py --check

The first command reports drift in two Ascend Dockerfiles and exits 1. The second reports all three Dockerfiles as up to date and exits 0.

Expected behavior

Both invocations should decode the repository's UTF-8 YAML and generated Dockerfiles consistently and report no drift.

Actual behavior

docker/generate.py uses Path.read_text() / Path.write_text() without an explicit encoding. On a Windows process whose default text encoding is cp1252, UTF-8 non-ASCII text is decoded differently, producing a false diff. Jinja's loader already treats templates as UTF-8.

Suggested fix

Pass encoding="utf-8" when reading docker/matrix.yaml, reading existing Dockerfiles, and writing generated Dockerfiles.

I searched open and closed issues and pull requests for docker/generate.py, cp1252, Windows drift, and UTF-8 generator reports. PR #825 touches the generator for a separate NPU template change but does not address encoding. Merged PR #807 fixed the same Windows default-encoding class in patchgen, but not in the Docker generator.

Activity

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