Bug 891124 - RFE: localectl should improve input validation for set-keymap and set-x11-keymap (they silently accepts junk)
Summary: RFE: localectl should improve input validation for set-keymap and set-x11-key...
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: systemd
Version: rawhide
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: systemd-maint
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: systemd-RFE
TreeView+ depends on / blocked
 
Reported: 2013-01-01 22:58 UTC by Reartes Guillermo
Modified: 2015-03-13 04:58 UTC (History)
10 users (show)

Fixed In Version: systemd-218-5.fc22
Clone Of:
Environment:
Last Closed: 2015-03-13 04:58:50 UTC
Type: Bug
Embargoed:


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

Description Reartes Guillermo 2013-01-01 22:58:04 UTC
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 21:36:50 UTC
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 23:28:35 UTC
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 04:58:50 UTC
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.