Skip to content

repo_gate.py Decodes ls-files stderr Strictly, So a Non-UTF-8 Root Path Crashes It #1872

Description

@ptr727

Problem

tracked() in .github/actions/repo-gate/repo_gate.py decodes the git ls-files call's stderr strictly as UTF-8. When git's error message echoes a path that is not valid UTF-8, the decode raises UnicodeDecodeError. That is a ValueError, so nothing catches it, and the gate ends in a traceback instead of main returning 2.

Evidence

Constructed case: pass --root a directory that does not exist and whose name contains the byte 0xff. Git's "cannot change to" message quotes the name raw on stderr, and the strict decode of that stderr raises.

The same line is on develop, so this change did not introduce it. A local review pass found it on the branch that pins and decodes the stdout side for #1580.

Suggested fix

Decode that call's output with errors="surrogateescape", matching sh() and resolved_eol.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions