Bug 891124 - RFE: localectl should improve input validation for set-keymap and set-x11-keymap (they silently accepts junk)
RFE: localectl should improve input validation for set-keymap and set-x11-key...
Status: CLOSED NEXTRELEASE
Product: Fedora
Classification: Fedora
Component: systemd (Show other bugs)
rawhide
x86_64 Linux
unspecified Severity medium
: ---
: ---
Assigned To: systemd-maint
Fedora Extras Quality Assurance
: FutureFeature
Depends On:
Blocks: systemd-RFE
  Show dependency treegraph
 
Reported: 2013-01-01 17:58 EST by Reartes Guillermo
Modified: 2015-03-13 00:58 EDT (History)
10 users (show)

See Also:
Fixed In Version: systemd-218-5.fc22
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-03-13 00:58:50 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
screenshot after reboot (43.37 KB, image/png)
2013-01-01 17:58 EST, Reartes Guillermo
no flags Details

  None (edit)
Description Reartes Guillermo 2013-01-01 17:58:04 EST
Created attachment 671148 [details]
screenshot after reboot

Description of problem:

The input validation of 'localectl' is either weak or very weak, it just blindly trust what one says, even if one makes an absurd configuration like the one i performed below. It should check that the files supporting what one enters are there and if not, print an error.

Version-Release number of selected component (if applicable):
systemd.x86_64  195-10.fc18

How reproducible:
always

Steps to Reproduce:

Set the locale to KLINGON / KLINGON using UTF "128" 

# localectl set-locale LANG=kl.KL.UTF-128

# localectl
  System Locale: LANG=kl_KL.UTF-128
      VC Keymap: es
     X11 Layout: n/a

No errors whatsoever, nice, i do have Klingon support!
No, let's use a romulan keyboard! why not?

# localectl set-keymap romulan

# localectl
  System Locale: LANG=kl_KL.UTF-128
      VC Keymap: romulan
     X11 Layout: n/a

It is becoment interesting, let's and a borg X11 Layout!
     
# localectl set-x11-keymap borg

# localectl
  System Locale: LANG=kl_KL.UTF-128
      VC Keymap: romulan
     X11 Layout: borg
  
Actual results:
localectl silently accept the junk values. after reboot there will be
errors because it will not find what it believes it had configured. 

Expected results:
A improved input validation, since it is an application.

Additional info:
Comment 1 Lennart Poettering 2013-01-13 16:36:50 EST
Well, the locale system works so that the "closest" locale is usec, even if the locale itself is not found. As the locale is frequently included in web browser HTTP headers its actually a good idea leaving locales set whose definition does not exist locally.

So I am pretty sure we should not make such a limitation for locales. It's a privileged operation anyway...

The keymap configuration is a different thing though. It can agree that validating the selected map against what is available makes sense.
Comment 2 Adam Williamson 2013-07-04 19:28:35 EDT
As this is an RFE, setting to rawhide/FutureFeature.

This is still valid:

[root@adam adamw]# localectl set-keymap sdgnaihjhga
[root@adam adamw]# localectl
   System Locale: LANG=en_US.utf8
                  LC_NUMERIC=en_CA.utf8
                  LC_TIME=en_CA.utf8
                  LC_MONETARY=en_CA.utf8
                  LC_MEASUREMENT=en_CA.utf8
       VC Keymap: sdgnaihjhga
      X11 Layout: us
       X11 Model: pc105+inet
     X11 Options: terminate:ctrl_alt_bksp
Comment 3 Zbigniew Jędrzejewski-Szmek 2015-03-13 00:58:50 EDT
Checking was implemented in http://cgit.freedesktop.org/systemd/systemd/commit/?id=d4f5a1f47d. This is part of systemd-218, in F22+. We currently do not refuse, only warn. This might be changed.

Note You need to log in before you can comment on or make changes to this bug.