develooper Front page | perl.perl5.porters | Postings from November 1999

Re: [ID 19991116.002] perl5.005_02: my_setenv() and Term::ReadLine::Gnu

From:
Joerg Schumacher
Date:
November 19, 1999 10:04
Subject:
Re: [ID 19991116.002] perl5.005_02: my_setenv() and Term::ReadLine::Gnu
Message ID:
199911191804.TAA28995@aunt.gaertner.de
Hi!

> > On the contrary: I do believe that the check 
> > 
> > 	(environ == PL_origenviron) /* need we copy environment? */
> > 
> > is broken.  This test would only be OK if perl itself could guarantee
> > that no extension module modifies environ behind the scene.
> 
> I do not believe this.  At least the documentation I see states that
> putenv() will malloc() environ if it needs to modify it.  Thus with
> usemymalloc=n the test is OK as is.

You do know the difference between 

	free(environ)

and 
	free(environ[i])

don't you?  While the former would be safe after a call to putenv()
assumed that putenv() had to expand the environment via malloc() the
latter is certainly not covered by the putenv() specs.

Sigh, I'll put together a perl extension module as smallest possible
testcase and send it in so you folks may finally bother to reproduce
the bug.  FWIW, I can reproduce the problem also on linux with libc5
and libc6.

Regards,
Joerg 

-- 
 Gaertner Datensysteme                         38114 Braunschweig 
 Joerg Schumacher                              Hamburger Str. 273a
 Tel: 0531-2335555          		       Fax: 0531-2335556



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About