Subject: Re: bug#2259: 23.0.90; PATCH: getenv mistakenly passes a frame to getenv_internal, when it should instead pass a CONS

From: Juanma Barranquero <[email-masked]>
Date: Tue, 10 Feb 2009 11:24:42 +0100

On Tue, Feb 10, 2009 at 04:37, Eric Hanchrow <[email-masked]> wrote:

> I poked around and
> saw that getenv was passing a frame to getenv_internal, but
> getenv_internal only consults that second argument if it's a CONS.  This
> patch seems to fix the problem.

I think the patch is right, so I'm committing it.  getenv-internal's
docstring used to say that it searches in the frame environment, but
it wasn't right and was recently fixed. (The few) other uses of
getenv-internal rightly treat ENV as a list of environment variables.

Stefan, I just saw that `server-with-environment' does this:

         (let ((,value (getenv-internal ,var ,env)))
           (push (if (null ,value)
                     ,var
                   (concat ,var "=" ,value))
                 process-environment)))

which will fail if ENV contains a negative entry. Is that a bug, or it
is known at that point that the ENV arg of `server-with-environment'
will never contain negative entries (i.e., can the output of
(process-get process 'env) contain negative entries)? If it is
intended, perhaps a comment would be in order.

    Juanma