Skip to content

Adjust LANG note, drop LANG for 3.13+ #895

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 21, 2024

Conversation

yosifkit
Copy link
Member

@yosifkit yosifkit commented Dec 21, 2023

This is mostly to update the LANG note to clarify why it still cannot be removed. The also reattempts #570 but in a much more limited way (only 3.13+). 3.13 is still only an alpha so it should be safer to change there.

Happy to not remove LANG in 3.13+ if we only want to update the note. This can wait until the new year so that any users testing 3.13.0a2 don't break over the holidays.

 Fixes #887

@tianon tianon merged commit 1b7a110 into docker-library:master Mar 21, 2024
@tianon tianon deleted the utf-note branch March 21, 2024 23:32
docker-library-bot added a commit to docker-library-bot/official-images that referenced this pull request Mar 22, 2024
Changes:

- docker-library/python@1b7a110: Merge pull request docker-library/python#895 from infosiftr/utf-note
- docker-library/python@656d5af: Merge pull request docker-library/python#914 from infosiftr/3.10-key
- docker-library/python@44def75: Swap 3.10 release key back to Pablo
martin-g pushed a commit to martin-g/docker-official-images that referenced this pull request Apr 3, 2024
Changes:

- docker-library/python@1b7a110: Merge pull request docker-library/python#895 from infosiftr/utf-note
- docker-library/python@656d5af: Merge pull request docker-library/python#914 from infosiftr/3.10-key
- docker-library/python@44def75: Swap 3.10 release key back to Pablo
edmorley added a commit to heroku/buildpacks-python that referenced this pull request Dec 16, 2024
Previously the buildpack would set the `LANG` env var at build
and run time to the value `C.UTF-8`, to match the official Docker
Python images.

However, the env var should not be needed for modern Python,
and so the official Docker Python images no longer set it:
docker-library/python#887
docker-library/python#895

In addition, the older issues typically only affected other distros
such as alpine, or environments where someone had overridden
the system locale, which doesn't apply to the Heroku base images.
edmorley added a commit to heroku/buildpacks-python that referenced this pull request Dec 16, 2024
Previously the buildpack would set the `LANG` env var at build
and run time to the value `C.UTF-8`, to match the official Docker
Python images.

However, the env var should not be needed for modern Python,
and so the official Docker Python images no longer set it:
docker-library/python#887
docker-library/python#895

In addition, the older issues typically only affected other distros
such as alpine, or environments where someone had overridden
the system locale, which doesn't apply to the Heroku base images.

GUS-W-17443565.
Eijebong added a commit to Eijebong/balrog that referenced this pull request Jun 23, 2025
Python 3.13 dropped that in docker-library/python#895
Without this, running balrog locally results in

```
balrogadmin-1  |   File "/app/uwsgi/admin.wsgi", line 74, in <module>
balrogadmin-1  |     from auslib.web.admin.base import app as application  # noqa
balrogadmin-1  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
balrogadmin-1  |   File "/app/src/auslib/web/admin/base.py", line 29, in <module>
balrogadmin-1  |     .add_spec(path.join(current_dir, "swagger/api.yml"))
balrogadmin-1  |      ~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
balrogadmin-1  |   File "/usr/local/lib/python3.13/site-packages/specsynthase/specbuilder.py", line 44, in add_spec
balrogadmin-1  |     spec = self._load_spec(file_name)
balrogadmin-1  |   File "/usr/local/lib/python3.13/site-packages/specsynthase/specbuilder.py", line 13, in _load_spec
balrogadmin-1  |     return yaml.load(spec_file, Loader=yaml.FullLoader)
balrogadmin-1  |            ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
balrogadmin-1  |   File "/usr/local/lib/python3.13/site-packages/yaml/__init__.py", line 79, in load
balrogadmin-1  |     loader = Loader(stream)
balrogadmin-1  |   File "/usr/local/lib/python3.13/site-packages/yaml/loader.py", line 24, in __init__
balrogadmin-1  |     Reader.__init__(self, stream)
balrogadmin-1  |     ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
balrogadmin-1  |   File "/usr/local/lib/python3.13/site-packages/yaml/reader.py", line 85, in __init__
balrogadmin-1  |     self.determine_encoding()
balrogadmin-1  |     ~~~~~~~~~~~~~~~~~~~~~~~^^
balrogadmin-1  |   File "/usr/local/lib/python3.13/site-packages/yaml/reader.py", line 124, in determine_encoding
balrogadmin-1  |     self.update_raw()
balrogadmin-1  |     ~~~~~~~~~~~~~~~^^
balrogadmin-1  |   File "/usr/local/lib/python3.13/site-packages/yaml/reader.py", line 178, in update_raw
balrogadmin-1  |     data = self.stream.read(size)
balrogadmin-1  |   File "/usr/local/lib/python3.13/encodings/ascii.py", line 26, in decode
balrogadmin-1  |     return codecs.ascii_decode(input, self.errors)[0]
balrogadmin-1  |            ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
balrogadmin-1  | UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 773: ordinal not in range(128)
balrogadmin-1 exited with code 22
```

Because our swagger config contains some non ASCII characters so it
cannot be read to a string if `LANG` is unset which defaults to `POSIX`
(at least on my system).

I probably went overboard by setting it into every python container as
some might not actually require it, but I feel like everyone would
expect a UTF-8 locale to be set.
Eijebong added a commit to Eijebong/balrog that referenced this pull request Jun 24, 2025
Python 3.13 dropped that in docker-library/python#895
Without this, running balrog locally results in

