After all the problems I had, I found that /etc/X11/Xsession was somehow a symbolic link to /etc/kde3/kdm/Xsession, and reinstalling x11-common fixed things. I have no idea how this came about, as the link was dated some time in 2005, and I have been running kde most of the time.
Thanks to everyone who offered suggestions. Arthur.