Bug 1695562 - [rfe] Failed to set locale, defaulting to C -> should be C.utf-8
Summary: [rfe] Failed to set locale, defaulting to C -> should be C.utf-8
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf
Version: 30
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Marek Blaha
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 1670376
TreeView+ depends on / blocked
 
Reported: 2019-04-03 11:14 UTC by Miro Hrončok
Modified: 2019-05-10 00:47 UTC (History)
10 users (show)

Fixed In Version: dnf-4.2.5-1.fc29 dnf-4.2.5-1.fc30
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-05-10 00:47:31 UTC


Attachments (Terms of Use)

Description Miro Hrončok 2019-04-03 11:14:43 UTC
See https://github.com/rpm-software-management/dnf/blob/70118b5500a3f3ab01c681fb76162bd3478978f5/dnf/i18n.py#L85

def setup_locale():
    try:
        dnf.pycomp.setlocale(locale.LC_ALL, '')
    except locale.Error as e:
        # default to C locale if we get a failure.
        print('Failed to set locale, defaulting to C', file=sys.stderr)
        os.environ['LC_ALL'] = 'C'
        dnf.pycomp.setlocale(locale.LC_ALL, 'C')


Can we please try to defaulting to C.utf-8 instead? That would be more in line with https://fedoraproject.org/wiki/Changes/Reset-locale-if-not-available

Thanks.

Comment 1 Marek Blaha 2019-04-03 13:27:45 UTC
This needs to be done carefully, there is no C.UTF-8 locale on RHEL 7.

Comment 2 Miro Hrončok 2019-04-03 13:41:30 UTC
Sure. I was thinking something like:

try:
    dnf.pycomp.setlocale(locale.LC_ALL, '')
except locale.Error:
    try:
        dnf.pycomp.setlocale(locale.LC_ALL, 'C.utf-8')
    except locale.Error:
        dnf.pycomp.setlocale(locale.LC_ALL, 'C')

Comment 4 Fedora Update System 2019-04-25 16:43:25 UTC
dnf-4.2.5-1.fc29 libdnf-0.31.0-2.fc29 has been submitted as an update to Fedora 29. https://bodhi.fedoraproject.org/updates/FEDORA-2019-2612a121ba

Comment 5 Fedora Update System 2019-04-26 22:10:00 UTC
dnf-4.2.5-1.fc29, libdnf-0.31.0-2.fc29 has been pushed to the Fedora 29 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-2612a121ba

Comment 6 Miro Hrončok 2019-04-26 22:52:03 UTC
No F30 update, just F29?

Comment 7 Fedora Update System 2019-04-29 02:15:03 UTC
dnf-4.2.5-1.fc29, libdnf-0.31.0-2.fc29 has been pushed to the Fedora 29 stable repository. If problems still persist, please make note of it in this bug report.

Comment 8 Miro Hrončok 2019-04-29 05:23:36 UTC
I see F31 and F29 build (and update), but no F30.

Comment 9 Fedora Update System 2019-05-07 16:11:29 UTC
dnf-4.2.5-1.fc30 libdnf-0.31.0-3.fc30 has been submitted as an update to Fedora 30. https://bodhi.fedoraproject.org/updates/FEDORA-2019-324f611364

Comment 10 Pavla Kratochvilova 2019-05-07 16:13:09 UTC
I added this bug to Fedora 30 update now, sorry about the confusion.

Comment 11 Fedora Update System 2019-05-08 04:10:53 UTC
dnf-4.2.5-1.fc30, libdnf-0.31.0-3.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-324f611364

Comment 12 Fedora Update System 2019-05-10 00:47:31 UTC
dnf-4.2.5-1.fc30, libdnf-0.31.0-3.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.