Aha, I was confusing ~/.xsessionrc with ~/.xsession. ~/.xsessionrc is sourced using /bin/sh. A default Ubuntu session does not invoke ~/.xsession at all. Creating one that works correctly with Unity or GNOME or whatever, as well as configuring LightDM to invoke it it, requires a very pointy hat.
Aha, I was confusing ~/.xsessionrc with ~/.xsession. ~/.xsessionrc is sourced using /bin/sh. A default Ubuntu session does not invoke ~/.xsession at all. Creating one that works correctly with Unity or GNOME or whatever, as well as configuring LightDM to invoke it it, requires a very pointy hat.