Skip to content
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

bug: Unable to install awscli plugin with recent Swedish locale #1237

Closed
jmidgren opened this issue May 25, 2022 · 4 comments · Fixed by #1241
Closed

bug: Unable to install awscli plugin with recent Swedish locale #1237

jmidgren opened this issue May 25, 2022 · 4 comments · Fixed by #1241
Labels

Comments

@jmidgren
Copy link

Describe the Bug

I run Kubuntu 20.04 in Swedish and I'm unable to install the awscli plugin:

$ asdf plugin-add awscli
awscli is invalid. Name must match regex ^[a-zA-Z0-9_-]+$

After some digging I found that there may be a problem with the swedish locale not including the letter "w" properly. (We swedes have always had a complicated relationship with "w", e.g. in collation it should according to some be sorted under "v".) After reading more about it, it struck me that expressions like a-z very much depends on the language implied. If languages have additional characters within the a-z range or if alphabets are ordered differently, expressions like a-z do not make sense.

One way to solve this is to specify the language every time such expressions are used. E.g. in plugins.bash, grep could be preceded with LANG=C.

Relevant posts for more background:

Steps to Reproduce

LANG=sv_SE.UTF-8 asdf plugin-add awscli

Expected Behaviour

Plugin is being added or the message Plugin named awscli already added shows if it's already installed.

Actual Behaviour

asdf fails with return code 1 and the message

awscli is invalid. Name must match regex ^[a-zA-Z0-9_-]+$

Environment

OS:
Linux lap5cg1111r2p 5.13.0-44-generic #49~20.04.1-Ubuntu SMP Wed May 18 18:44:28 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

SHELL:
zsh 5.8 (x86_64-ubuntu-linux-gnu)

ASDF VERSION:
v0.10.1-f8109e0

ASDF ENVIRONMENT VARIABLES:
ASDF_DIRENV_BIN=/home/johannem/.asdf/installs/direnv/2.31.0/bin/direnv
ASDF_DIR=/home/johannem/.asdf

ASDF INSTALLED PLUGINS:
ansible-base                 https://github.com/amrox/asdf-pyapp.git master 45a4efd
awscli                       https://github.com/MetricMike/asdf-awscli.git main ec4ccdc
direnv                       https://github.com/asdf-community/asdf-direnv.git master 7dcd571
golang                       https://github.com/kennyp/asdf-golang.git master cc8bc47
golangci-lint                https://github.com/hypnoglow/asdf-golangci-lint.git master 5b537fa
nodejs                       https://github.com/asdf-vm/asdf-nodejs.git master f9957f3
yadm                         https://github.com/particledecay/asdf-yadm.git master 7504791
yq                           https://github.com/sudermanjr/asdf-yq.git master 772992f

Also:
glibc (libc-bin, locales etc): 2.31-0ubuntu9.9
grep: 3.4-1

asdf plugins affected (if relevant)

No response

@jmidgren jmidgren added the bug label May 25, 2022
@jmidgren
Copy link
Author

Another way to solve the problem would be to use regex character classes instead, e.g. [[:alpha:][:digit:]_-]. This is probably not what we want unless plugins with names in other alphabets should be considered. However, languages that don't include the letters a-z will then not work with existing plugin names...

@Stratus3D Stratus3D added this to the v0.10.0 milestone May 27, 2022
@Stratus3D
Copy link
Member

Thanks for the bug report @jmidgren ! This is new to me.

I need to check past issues before fixing this, but I think our reasoning for adding the ^[a-zA-Z0-9_-]+$ regex check for plugin names was to prevent whitespace from being used in a plugin name, as that caused issues in the .tool-versions files. If that is the only reason we added the regex check, expanding to something like ^[[:alpha:][:digit:]_-]$ should be fine.

@Stratus3D Stratus3D changed the title bug: Unalbe to install awscli plugin with recent Swedish locale bug: Unable to install awscli plugin with recent Swedish locale Jun 3, 2022
Stratus3D added a commit that referenced this issue Jun 6, 2022
[:alpha:] and [:digit:] character classes support characters from other
languages whereas ranges like a-z and 0-9 may not.

Fixes #1237
@Stratus3D
Copy link
Member

I've got a PR out to fix this issue. Feel free to give it a try to confirm it works @jmidgren

Stratus3D added a commit that referenced this issue Jun 6, 2022
[:alpha:] and [:digit:] character classes support characters from other
languages whereas ranges like a-z and 0-9 may not.

Fixes #1237
Stratus3D added a commit that referenced this issue Jun 7, 2022
[:alpha:] and [:digit:] character classes support characters from other
languages whereas ranges like a-z and 0-9 may not.

Fixes #1237
@Stratus3D
Copy link
Member

I marked this as fixed by my PR. Sometime this week I will release a new patch version of asdf.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants