Using environment variables without leaking memory?

Rob Landley rob at landley.net
Thu Oct 26 16:34:14 UTC 2006


On Thursday 26 October 2006 3:59 am, Rich Felker wrote:
> On Tue, Oct 24, 2006 at 03:51:35PM -0400, Rob Landley wrote:
> > Not actually all that hard to implement, really.  Why people have accepted 
> > such a screwed up status-quo for 15 years (forget about Unix, why have the 
> > _linux_ people accepted it?) is an open question.
> 
> I suspect the reason is a very good one: modifying the environment is
> something you have to do only very rarely (i.e. only a small number of
> programs do it, even if those few do it often), and any "fix" would
> not be available on other systems, so writing programs dependent on
> the fix would just mean more non-portable programs.

I really don't care about non-Linux systems anymore.  I just don't.  You can 
run Linux on a laptop, cell phone, supercomputer cluster, you name it.  And 
elsewhere Linux semantics are emulated (from Cygwin to the L in AIX5L).

> Instead it's more 
> practical just to write a solution that works everywhere, like
> deferring modification of the environment until after you fork.

COBOL works everywhere too.  Doesn't make it a good idea.

> Of course no one's going to stop you from writing your own functions
> for managing the environment via the "environ" var... :) That should
> work everywhere too.

That's what I did.  Might post it here when it's debugged.

> Rich

Rob
-- 
"Perfection is reached, not when there is no longer anything to add, but
when there is no longer anything to take away." - Antoine de Saint-Exupery



More information about the uClibc mailing list