[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#496548: xmodmap in xdm Xsetup, empty modifier map, broken Shift



Package: xserver-xorg-core
Version: 2:1.4.2-3

I'm suffering a problem with xmodmap.  Since at least July 1997 I have
swapped control and capslock on my displays, and made certain other
changes to the keymap, by using xmodmap in the xdm Xsetup script.
This no longer works properly.  (I do it like this because this
affects all X displays connected to the server, because I want more
than the swapcaps option can provide, and of course because originally
there was no server config file option to change keymaps at all.)

The symptoms are that on the display running lenny it is not possible
to log in because it is not possible to type shifted letters into the
xdm greeter (eg for one's passphrase).  (I'm using the xdm greeter
rather than gdm etc.)

I have investigated and discovered that:

 * When xmodmap -pm is run in Xsetup, it prints an empty modifier
   map.  That is, there are no modifiers set.

 * The runes I use for xmodmap to swap control and capslock 
   explicitly set up mappings for control and capslock, rather than
   transplanting them.  After xmodmap runs, there are modifier
   settings for control and capslock but not for shift. I conjecture
   that xmodmap works by reading the whole modifier map and then
   writing a modified version.

 * My xmodmap invocation to change the modifier map exits with status
   1 without any apparent cause and without printing an explanation.
   This would seem to be a bug in xmodmap.

 * If I comment out the xmodmap call in Xsetup, everything works fine.
   After logging in I see the expected modifier map.  I can then do
   exactly the same xmodmap invocation and it works perfectly - the
   functionality of shift is not affected.

 * The effect happens nearly every time but doesn't seem to be quite
   100% reproducible.  I haven't had it fail to go wrong under 100%
   controlled conditions so I'm not sure, but I suspect a race.

A complicating factor is that the xdm host is running sarge.  Thus xdm
and the chooser are those from sarge.  xmodmap is running on the sarge
host.  It would be rather too disruptive to untangle this so that I
could run xdm on what is current the lenny client and I don't have a
spare box right now to use for a specific test.  However I have
verified that running lenny's xmodmap (via chroot and NFS) doesn't
help: lenny's xmodmap appears to be identical in behaviour.

Here are some relevant files:

My instrumented Xsetup_2 script:

    #!/bin/sh
    # $XConsortium: Xsetup_0,v 1.3 93/09/28 14:30:31 gildea Exp $

    set -e

    echo "1 $0 $*"
    echo "2 $0 $*" >&2
    set -x
    type -p xmodmap

    xmodmap -pm || echo "x $?"
    printenv || sort
    rsync -vP $XAUTHORITY /net/anarres/root/.Xauthority

    XAUTHORITY=/root/.Xauthority chroot /net/anarres xdpyinfo || echo "q $?"
    XAUTHORITY=/root/.Xauthority chroot /net/anarres xmodmap -pm || echo "y $?"

    XAUTHORITY=/root/.Xauthority chroot /net/anarres xmodmap -verbose /root/Xmodmap_local || echo $?

    XAUTHORITY=/root/.Xauthority chroot /net/anarres xmodmap -pm || echo "z $?"

    xsetroot -fg blue -bg black -bitmap /etc/X11/xdm/defaultroot.bitmap

Output of xmodmap -pm after Shift has been broken in this way, in a
session obtained by logging in as a user with no shifted characters in
the password:

    xmodmap:  up to 1 keys per modifier, (keycodes in parentheses):

    shift     
    lock        Caps_Lock (0x25)
    control     Control_L (0x42)
    mod1      
    mod2      
    mod3      
    mod4      
    mod5      

The xmodmap file Xmodmap_local:

    ! UK keymap, swap capslock and control
    clear control
    clear lock
    keycode 11 = 2 quotedbl
    keycode 22 = BackSpace
    keycode 48 = apostrophe at
    keycode 51 = numbersign asciitilde
    keycode 94 = backslash bar
    keycode 37 = Caps_Lock
    keycode 66 = Control_L
    add control = Control_L Control_R
    add lock = Caps_Lock

    keycode 113 = Meta_R

    keycode 99 = End
    keycode 103 = Prior

The contents of xdm.log including the debugging output from the
Xsetup_2 script above:

    Mon Aug 25 16:44:42 2008 xdm info (pid 22554): starting X server on anarres.relativity.greenend.org.uk:2
    Mon Aug 25 16:44:42 2008 xdm info (pid 24883): sourcing /etc/X11/xdm/Xsetup
    1 /etc/X11/xdm/Xsetup_2 
    2 /etc/X11/xdm/Xsetup_2 
    + type -p xmodmap
    /usr/bin/X11/xmodmap
    + xmodmap -pm
    xmodmap:  up to 0 keys per modifier, (keycodes in parentheses):

    shift     
    lock      
    control   
    mod1      
    mod2      
    mod3      
    mod4      
    mod5      

    + printenv
    SHELL=/bin/sh -e
    PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11
    PWD=/
    SHLVL=2
    DISPLAY=anarres.relativity.greenend.org.uk:2
    XAUTHORITY=/var/lib/xdm/authdir/authfiles/Aanarres.relativity.greenend.org.uk:2-vtuuyQ
    _=/usr/bin/printenv
    + rsync -vP /var/lib/xdm/authdir/authfiles/Aanarres.relativity.greenend.org.uk:2-vtuuyQ /net/anarres/root/.Xauthority
    Aanarres.relativity.greenend.org.uk:2-vtuuyQ
	      44 100%    0.00kB/s    0:00:00
          44 100%    0.00kB/s    0:00:00  (1, 100.0% of 1)

    sent 169 bytes  received 42 bytes  140.67 bytes/sec
    total size is 44  speedup is 0.21
    + XAUTHORITY=/root/.Xauthority
    + chroot /net/anarres xdpyinfo
    name of display:    anarres.relativity.greenend.org.uk:2.0
    [ lots of stuff deleted -iwj ]
	red, green, blue masks:    0xff0000, 0xff00, 0xff
	significant bits in color specification:    8 bits
    + XAUTHORITY=/root/.Xauthority
    + chroot /net/anarres xmodmap -pm
    xmodmap:  up to 0 keys per modifier, (keycodes in parentheses):

    shift     
    lock      
    control   
    mod1      
    mod2      
    mod3      
    mod4      
    mod5      

    + XAUTHORITY=/root/.Xauthority
    + chroot /net/anarres xmodmap -verbose /root/Xmodmap_local
    ! /root/Xmodmap_local:
    ! 2:  clear control
	    clear control
    ! 3:  clear lock
	    clear lock
    ! 4:  keycode 11 = 2 quotedbl
	    keycode 0xb = 2 quotedbl
    ! 5:  keycode 22 = BackSpace
	    keycode 0x16 = BackSpace
    ! 6:  keycode 48 = apostrophe at
	    keycode 0x30 = apostrophe at
    ! 7:  keycode 51 = numbersign asciitilde
	    keycode 0x33 = numbersign asciitilde
    ! 8:  keycode 94 = backslash bar
	    keycode 0x5e = backslash bar
    ! 9:  keycode 37 = Caps_Lock
	    keycode 0x25 = Caps_Lock
    ! 10:  keycode 66 = Control_L
	    keycode 0x42 = Control_L
    ! 11:  add control = Control_L Control_R
	    add control = Control_L Control_R
    ! 12:  add lock = Caps_Lock
	    add lock = Caps_Lock
    ! 14:  keycode 113 = Meta_R
	    keycode 0x71 = Meta_R
    ! 16:  keycode 99 = End
	    keycode 0x63 = End
    ! 17:  keycode 103 = Prior
	    keycode 0x67 = Prior
    !
    ! executing work queue
    !
	    clear control
	    clear lock
	    keycode 0xb = 2 quotedbl
	    keycode 0x16 = BackSpace
	    keycode 0x30 = apostrophe at
	    keycode 0x33 = numbersign asciitilde
	    keycode 0x5e = backslash bar
	    keycode 0x25 = Caps_Lock
	    keycode 0x42 = Control_L
	    add control = Control_L Control_R
	    add lock = Caps_Lock
	    keycode 0x71 = Meta_R
	    keycode 0x63 = End
	    keycode 0x67 = Prior
    + echo 1
    1
    + XAUTHORITY=/root/.Xauthority
    + chroot /net/anarres xmodmap -pm
    xmodmap:  up to 1 keys per modifier, (keycodes in parentheses):

    shift     
    lock        Caps_Lock (0x25)
    control     Control_L (0x42)
    mod1      
    mod2      
    mod3      
    mod4      
    mod5      

    + xsetroot -fg blue -bg black -bitmap /etc/X11/xdm/defaultroot.bitmap

My xorg.conf:

    # xorg.conf (xorg X Window System server configuration file)
    #
    # This file was generated by dexconf, the Debian X Configuration tool, using
    # values from the debconf database.
    #
    # Edit this file with caution, and see the xorg.conf manual page.
    # (Type "man xorg.conf" at the shell prompt.)
    #
    # This file is automatically updated on xserver-xorg package upgrades *only*
    # if it has not been modified since the last upgrade of the xserver-xorg
    # package.
    #
    # If you have edited this file but would like it to be automatically updated
    # again, run the following command:
    #   sudo dpkg-reconfigure -phigh xserver-xorg

    Section "InputDevice"
	    Identifier	"Generic Keyboard"
	    Driver		"keyboard"
	    Option		"CoreKeyboard"
    EndSection

    Section "InputDevice"
	    Identifier	"Configured Mouse"
	    Driver		"mouse"
	    Option		"CorePointer"
	    Option		"Device"		"/dev/input/mice"
	    Option		"Protocol"		"ImPS/2"
    EndSection

    Section "Device"
	    Identifier	"anarres 965"
	    Driver		"intel"
	    Option "AccelMethod" "XAA"
    #	Option "EXANoComposite"
		    # workarounds for ? #496272 #451791
		    # (related with nvidia is #404770 but probably irrelevant)
    EndSection

    Section "Monitor"
	    Identifier	"nokia 446xpro"
	    Option		"DPMS"
    #	Option		"SyncOnGreen"
	    Option		"PreferredMode" "1600x1200_4"
    #	HorizSync	30-107
    #	VertRefresh	50-150
    #	HorizSync	30-77
    #	VertRefresh	50-120
     Modeline "1600x1200_4" 220.000 1600 1696 1888 2148 1200 1204 1215 1245 +hsync +vsync
     Modeline "1600x1200_5" 220.000 1600 1616 1808 2080 1200 1204 1207 1244 +hsync +vsync
    EndSection

    Section "Screen"
	    Identifier	"Default Screen"
	    Device		"anarres 965"
	    Monitor		"nokia 446xpro"
	    DefaultDepth	24
	    SubSection "Display"
    #		syntax error
		    Modes		"1600x1200_5"
    #		Modes		"1024x768"
    #		Modes		"1920x1440" "1600x1200" "1280x1024"
	    EndSubSection
    EndSection

    Section "ServerLayout"
	    Identifier	"Default Layout"
	    Screen		"Default Screen"
	    InputDevice	"Generic Keyboard"
	    InputDevice	"Configured Mouse"
    EndSection

-- 

Reply to: