Subject: Re: bug#23779: 25.0.95; consing "SHELLVAR" onto process-environment doesn't remove it from subprocess env

From: Paul Eggert <[email-masked]>
Date: Sun, 19 Jun 2016 04:27:32 +0200

On 06/17/2016 04:19 PM, Eli Zaretskii wrote:
>> Looks like it does. Please push at your convenience.
> I'd like the patch to be eyeballed by a few more people.  Paul,
> Andreas, do you see any problems with it?  If not, I'd like to push it
> to the emacs-25 branch
The patch is correct. The code is tricky so I'm not surprised you wanted 
another pair of eyes. The attached patch is a very minor tweak of your 
patch that made it a bit easier for me to follow. I resisted the 
temptation of cleaning up the surrounding code to make it more readable.

I like the idea of putting this into the emacs-25 branch. (Or your 
patch; doesn't really matter.)
>From ed5dabd6bb61613649f619f6f210d070812895d7 Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email-masked]>
Date: Sun, 19 Jun 2016 03:58:37 +0200
Subject: [PATCH] Consing "V" into process-environment should remove V

Problem reported by Noam Postavsky (Bug#23779).
* src/callproc.c (add_env): Consider new string "FOO=BAR" to match plain
"FOO" in the old proto-environment.  This is a slight tweak of the fix
suggested by Eli Zaretskii in http://bugs.gnu.org/23779#14
---
 src/callproc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/callproc.c b/src/callproc.c
index db602f5..38f3f92 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 (*q != *p && *p)
 	    break;
 	  if (*q == 0)
 	    /* The string is a lone variable name; keep it for now, we
-- 
2.5.5