Skip to content

Conversation

@edmorley
Copy link
Member

Some further improvements on-top of those made in #1958, based on build error message scenarios seen in Honeycomb.

Now, if .python-version contains a single ESC control code (which gets categorised as "very short file"), or contains any of the ASCI control codes that result in the file being categorised as "data" (such as NUL), then the "invalid python version" error message variant is shown instead of the "invalid text encoding" variant.

In addition, any NULs in the file are substituted with a placeholder to avoid this Bash warning:

/tmp/buildpack/lib/python_version.sh: line 104: warning: command substitution: ignored null byte in input

See:
https://manpages.ubuntu.com/manpages/noble/en/man1/file.1.html

GUS-W-20220514.

@edmorley edmorley self-assigned this Nov 14, 2025
@edmorley edmorley marked this pull request as ready for review November 14, 2025 12:53
@edmorley edmorley requested a review from a team as a code owner November 14, 2025 12:53
@edmorley edmorley enabled auto-merge (squash) November 14, 2025 12:53
@edmorley edmorley disabled auto-merge November 14, 2025 12:54
Some further improvements on-top of those made in #1958, based on build
error message scenarios seen in Honeycomb.

Now, if `.python-version` contains a single ESC control code (which gets
categorised as "very short file"), or contains any of the ASCI control
codes that result in the file being categorised as "data" (such as NUL),
then the "invalid python version" error message variant is shown instead
of the "invalid text encoding" variant.

In addition, any NULs in the file are substituted with a placeholder to
avoid this Bash warning:

```
/tmp/buildpack/lib/python_version.sh: line 104: warning: command substitution: ignored null byte in input
```

See:
https://manpages.ubuntu.com/manpages/noble/en/man1/file.1.html

GUS-W-20220514.
@edmorley edmorley force-pushed the file-encoding-improvements branch from 404c324 to 1f52702 Compare November 14, 2025 12:56
@edmorley edmorley merged commit 94209ab into main Nov 14, 2025
6 checks passed
@edmorley edmorley deleted the file-encoding-improvements branch November 14, 2025 13:25
@heroku-linguist heroku-linguist bot mentioned this pull request Nov 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants