containers / common

Location for shared common files in github.com/containers repos.
Apache License 2.0
174 stars 181 forks source link

Set neutral locale (C) when running package manager or version commands #1933

Open afbjorklund opened 3 months ago

afbjorklund commented 3 months ago

Some of the output is locale-specific, which might affect the parsing (or scraping)

en_US

Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version      Architecture Description
+++-==============-============-============-=============================================

sv_SE

Önskat=Okänd(U)/Installera(I)/Radera(R)/Rensa(P)/Håll(H)
| Status.=Ej inst.(N)/(I)nst./Konffil.(C)/(U)ppack./Halvkonf.(F)/(H)alvinst.
| /       Vänt.utl(W)/Föresl.utl(T)
|/ Fel?Inget(=)/Ominstallera(R)/Båda(X) (Status,Fel: versaler=illa)
||/ Namn           Version      Arkitektur   Beskrivning
+++-==============-============-============-=============================================

So it should probably run the commands with LC_ALL=C in the environment


Noticed by user with Arch Linux with a german locale, in https://github.com/containers/podman/discussions/22148.

    package: /usr/bin/pasta ist in passt 2024_03_20.71dd405-1 enthalten
Foxboron commented 3 months ago

Better to use LC_ALL=C.UTF-8 which is something that most Linux distributions should be shipping with these days.

afbjorklund commented 3 months ago

The package names and versions are ASCII anyway, so the encoding doesn't really matter (only the language used)