Where to put the script?

Well it turns out for some reason one cannot simply add LD_LIBRARY_PATH to the .profile and move on. I can set other environment variables there, but not LD_LIBRARY_PATH. I can set it by hand though. I think this means that something runs between executing the .profile and launching my xterm is setting the LD_LIBRARY_PATH to empty.

What’s going on here?

Here are the last two lines in the .profile:

export LDLIBRARYPATH=/usr/local/cuda/lib
export LD_LIBRARY_PATH=/usr/local/cuda/lib

OK so what do I get when I open an xterm?

CUDA-1:~$ env | grep LIBRARY
LDLIBRARYPATH=/usr/local/cuda/lib
CUDA-1:~$ export LD_LIBRARY_PATH=/usr/local/cuda/lib
CUDA-1:~$ env | grep LIBRARY
LDLIBRARYPATH=/usr/local/cuda/lib
LD_LIBRARY_PATH=/usr/local/cuda/lib
CUDA-1:~$

AH - it turns out it’s a bug in Ubuntu 9.04 and xorg (whatever that is):

[url=“https://bugs.launchpad.net/ubuntu/+source/xorg/+bug/380360”]https://bugs.launchpad.net/ubuntu/+source/xorg/+bug/380360[/url]

"Expected behaviour would be that the environment with which I call xinit is the environment that clients in the session will see.

However, this is not the case, because ssh-agent (which is setuid) is indirectly a parent of all clients."

Well this is pretty annoying. LD_LIBRARY_PATH is ignored by things which are setuid.

Am I the only one getting hit with this? Or do other people have a nice workaround?

OK one idea that was suggested in that thread would be to comment out ssh-agent in /etc/X11/Xsession.options, which I have tried, and it seems to work. I just have to hope that nothing I use depends on that.