On Fri, Feb 01, 2002 at 03:31:14PM +0000, Christophe Rhodes wrote:
> I can report that while a vanilla 0.7.1 sbcl still exhibits the
> posix-environ segfault problem when dealing with different libcs, the
> attached patch solves this (by pushing the "defun posix-environ" onto
> after-save-initializations, too). I confess that the comment in my
> patch is speculative rather than authoritative...
> [ Context: when distributing binaries, (posix-environ) tends to
> segfault if there are even minor inconsistencies between libc
> versions, as the C variable "environ" can move... ]
Your patch added new Lisp-level logic to *AFTER-SAVE-INITIALIZATIONS*.
I decided to try another way, adding a C-level function
and replacing DEFINE-ALIEN-VARIABLE ENVIRON and all its
(define-alien-routine wrapped-environ (* c-string))
(defun posix-environ ()
"Return the Unix environment (\"man environ\") as a list of SIMPLE-STRINGs."
AFAIK the loader already knows how to deal with different libc
versions and I'm content to give it the responsibility.
This seems to work OK on my laptop (OpenBSD/x86). It seems to me that
it ought to work OK elsewhere, but I don't have any convenient way to
test different libc versions, so I'd appreciate it if someone else
could check whether it survives the libc shear that was causing the
segfaults with the old version.
William Harold Newman <william.newman@...>
"Look on my works, ye Mighty, and despair!" -- Ozymandias, King of Kings
PGP key fingerprint 85 CE 1C BA 79 8D 51 8C B9 25 FB EE E0 C3 E5 7C