Bug 34117

Summary: "man setxkbmap" misleading, -I option described incorrectly.
Product: xorg Reporter: van.de.bugger
Component: App/xkbcompAssignee: Xorg Project Team <xorg-team>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium CC: jeremyhu, peter.hutterer
Version: 7.5 (2009.10)Keywords: patch
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard: 2011BRB_Reviewed
i915 platform: i915 features:
Attachments:
Description Flags
Fix for the man page: space deleted. none

Description van.de.bugger 2011-02-09 17:14:25 UTC
SETXKBMAP(1)                                                                     
NAME
       setxkbmap - set the keyboard using the X Keyboard Extension
<...>
OPTIONS
<...>
       -I directory
               Adds a directory to the list of directories to be used to search for specified layout or rules files.

Note the space between option (-I) and its argument (directory). This is misleading. setxkbcomp does not allow space between -I and directory:

For example:

$ setxkbmap -print -I .
Couldn't find rules file (evdev) 

$ setxkbmap -print -I.
xkb_keymap {
	xkb_keycodes  { include "evdev+aliases(qwerty)"	};
	xkb_types     { include "complete"	};
	xkb_compat    { include "complete"	};
	xkb_symbols   { include "pc+us+ru:2+inet(evdev)+group(shift_caps_toggle)"	};
	xkb_geometry  { include "pc(pc105)"	};
};

BTW, error message is also very confusing: "Couldn't find rules file (evdev)". Why setxkbmap couldn't find rules file? It is in usual place. I guess it interprets "." as layout name, but it is not clear why rules file not found. Does -I reset directory list to search files in? Man does not specify it.

In any case, either man or the program should be fixed.
Comment 1 van.de.bugger 2011-02-10 11:45:28 UTC
Created attachment 43213 [details] [review]
Fix for the man page: space deleted.
Comment 2 Alan Coopersmith 2011-02-10 11:49:04 UTC
Fix for the code to accept -I with or without the space:
http://lists.x.org/archives/xorg-devel/2011-February/019120.html
Comment 3 van.de.bugger 2011-02-10 12:54:00 UTC
(In reply to comment #2)
> Fix for the code to accept -I with or without the space:

Thanks, but I think -I option in setxkbmap should be aligned with -I option in xkbcomp. The latter does not allow space after -I. Would you fix xkbcomp as well?
Comment 4 van.de.bugger 2011-02-10 13:32:31 UTC
(In reply to comment #2)
> Fix for the code to accept -I with or without the space:
> http://lists.x.org/archives/xorg-devel/2011-February/019120.html

One more comment:

If -I is the last argument in the command line, you issue an error:

ERR("Error!   Option \"-I\" requires an argument\n");

However, other options behave differently. Look at setOptString, they use

VMSG1(0, "No %s specified on the command line\n", svName[which]);
VMSG1(0, "Trailing %s option ignored\n", opt);

Wouldn't it be better to behave consistently?
Comment 5 Alan Coopersmith 2011-02-13 09:19:35 UTC
Fix adjusted as suggested in comment #4 has now been pushed to git master:
http://cgit.freedesktop.org/xorg/app/setxkbmap/commit/?id=2011f509c56b73cc62105c689d702f279f522017
Comment 6 van.de.bugger 2011-02-15 13:41:42 UTC
Hi guys,

It is nice that setxkbmap now allows a space between -I and directory, but I insist you should fix the man, with my patch or independently, because:

1. -Idir without a space still allowed.
2. Help message (issued by -help option) still says "-I[<dir>]".
3. "xkbcomp -help" also states "-I[<dir>]".
4. It is a kind of long-term tradition. For example, look at "man gcc": it allows both forms but at the top it states "[-Idir...]" (with no space).

BTW, I just noticed... "setxkbmap -help" message:

-I[<dir>]           Add <dir> to list of directories to be used

What the square brackets mean? As I know from the source code, the directory is *not* optional now, so brackets should be removed.
Comment 7 Alan Coopersmith 2011-02-24 21:04:49 UTC
(In reply to comment #6)
> Hi guys,
> 
> It is nice that setxkbmap now allows a space between -I and directory, but I
> insist you should fix the man, with my patch or independently, 

I'll let you take care of submitting the patch you feel is appropriate, now
that you've learned our review process.
Comment 8 Jeremy Huddleston Sequoia 2011-10-06 09:38:25 UTC
Since these is a patch for this, can we please get it reviewed and pushed.  
Please email your patch to xorg-devel for review.
Comment 9 Peter Hutterer 2013-07-01 01:37:41 UTC
for completeness:

commit 2011f509c56b73cc62105c689d702f279f522017
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date:   Wed Feb 9 23:42:44 2011 -0800

    Bug 34117: setxkbmap -I dir not accepted, despite man page

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.