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

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

[debbugs-tracker] bug#23779: closed (25.0.95; consing "SHELLVAR" onto pr


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#23779: closed (25.0.95; consing "SHELLVAR" onto process-environment doesn't remove it from subprocess env)
Date: Mon, 20 Jun 2016 14:23:02 +0000

Your message dated Mon, 20 Jun 2016 17:21:03 +0300
with message-id <address@hidden>
and subject line Re: bug#23779: 25.0.95; consing "SHELLVAR" onto 
process-environment doesn't remove it from subprocess env
has caused the debbugs.gnu.org bug report #23779,
regarding 25.0.95; consing "SHELLVAR" onto process-environment doesn't remove 
it from subprocess env
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
23779: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=23779
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: 25.0.95; consing "SHELLVAR" onto process-environment doesn't remove it from subprocess env Date: Thu, 16 Jun 2016 23:33:02 -0400
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".



--- End Message ---
--- Begin Message --- Subject: Re: bug#23779: 25.0.95; consing "SHELLVAR" onto process-environment doesn't remove it from subprocess env Date: Mon, 20 Jun 2016 17:21:03 +0300
> Cc: address@hidden, address@hidden, address@hidden,
>  address@hidden
> From: Paul Eggert <address@hidden>
> Date: Mon, 20 Jun 2016 00:53:21 +0200
> 
> On 06/19/2016 05:01 PM, Eli Zaretskii wrote:
> >> >I resisted the temptation of cleaning up the surrounding code to
> >> >make it more readable.
> > Feel free to do that on master; I can mark the emacs-25 fix "not to be
> > merged".
> 
> Please don't bother.

OK, thanks.  Pushed as 5f37572 on the emacs-25 branch, and closing.


--- End Message ---

reply via email to

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