in reply to
OT: would this ENV setup make you blow your lid too?
So which part is breaking which part of your code? FWIW I tend to believe that if I am relying on anything being set in the environment for me then I am doing something wrong. If I need something I set it, otherwise I ignore it. I see other people fighting with cron and scripts being run from different shells etc and by and large I don't have those kinds of problems.
Do not seek to follow in the footsteps of the wise. Seek what they sought. -Basho