[cmucl-imp] Snapshot 2015-06

Carl Shapiro carl.shapiro at gmail.com
Fri Jun 12 20:57:40 UTC 2015


On Fri, Jun 12, 2015 at 6:52 AM, Stelian Ionescu <sionescu at cddr.org> wrote:

> You can have both, which IMO is the right thing wrt. to
> backwards-compatibility with C programs.
>

Interesting.  But, how exactly would this work?  The C library provides no
signal to invalidate a cache when its copy of the environment changes  As
such, it seems impossible to efficiently keep a copy of the environment in
Lisp consistent.  Without consistency, I am not sure how backward
compatibility is maintained.


> With IOlib one can query the process-level environment or turn that into
> an object, manipulate it and pass it to CREATE-PROCESS. See
> https://github.com/sionescu/iolib/blob/master/src/os/os-unix.lisp#L10.
>

Thanks for the pointer.  I noticed that your hash-table construction does
not check for the preexistence of a value when doing inserts from the
environment list (on line 101).  While uncommon, this nevertheless is a
discrepancy between the behavior of getenv in your library and the and
getenv in the C library.  This can create a security issue.


> Additionally, since a C environment is an array of pointers, it's
> probably still faster to query if speed is a concern.
>

An array of pointers will certainly remove the overhead of the linked-list
traversal.  However, the EQUAL compare of the referent might eliminate the
savings.  This would have to be measured.


More information about the cmucl-imp mailing list