```
balrogadmin-1  |   File "/app/uwsgi/admin.wsgi", line 74, in <module>
balrogadmin-1  |     from auslib.web.admin.base import app as application  # noqa
balrogadmin-1  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
balrogadmin-1  |   File "/app/src/auslib/web/admin/base.py", line 29, in <module>
balrogadmin-1  |     .add_spec(path.join(current_dir, "swagger/api.yml"))
balrogadmin-1  |      ~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
balrogadmin-1  |   File "/usr/local/lib/python3.13/site-packages/specsynthase/specbuilder.py", line 44, in add_spec
balrogadmin-1  |     spec = self._load_spec(file_name)
balrogadmin-1  |   File "/usr/local/lib/python3.13/site-packages/specsynthase/specbuilder.py", line 13, in _load_spec
balrogadmin-1  |     return yaml.load(spec_file, Loader=yaml.FullLoader)
balrogadmin-1  |            ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
balrogadmin-1  |   File "/usr/local/lib/python3.13/site-packages/yaml/__init__.py", line 79, in load
balrogadmin-1  |     loader = Loader(stream)
balrogadmin-1  |   File "/usr/local/lib/python3.13/site-packages/yaml/loader.py", line 24, in __init__
balrogadmin-1  |     Reader.__init__(self, stream)
balrogadmin-1  |     ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
balrogadmin-1  |   File "/usr/local/lib/python3.13/site-packages/yaml/reader.py", line 85, in __init__
balrogadmin-1  |     self.determine_encoding()
balrogadmin-1  |     ~~~~~~~~~~~~~~~~~~~~~~~^^
balrogadmin-1  |   File "/usr/local/lib/python3.13/site-packages/yaml/reader.py", line 124, in determine_encoding
balrogadmin-1  |     self.update_raw()
balrogadmin-1  |     ~~~~~~~~~~~~~~~^^
balrogadmin-1  |   File "/usr/local/lib/python3.13/site-packages/yaml/reader.py", line 178, in update_raw
balrogadmin-1  |     data = self.stream.read(size)
balrogadmin-1  |   File "/usr/local/lib/python3.13/encodings/ascii.py", line 26, in decode
balrogadmin-1  |     return codecs.ascii_decode(input, self.errors)[0]
balrogadmin-1  |            ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
balrogadmin-1  | UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 773: ordinal not in range(128)
balrogadmin-1 exited with code 22
```

Because our swagger config contains some non ASCII characters so it
cannot be read to a string if `LANG` is unset which defaults to `POSIX`
(at least on my system).

I probably went overboard by setting it into every python container as
some might not actually require it, but I feel like everyone would
expect a UTF-8 locale to be set.
Eijebong added a commit to mozilla-releng/balrog that referenced this pull request Jun 24, 2025
Python 3.13 dropped that in docker-library/python#895
Without this, running balrog locally results in

```
balrogadmin-1  |   File "/app/uwsgi/admin.wsgi", line 74, in <module>
balrogadmin-1  |     from auslib.web.admin.base import app as application  # noqa
balrogadmin-1  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
balrogadmin-1  |   File "/app/src/auslib/web/admin/base.py", line 29, in <module>
balrogadmin-1  |     .add_spec(path.join(current_dir, "swagger/api.yml"))
balrogadmin-1  |      ~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
balrogadmin-1  |   File "/usr/local/lib/python3.13/site-packages/specsynthase/specbuilder.py", line 44, in add_spec
balrogadmin-1  |     spec = self._load_spec(file_name)
balrogadmin-1  |   File "/usr/local/lib/python3.13/site-packages/specsynthase/specbuilder.py", line 13, in _load_spec
balrogadmin-1  |     return yaml.load(spec_file, Loader=yaml.FullLoader)
balrogadmin-1  |            ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
balrogadmin-1  |   File "/usr/local/lib/python3.13/site-packages/yaml/__init__.py", line 79, in load
balrogadmin-1  |     loader = Loader(stream)
balrogadmin-1  |   File "/usr/local/lib/python3.13/site-packages/yaml/loader.py", line 24, in __init__
balrogadmin-1  |     Reader.__init__(self, stream)
balrogadmin-1  |     ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
balrogadmin-1  |   File "/usr/local/lib/python3.13/site-packages/yaml/reader.py", line 85, in __init__
balrogadmin-1  |     self.determine_encoding()
balrogadmin-1  |     ~~~~~~~~~~~~~~~~~~~~~~~^^
balrogadmin-1  |   File "/usr/local/lib/python3.13/site-packages/yaml/reader.py", line 124, in determine_encoding
balrogadmin-1  |     self.update_raw()
balrogadmin-1  |     ~~~~~~~~~~~~~~~^^
balrogadmin-1  |   File "/usr/local/lib/python3.13/site-packages/yaml/reader.py", line 178, in update_raw
balrogadmin-1  |     data = self.stream.read(size)
balrogadmin-1  |   File "/usr/local/lib/python3.13/encodings/ascii.py", line 26, in decode
balrogadmin-1  |     return codecs.ascii_decode(input, self.errors)[0]
balrogadmin-1  |            ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
balrogadmin-1  | UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 773: ordinal not in range(128)
balrogadmin-1 exited with code 22
```

Because our swagger config contains some non ASCII characters so it
cannot be read to a string if `LANG` is unset which defaults to `POSIX`
(at least on my system).

I probably went overboard by setting it into every python container as
some might not actually require it, but I feel like everyone would
expect a UTF-8 locale to be set.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LANG C.UTF-8 issue status?
2 participants