Bug 1668400 - rpmlint needs locale data
Summary: rpmlint needs locale data
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: rpmlint
Version: rawhide
Hardware: All
OS: Linux
unspecified
low
Target Milestone: ---
Assignee: Tom "spot" Callaway
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-01-22 16:19 UTC by Jerry James
Modified: 2019-03-29 19:11 UTC (History)
5 users (show)

Fixed In Version: rpmlint-1.10-22.fc30
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-03-29 19:11:34 UTC
Type: Bug


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Github rpm-software-management rpmlint issues 198 None closed locale.Error: unsupported locale setting 2020-03-03 21:45:49 UTC

Description Jerry James 2019-01-22 16:19:30 UTC
Description of problem:
I installed some newly built packages into a mock root, along with rpmlint, then ran mock --shell so I could check the packages.  In the mock shell:

# rpmlint <list of packages> 
Traceback (most recent call last):
  File "/usr/bin/rpmlint", line 378, in <module>
    main()
  File "/usr/bin/rpmlint", line 92, in main
    locale.setlocale(locale.LC_COLLATE, '')
  File "/usr/lib64/python3.7/locale.py", line 604, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting

I exited out of the mock shell, installed glibc-langpack-en, and restarted the shell.  Then rpmlint worked.  Either rpmlint should be made to work with the C locale, or it should Requires something to satisfy its need for a locale.

Version-Release number of selected component (if applicable):
rpmlint-1.10-20.fc30.noarch

How reproducible:
Always

Steps to Reproduce:
1. Start with an empty mock chroot
2. Install rpmlint
3. Install any package that does not require a langpack
4. Start a mock shell
5. Run rpmlint on the package installed in step 3

Actual results:
The traceback shown above.

Expected results:
Valid rpmlint output.

Additional info:

Comment 1 Miro Hrončok 2019-03-10 10:44:49 UTC
rpmlint uses the following:

>>> import locale
>>> locale.setlocale(locale.LC_COLLATE, '')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python3.7/locale.py", line 604, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting

The git blame for the call is rather big commit: https://github.com/rpm-software-management/rpmlint/commit/115d640c8d0b13b70d464a25a3401a7011cd369c

LC_COLLATE is for sorting things. Yet the empty call makes it sort based on env variables, e.g. on my machine, this is what I get:

>>> locale.setlocale(locale.LC_COLLATE, '')
'cs_CZ.utf8'

So if I run mock this is what rpmlint is trying to set, installing English locales won't help me:

$ locale
LANG=cs_CZ.utf8
...
LC_COLLATE="cs_CZ.utf8"
...
LC_ALL=
[FedoraReview (python3)]$ mock -r fedora-rawhide-x86_64 shell
<mock-chroot> sh-5.0# 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=cs_CZ.utf8
...
LC_COLLATE="cs_CZ.utf8"
...
LC_ALL=


So I guess we need to figure out what is this line actually trying to achieve.

Comment 2 Miro Hrončok 2019-03-10 10:47:44 UTC
So the git blame is actually https://github.com/rpm-software-management/rpmlint/commit/6f4af3cd65b0ccdab7455e3fbe8ff9947b979d39

Process installed packages matched by a wildcard in locale's alphabetic order.


I'll open an issue upstream.

Comment 3 Miro Hrončok 2019-03-10 10:56:38 UTC
A fix: https://github.com/rpm-software-management/rpmlint/pull/199

Comment 4 Miro Hrončok 2019-03-10 11:22:08 UTC
Fedora PR: https://src.fedoraproject.org/rpms/rpmlint/pull-request/7

Comment 5 Fedora Update System 2019-03-10 19:17:28 UTC
rpmlint-1.10-22.fc30 has been submitted as an update to Fedora 30. https://bodhi.fedoraproject.org/updates/FEDORA-2019-5758e738d2

Comment 6 Fedora Update System 2019-03-11 14:41:44 UTC
rpmlint-1.10-22.fc30 has been pushed to the Fedora 30 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-5758e738d2

Comment 7 Fedora Update System 2019-03-29 19:11:34 UTC
rpmlint-1.10-22.fc30 has been pushed to the Fedora 30 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.