Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1187020

Summary: authconfig doesn't work with wrong locale settings
Product: Red Hat Enterprise Linux 7 Reporter: Robin Hack <rhack>
Component: authconfigAssignee: Tomas Mraz <tmraz>
Status: CLOSED ERRATA QA Contact: Dalibor Pospíšil <dapospis>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.2CC: ebenes, pkis
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: authconfig-6.2.8-10.el7 Doc Type: Bug Fix
Doc Text:
Previously, when the user attempted to start the authconfig utility in an environment that used a locale unknown to the system, the utility failed with the following error message: locale.Error: unsupported locale setting With this update, authconfig properly handles the exception that caused this error and uses the default locale. As a result, authconfig no longer fails in the described situation.
Story Points: ---
Clone Of:
: 1247596 (view as bug list) Environment:
Last Closed: 2015-11-19 12:44:08 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:
Attachments:
Description Flags
Draft of patch - Quick and dirty patch
none
version 2 of authconfig locale patch none

Description Robin Hack 2015-01-29 08:04:49 UTC
Description of problem:
I'm connected from Mac OS X (LC_*=UTF-8) to RHEL box where I want to run
authconfig.

This should bother administrators who uses Mac OS X.


Version-Release number of selected component (if applicable):
authconfig-6.2.8-9.el7.x86_64

How reproducible:
always

Steps  to Reproduce:
1. # export LC_ALL="UTF-8"
2. # authconfig

Actual results:

[0 root@unused-4-245 test]# authconfig
Traceback (most recent call last):
  File "/usr/sbin/authconfig", line 31, in <module>
    locale.setlocale(locale.LC_ALL, '')
  File "/usr/lib64/python2.7/locale.py", line 547, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting

Expected results:
fallback to some default (en/posix/c?) locale


Additional info:
I found this (https://bugzilla.redhat.com/show_bug.cgi?id=1044245) bug closed as a NOTABUG. I still think that some polite workaround gives us better user experience.


I reported similar bug to virt-manager and they solved this issue with fallback to some default locale.

Comment 2 Robin Hack 2015-01-29 08:29:21 UTC
Created attachment 985454 [details]
Draft of patch - Quick and dirty patch

Attachment contains patch which works for me.

# export LC_ALL=UTF-8
# authconfig
Usage: authconfig [options] {--update|--updateall|--test|--probe|--restorebackup <name>|--savebackup <name>|--restorelastbackup}

Options:
...

Comment 3 Tomas Mraz 2015-01-29 08:55:16 UTC
Comment on attachment 985454 [details]
Draft of patch - Quick and dirty patch

I don't think the setlocale(LC_ALL,'C') is necessary.
I would at least print a warning about unsupported locale though.

Comment 4 Robin Hack 2015-01-29 09:14:07 UTC
(In reply to Tomas Mraz from comment #3)
> Comment on attachment 985454 [details]
> Draft of patch - Quick and dirty patch
> 
> I don't think the setlocale(LC_ALL,'C') is necessary.
> I would at least print a warning about unsupported locale though.

Hi Tomas. I agree.

What about perl example? It's this approach acceptable by you?

[rhack@bigoook ~]$ perl
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
	LC_ALL = "utf-8",
	LANG = "en_US.utf8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

Comment 5 Tomas Mraz 2015-01-29 09:16:18 UTC
I committed much less verbose variant of the warning.

Just:
sys.stderr.write('Warning: Unsupported locale setting.\n')

Comment 6 Robin Hack 2015-01-29 09:22:54 UTC
(In reply to Tomas Mraz from comment #5)
> I committed much less verbose variant of the warning.
> 
> Just:
> sys.stderr.write('Warning: Unsupported locale setting.\n')

Sounds great. Then this and fallback to default locale?

sys.stderr.write('Warning: Unsupported locale setting.\n')
sys.stderr.write('Warning: Falling back to the standard locale "C"\n')

And fallback of course :).

What do you mean?

Comment 7 Tomas Mraz 2015-01-29 09:24:56 UTC
There is not need for that. The 'C' locale is the default if setlocale is not called.

Comment 8 Robin Hack 2015-01-29 09:33:26 UTC
Created attachment 985477 [details]
version 2 of authconfig locale patch

Ok. Thanks.

[0 root@unused-4-245 xxx]# authconfig
Warning: Unsupported locale setting.
Usage: authconfig [options] {--update|--updateall|--test|--probe|--restorebackup <name>|--savebackup <name>|--restorelastbackup}

Comment 9 Tomas Mraz 2015-01-29 10:08:23 UTC
The second version was not necessary, but thanks anyway. I already committed exactly the same thing upstream.

Comment 12 errata-xmlrpc 2015-11-19 12:44:08 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-2403.html