Bug 1695562

Summary: [rfe] Failed to set locale, defaulting to C -> should be C.utf-8
Product: [Fedora] Fedora Reporter: Miro Hrončok <mhroncok>
Component: dnfAssignee: Marek Blaha <mblaha>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 30CC: dmach, jmracek, jrohel, mblaha, mhatina, packaging-team-maint, pkratoch, rpm-software-management, vmukhame, zbyszek
Target Milestone: ---Keywords: Reopened, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
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:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-05-10 00:47:31 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1670376    

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.