GNU bug report logs -
#23779
25.0.95; consing "SHELLVAR" onto process-environment doesn't remove it from subprocess env
Previous Next
Full log
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Start emacs -Q, evaluate the following lisp code (I wrote the return
values after ;=>)
(defun check-env-var (var)
(catch 'ret
(dolist (var=val (process-lines "env"))
(when (string-prefix-p var var=val)
(throw 'ret var=val)))))
(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".
This bug report was last modified 8 years and 338 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.