GNU bug report logs - #23779
25.0.95; consing "SHELLVAR" onto process-environment doesn't remove it from subprocess env

Previous Next

Package: emacs;

Reported by: Noam Postavsky <npostavs <at> users.sourceforge.net>

Date: Fri, 17 Jun 2016 03:34:02 UTC

Severity: normal

Found in version 25.0.95

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 23779 <at> debbugs.gnu.org, npostavs <at> users.sourceforge.net
Subject: bug#23779: 25.0.95; consing "SHELLVAR" onto process-environment doesn't remove it from subprocess env
Date: Fri, 17 Jun 2016 17:01:23 +0300
> Cc: 23779 <at> debbugs.gnu.org
> From: Dmitry Gutov <dgutov <at> yandex.ru>
> Date: Fri, 17 Jun 2016 15:17:38 +0300
> 
> On 06/17/2016 10:11 AM, Eli Zaretskii wrote:
> 
> > 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?
> 
> That works with other Emacs features, such as auto-mode-alist.

There should be code to make it work, it won't work by itself.
(auto-mode-alist is different, because it's used entirely in Lisp.  By
contrast, here we must construct the C-level environment array we pass
to child programs so as to remove the variable from it.)

> You can also override the values in process-environment using a cons 
> (which strongly suggests the semantics of "first element wins"). Just 
> not "remove" them, currently.

Looks like this never worked as intended.  Does the patch below fix
this?

diff --git a/src/callproc.c b/src/callproc.c
index db602f5..2fb5b1d 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -1099,7 +1099,7 @@ add_env (char **env, char **new_env, char *string)
       char *p = *ep, *q = string;
       while (ok)
 	{
-	  if (*q != *p)
+	  if (*p && *q != *p)
 	    break;
 	  if (*q == 0)
 	    /* The string is a lone variable name; keep it for now, we




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.