xkbprint may generate incorrect postscript files...
Submitted by Sebastian Rasmussen
Assigned to Xorg Project Team
Description
xkbprint fails to generate a proper postscript file if a sufficiently long XkbOptions line is used. This line gets trucated by xkbprint before it is used in the resulting postscript file which causes the problem.
If I use the following configuration in xorg.conf for the keyboard input device:
Option "XkbRules" "xorg"
Option "XkbModel" "pc105"
Option "XkbLayout" "us"
Option "XkbOptions"
"altwin:swap_lalt_lwin,apple:goodmap,caps:internal_nocancel,compose:rctrl,ctrl:swapcaps,eurosign:e,grp:ctrl_shift_toggle,japan:kana_lock,keypad:legacy"
(I know that this configuration is bogus, but it highlights the problem) I get a proper postscript file from xkbprint. When I add lv3:ralt_switch_multikey however, as in this configuration:
Option "XkbRules" "xorg"
Option "XkbModel" "pc105"
Option "XkbLayout" "us"
Option "XkbOptions"
"altwin:swap_lalt_lwin,apple:goodmap,caps:internal_nocancel,compose:rctrl,ctrl:swapcaps,eurosign:e,grp:ctrl_shift_toggle,japan:kana_lock,keypad:legacy,lv3:ralt_switch_multikey"
I get a broken postscript file from xkbprint. Diffing the two resulting postscript files indicates that the following rows are the culprit:
--- working.ps 2007-04-15 10:48:48.000000000 +0200 +++ broken.ps 2007-04-15 10:51:27.000000000 +0200 @@ -2588,10 +2588,10 @@ kby kbdscaleheight add 16 add moveto 1 -1 scale (Group 1) show 1 -1 scale -kbx kbdscalewidth 0 (Layout: pc(pc105)+us+altwin(swap_lalt_lwin)+group(ctrl_shift_toggle)+ctrl(swapcaps)+compose(rctrl)+eurosign) centeroffset pop add +kbx kbdscalewidth 0 (Layout: pc(pc105)+us+altwin(swap_lalt_lwin)+group(ctrl_shift_toggle)+level3(ralt_switch_multikey)+ctrl(swap) centeroffset pop add kby kbdscaleheight add 32 add moveto -1 -1 scale (Layout: pc(pc105)+us+altwin(swap_lalt_lwin)+group(ctrl_shift_toggle)+ctrl(swapcaps)+compose(rctrl)+eurosign) show 1 -1 scale +1 -1 scale (Layout: pc(pc105)+us+altwin(swap_lalt_lwin)+group(ctrl_shift_toggle)+level3(ralt_switch_multikey)+ctrl(swap) show 1 -1 scale kbx kbdscalewidth 0 (Generic 105) centeroffset pop add kby kbdscaleheight add 48 add moveto
As far as I know parenthesis in postscript must, since they are used to delimit strings, balance in a string or be escaped with back-slash. I belive this is the problem, no parentheses are escaped which means that they must balance, but the option ctrl(swapcaps) is truncated to ctrl(swap at two places which means that that two right parentheses are missing and therefore left and right parentheses do not balance.
My best guess is that there may be other similar assumptions about balancing of parentheses in the code that I have not encountered. This problem was stumbled upon when attempting to verify that another bug concerning xkbprint had been fixed (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=295015).
Version: 7.1 (2006.05)