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 1755287

Summary: localectl set-locale should issue an error message when trying to set a nonexistent locale
Product: Red Hat Enterprise Linux 8 Reporter: Bernd Finger <bfinger>
Component: systemdAssignee: David Tardon <dtardon>
Status: CLOSED ERRATA QA Contact: Frantisek Sumsal <fsumsal>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 8.0CC: ashankar, codonell, dj, dtardon, fweimer, jamacku, mnewsome, msekleta, pfrankli, systemd-maint-list
Target Milestone: rcFlags: msekleta: mirror+
Target Release: 8.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: systemd-239-43.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-05-18 14:53:17 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:

Description Bernd Finger 2019-09-25 08:25:08 UTC
Description of problem:
Running "localectl set-locale aaa" on RHEL 8 succeeds and does not issue an error or warning message.

Version-Release number of selected component (if applicable):
RHEL 8.0 GA

How reproducible:
always

Steps to Reproduce:
1. Execute:
# localectl set-locale aaa
2. Run:
# echo $?

Actual results:
a) There is no warning or error message.
b) The return code is 0:
0

Expected results:
The behavior should be identical to RHEL 7.6:
a) There should be an error message like:
Failed to issue method call: Invalid Locale data.
b) The return code should be 1:
1

Additional info:

Comment 1 Florian Weimer 2019-09-25 08:35:46 UTC
localectl comes from systemd:

$ rpm -qf /usr/bin/localectl 
systemd-239-13.el8_0.5.x86_64

I think systemd should be able to check the availability of a locale using the setlocale function, so I don't think we need any glibc changes to enable this feature.

Comment 3 Jan Synacek 2019-10-31 11:53:41 UTC
(In reply to Bernd Finger from comment #0)
> Expected results:
> The behavior should be identical to RHEL 7.6:
> a) There should be an error message like:
> Failed to issue method call: Invalid Locale data.

Well, the RHEL-7.6 version does not check the input either. It just fails if you don't provide the variable that you want to set too.

# localectl set-locale foobar
Failed to issue method call: Invalid Locale data.

# localectl set-locale LANG=foobar
# echo $?
0

The upstream version (673d873a42fd6e7821e310cfb81bc37d092c4a22) doesn't sanity-check the input as well.

Comment 4 Jan Synacek 2019-11-06 13:20:09 UTC
https://github.com/systemd/systemd/pull/13964

Comment 8 Lukáš Nykrýn 2020-11-24 18:01:25 UTC
fix merged to github master branch -> https://github.com/systemd-rhel/rhel-8/pull/132

Comment 14 errata-xmlrpc 2021-05-18 14:53:17 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 (Moderate: systemd security, bug fix, and enhancement update), 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://access.redhat.com/errata/RHSA-2021:1611