Re: How to reset ENV

[email protected] (Roderich Schupp) Thu, 24 Feb 2022 15:16:16 +0100
Newsgroups perl.par
Message-ID <CAC9r9zbtTU7b0CwnTdbLhAToeYy9FOJXTkNw63-QRMD4u2BngQ@mail.gmail.com>
--00000000000068ca4205d8c43ae4
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Thu, Feb 24, 2022 at 12:07 PM Patrick B=C3=B6ker <patrick.boeker@posteo.=
de>
wrote:

> Did I understand correctly, that you also have no better idea than
> heuristically trying to bring ENV back to its original state right before
> doing "exec"?
>

It's the right idea. Also no heuristic needed:

my $ldlibpthname =3D $Config::Config{ldlibpthname};
my $path_sep =3D $Config::Config{path_sep};
$ENV{$ldlibpthname}  =3D~ s/^ \Q$ENV{PAR_TEMP}\E $path_sep? //x;

should restore the original LD_LIBRARY_PATH etc.

Cheers, Roderich

--00000000000068ca4205d8c43ae4
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr">On Thu, Feb 24, 2022 at 12:07 PM Patrick =
B=C3=B6ker &lt;<a href=3D"mailto:[email protected]" target=3D"_blank=
">[email protected]</a>&gt; wrote:<br></div><div class=3D"gmail_quot=
e"><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;bord=
er-left:1px solid rgb(204,204,204);padding-left:1ex">Did I understand corre=
ctly, that you also have no better idea than <br>
heuristically trying to bring ENV back to its original state right before <=
br>
doing &quot;exec&quot;?<br></blockquote><div><br></div><div>It&#39;s the ri=
ght idea. Also no heuristic needed: <br></div><div><br></div><div>my $ldlib=
pthname =3D $Config::Config{ldlibpthname};</div><div>my $path_sep =3D $Conf=
ig::Config{path_sep};<br></div><div>$ENV{$ldlibpthname}=C2=A0 =3D~ s/^ \Q$E=
NV{PAR_TEMP}\E $path_sep? //x;</div><div><br></div><div>should restore the =
original LD_LIBRARY_PATH etc.</div><div><br></div><div>Cheers, Roderich<br>=
</div></div></div>

--00000000000068ca4205d8c43ae4--