On Wed, Sep 03, 2014 at 02:01:06PM -0400, Wayne Stambaugh wrote:
http://peterlyons.com/problog/2010/02/environment-variables-considered-harmful
http://www.insectnation.org/howto/environment-variables-considered-harmful
I fully disagree with both of them :D (except for the bit about the
security issues, but that's applies only for badly written software)
When you have multiple environments on the same system, do chroot
jailing or simply need to have compatibility libraries you *need*
environment variables. Multiple version of the same program often can
cohexist using variables (like the JRE, everyone seems to be shipping
his own...)
If only to find the configuration file/directory to use this time :D
And doing like python does looking from the executable and chasing the
filesystem structure is hell when you have symlinked directories: but
just set PYTHONHOME and everything works fine...
Other example: TMPDIR. These days /tmp is usually a tmpfs (a kind of
ramdisk). What would you do for a process needing, like, a huge
temporary file? run it with TMPDIR pointing somewhere else (probably
/var/tmp or $HOME/tmp, depending on how you are partitioned)
Back to kicad: AFAIK the env vars are used to make possible moving from
a machine to another one, since the project is *not* self contained.
While libraries could be usually found on /usr/share/kicad (I think),
that's not necessarily true. On Windows, for starts, conventions are
differents. I, for example, have libs on $HOME/cvswork/kicad-libs.
That's the reason for having them. IIRC there is another expansion set
to the 'project directory' to allow pointing to project-local resources.
It's true that you *could* set all these paths in a config file (and
wouldn't be a bad idea, either). But at the end you'll need something
like KICAD_CONFIG (defaulted to something like
$HOME/.config/kicad/env-config) to supply the path of the config file to
use :D I have both stock subversion kicad and my customized build, so
settings and directories are different. How would you handle this
without at least one variable?