Bug 1187020
| Summary: | authconfig doesn't work with wrong locale settings | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Robin Hack <rhack> | ||||||
| Component: | authconfig | Assignee: | Tomas Mraz <tmraz> | ||||||
| Status: | CLOSED ERRATA | QA Contact: | Dalibor Pospíšil <dapospis> | ||||||
| Severity: | unspecified | Docs Contact: | |||||||
| Priority: | unspecified | ||||||||
| Version: | 7.2 | CC: | 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: |
|
||||||||
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 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.
(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"). I committed much less verbose variant of the warning.
Just:
sys.stderr.write('Warning: Unsupported locale setting.\n')
(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? There is not need for that. The 'C' locale is the default if setlocale is not called. 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}
The second version was not necessary, but thanks anyway. I already committed exactly the same thing upstream. 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 |
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.