Re: [ROOT] gSystem->Unsetenv

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Sat Jan 19 2002 - 12:45:20 MET


Hi Nicolas,

  I am fully aware of this but unsetenv() is not a POSIX call
just like setenv(). The only POSIX call is putenv(). We might use
unsetenv() on system supporting it (linux).

Cheers, Fons.



On Sat, 2002-01-19 at 11:34, Nicolas Produit wrote:
> Hi,
> In my version of root (3.00/06 on linux)
> gSystem->Unsetenv("A") is crashing.
> I saw that this was a known feature and was corrected.
> But looking at you code it seems that
> Unsetenv("A") is coded like Setenv("A","").
> This is not exactely a unsetenv. After an unsetenv the
> environment variable must disapear rather then be rest to a null string.
> 
> isdcpc3:dal3cat 173> root
>    *******************************************
>    *                                         *
>    *        W E L C O M E  to  R O O T       *
>    *                                         *
>    *   Version   3.00/06       10 May 2001   *
>    *                                         *
>    *  You are welcome to visit our Web site  *
>    *          http://root.cern.ch            *
>    *                                         *
>    *******************************************
> 
> FreeType Engine v1.x used to render TrueType fonts.
> Compiled with thread support.
> 
> CINT/ROOT C/C++ Interpreter version 5.14.81, Mar 20 2001
> Type ? for help. Commands must be C++ statements.
> Enclose multiple statements between { }.
> root [0] .! printenv A
> root [1] gSystem->Setenv("A","B")
> root [2] .! printenv A
> B
> root [3] gSystem->Setenv("A","")
> root [4] .! printenv A
> 
> root [5] gSystem->Unsetenv("A")
> 
>   *** Break *** segmentation violation
> Root >
> 
> 
> What I expect is (is it what we get form a recent version of root?):
> 
> root [0] .! printenv A
> root [1] gSystem->Setenv("A","B")
> root [2] .! printenv A
> B
> root [3] gSystem->Setenv("A","")
> root [4] .! printenv A
> 
> root [5] gSystem->Unsetenv("A")
> root [6] .! printenv A
> root [7] .q
> 
> Thanks
> 
> 
> 
> 
> -- 
> Nicolas Produit
> INTEGRAL Science Data Center    Phone:  +41 22 950 91 40
> 16, Chemin d'Ecogia             Fax:    +41 22 950 91 33
> CH-1290 Versoix                 www:    http://isdc.unige.ch/
-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7679480



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:38 MET