Re: Setting environment variables

Mark Evenson <[email protected]> Tue, 2 May 2023 08:36:09 +0200
Newsgroups gmane.editors.j.devel
Message-ID <[email protected]>

> On Apr 30, 2023, at 00:38, Alan Ruttenberg <[email protected]> =
wrote:
>=20
> Here's what I did: =
https://github.com/alanruttenberg/lsw2/blob/owlapiv4/util/setenv.lisp
>=20
> You still can't set environment variables in the parent process, of =
course.
>=20
> Alan
>=20
>=20
> On Sat, Apr 29, 2023 at 2:25=E2=80=AFAM Scott L. Burson =
<[email protected]> wrote:
> Hi,
>=20
> I've been away from ABCL for some time, so I ask your indulgence in =
case I'm revisiting a familiar issue.  I tried (SETF (UIOP:GETENV "foo") =
"value") and got
>=20
> Not (currently) implemented on ABCL: (SETF UIOP/OS:GETENV)
>=20
> On investigation, I see that the JVM doesn't normally support setting =
environment variables, but there are known ways to jimmy it into doing =
so: =
https://stackoverflow.com/questions/318239/how-do-i-set-environment-variab=
les-from-java
>=20
> Would a PR to add such a hack to ABCL be welcome, or should I just =
make it a local mod?  Or is there another, recommended way of doing =
this?

A patch for ABCL to add this would be appreciated, but the =
implementation should somehow be changed to the =E2=80=9Cstandard=E2=80=9D=
 load for JNA by the ABCL-ASDF contrib, namely something like=20

   (require :abcl-contrib)
   (asdf:make :jna)


As I understand it, Alan=E2=80=99s implementation only works if =
ABCL-ASDF:RESOLVE is present, meaning it cannot be put =E2=80=9Cas is=E2=80=
=9D in the base ABCL system.  I believe this is possible because the =
OWL2 application uses the ABCL-AIO build of ABCL which merges abcl.jar =
which abcl-contrib.jar, but I could be wrong.  Conceptually, we should =
somehow place the implementation of setting environment variables via =
the C syscall as a patch in the contrib system in a new contrib called =
(?) USE-POSIX-SYSCALLS (terrible name, please change).  Such a new =
contrib would a) depend on=20
 JNA and b) have to be used via=20

   (asdf:make :use-posix-syscalls)




--=20
"A screaming comes across the sky.  It has happened before but there is =
nothing=20
to compare to it now."