aws / aws/aws-lambda-base-images

In the amazon/aws-lambda-ruby:3.3 Docker image, a non-existent locale is set for LANG, causing the default encoding of Ruby strings to become US-ASCII

Ouverte
#167 0 commentaires 10 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Aucune donnée de langage
Étoiles
777
Forks
118
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

In the amazon/aws-lambda-ruby:3.3 Docker image, a non-existent locale is set for LANG, causing the default encoding of Ruby strings to become US-ASCII. Is this intentional?

### The behavior in the 2.7 image

```
% docker run --rm -it --entrypoint sh amazon/aws-lambda-ruby:2.7
sh-4.2# ruby -e 'p "string_value".encoding'
#
sh-4.2# locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
sh-4.2# ruby -e 'p "string_value".encoding'
#
```

### The behavior in the 3.3 image

```
% docker run --rm -it --entrypoint sh amazon/aws-lambda-ruby:3.3
sh-5.2# locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
sh-5.2# ruby -e 'p "string_value".encoding'
#
```

Due to this issue, when using Ruby 3.3, there were cases where an 'invalid byte sequence' error occurred when handling the contents of a file with UTF-8 strings from external sources. Therefore, I am addressing this by setting LANG to the existing UTF-8 encoding C.UTF-8 during the Docker build to ensure UTF-8 support.

```
% docker run --rm -it --entrypoint sh amazon/aws-lambda-ruby:3.3
sh-5.2# locale -a
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_COLLATE to default locale: No such file or directory
C
C.utf8
POSIX
```

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Trouvez la définition de build de l’image amazon/aws-lambda-ruby:3.3 et comparez sa configuration des locales avec celle de l’image 2.7. Reproduisez le problème avec les commandes Docker et Ruby indiquées, puis vérifiez que LANG désigne une locale UTF-8 disponible et que Ruby indique un encodage de chaîne UTF-8.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
aws, docker, ruby
Domaine
backend, infrastructure
Type d'issue
Bug
Difficulté
3/5
Temps estimé
1-2 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.