[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cleansing the environment automatically

From: Paul Smith
Subject: Re: Cleansing the environment automatically
Date: Fri, 18 Jan 2008 22:17:27 -0500

On Sat, 2008-01-19 at 01:09 +0000, David Wuertele wrote:
> I always try to create a more strict configuration hygiene by
> cleansing the environment using "env -i" at the beginning of each
> command.

I agree 100%; this is the way to go.

> But this is tedious for me, hard to read for others, and prone to me
> forgetting to do it.  I would like to make it the default behavior.

> I'm not tied to this syntax, or to using env.  I just want to have
> total control over the environment for every command in my makefile.
> Any suggestions?

How about something like this:

        unexport $(foreach V,$(.VARIABLES),$(if $(filter environment,$(origin 
        export PATH LANG LC_ALL

Of course, change the list of exported variables to whatever you like.
In addition to what you put here you'll also see SHELL, MAKEFLAGS,
MAKELEVEL, and PWD (for some shells) visible in subshells.  But the rest
should be gone.  Another alternative would be the simpler:

        unexport $(.VARIABLES)

but you would have to ensure this always came before ALL export
operations in the makefile.

 Paul D. Smith <address@hidden>          Find some GNU make tips at:            
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist

reply via email to

[Prev in Thread] Current Thread [Next in Thread]