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

Remove hardcoded locale environment variables #79

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

11xx
Copy link

@11xx 11xx commented Sep 28, 2023

Line 109 hardcodes the environment variable locales to C:

def_lang = ['env', 'LC_ALL=C', 'LANGUAGE=C']

but this conflicts with certain PKGBUILDs.

For example when extracting source files of the sabnzbd package bsdtar would complain:

bsdtar: Pathname can't be converted from UTF-8 to current locale.

and fail the playbook.

The host machine locales were right, with UTF-8.

So removing the locale variables: def_lang = ['env'] and using either:

environment:
  LC_ALL: en_US.UTF-8
  LANGUAGE: en_US.UTF-8

or nothing made it work.

Just as a note, setting:

environment:
  LC_ALL: C
  LANGUAGE: C

makes it fail again.

This can be tested with bsdtar directly:
Download the tar.gz source file from https://aur.archlinux.org/packages/sabnzbd

LC_ALL=C LANGUAGE=C bsdtar xf file.tar.gz

and it should error out.

Any special reason for keeping it? If anyone needs to specify them,
like any other env. var, the environment key works fine, given the use
of env. And the good thing is that it can be used at the play, block, or task level.

@kftsehk
Copy link

kftsehk commented Nov 7, 2023

+1 for breaking sha512 of these package, some files will fail hash with LC_ALL=C

aur/cuda-11.7
aur/cuda-11.1

cannot be overridden by

      environment:
        LC_ALL: ""
        LANGUAGE: ""

or any other way that successfully hash these packages

@kftsehk
Copy link

kftsehk commented Nov 7, 2023

@kewlfft How about add a variable to explicitly disable setting

command = def_lang + ...

this way will not break old behavior.

But for some package that cannot install with either LC_ALL=C or LANGUAGE=C for unknown reason, we can explicitly set disable_default_local: true and env LC_ALL=C LANGUAGE=C will not be added.

The only workaround now is to use

shell: |
  yay ......

I suppose it is not what should happen in ansible.

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.

None yet

2 participants