Vladimir Prus


Friday, April 15, 2005

Environment variables gotcha

The Debian Policy requires that applications do not depend on environment variables for proper operation. Why? They say that /etc/profile is not supported by all shells (hmm... is there anything but bash?), and that the file should not be modified at all, but there's also another simple reason.

If you run:

$ su root
# apt-get install whatever
$ whatever
then any environment variable setting added to /etc/profile won't affect the current session, only future ones. And there's no way around this. So if whatever needs some environment variables, it will just break.

In my case, "whatever" used environment variables to find its icons, which produced marvellous results:

No comments: