bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#23779: 25.0.95; consing "SHELLVAR" onto process-environment doesn't


From: Eli Zaretskii
Subject: bug#23779: 25.0.95; consing "SHELLVAR" onto process-environment doesn't remove it from subprocess env
Date: Fri, 17 Jun 2016 10:11:58 +0300

> From: Noam Postavsky <address@hidden>
> Date: Thu, 16 Jun 2016 23:33:02 -0400
> 
> (check-env-var "SHELL");=>"SHELL=/bin/bash"
> (let ((process-environment (copy-sequence process-environment)))
>   (setenv "SHELL" nil)
>   (check-env-var "SHELL"));=>nil
> (let ((process-environment (cons "SHELL" process-environment)))
>   (check-env-var "SHELL"));=>"SHELL=/bin/bash"
> (let ((process-environment (cons "SHELL=" process-environment)))
>   (check-env-var "SHELL"));=>"SHELL="
> 
> As you can see from the 3rd expression, contrary to its docstring,
> consing the env variable "SHELL" onto process-environment has no
> effect at all.
> 
> process-environment is a variable defined in ‘C source code’.
> Its value is
> [...]
> Documentation:
> List of overridden environment variables for subprocesses to inherit.
> Each element should be a string of the form ENVVARNAME=VALUE.
> 
> Entries in this list take precedence to those in the frame-local
> environments.  Therefore, let-binding ‘process-environment’ is an easy
> way to temporarily change the value of an environment variable,
> irrespective of where it comes from.  To use ‘process-environment’ to
> remove an environment variable, include only its name in the list,
> without "=VALUE".

Where does it say that you can use 'cons' or 'push', and only them, to
the effect of removing the variable from the environment passed to
child processes?  process-environment is just a simple list, so these
two functions just _add_ another member to the list, they don't remove
the old member.

My reading of the last sentence you cite is that you must manually
remove the old member "SHELL=whatever", and _then_ add a member that
has no value.

Am I missing something?





reply via email to

[Prev in Thread] Current Thread [Next in Thread]