From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Fabrice Popineau Newsgroups: gmane.emacs.devel Subject: Re: Emacs 25.2, win64, env vars Date: Mon, 12 Jun 2017 06:40:40 +0200 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="001a114547da0c43020551bbedae" X-Trace: blaine.gmane.org 1497242497 24101 195.159.176.226 (12 Jun 2017 04:41:37 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 12 Jun 2017 04:41:37 +0000 (UTC) Cc: Emacs developers To: Noam Postavsky Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jun 12 06:41:33 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dKHAS-000655-Vh for ged-emacs-devel@m.gmane.org; Mon, 12 Jun 2017 06:41:33 +0200 Original-Received: from localhost ([::1]:36077 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dKHAY-0002T8-54 for ged-emacs-devel@m.gmane.org; Mon, 12 Jun 2017 00:41:38 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49904) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dKH9z-0002Ss-10 for emacs-devel@gnu.org; Mon, 12 Jun 2017 00:41:03 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dKH9y-00024s-3V for emacs-devel@gnu.org; Mon, 12 Jun 2017 00:41:03 -0400 Original-Received: from mail-qt0-x233.google.com ([2607:f8b0:400d:c0d::233]:33358) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dKH9x-00024f-Sv for emacs-devel@gnu.org; Mon, 12 Jun 2017 00:41:02 -0400 Original-Received: by mail-qt0-x233.google.com with SMTP id u12so113622516qth.0 for ; Sun, 11 Jun 2017 21:41:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=O2vv+uAjCOPPHStLSyBzi3G4Msh4v+GBorgBgD1DRwc=; b=bom6tx207Od/mpDBKK6cJsp0wENCRo6Mkyn6SvP0ZlMB2rciSVnF2N8wQ4mhiqLHIk Pj1o92kaZ/kCbpYDQNya646ixcuVWphei/GVOzB2YnqZG6dbQ8XW4Ii78QPz95TkXTGH kqTfTs2ZfvCI4PzG36GlK4e+BITA00ssbr0nV8+OYN5pYZ+Nzu4kHy6q+LSLmw7vSyzn TLl3LM7Zie4/9Y4FOLOXh3YVLaE9o1V24N6CnSN2AR0ugi9oIG6AJTbSUfqpSKwUKQO6 wVnK4Zw7+l5G2oMn8r+XPN/Iv1L5zPtTSGpaBNGvbeo/KydfomTbh26/tqvVKZVGJkgm Gfkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=O2vv+uAjCOPPHStLSyBzi3G4Msh4v+GBorgBgD1DRwc=; b=JjQ8YzLIU62Sz3wFn2V8Sve1Wno/R1AYoIhhiO5halcVYTUqwIvZf8Tzq7FPANm0lF ic0f3/54EjJjkovb4cAiYaiLqXzya8C2L7hyndEvzK0N6p1sfbgBf5Rd+2DH6r1ZEyy+ viLJhPW4ERNawngiDfghgKzV8N6yGqy6L+vMmY5yOW5Oi7xY7F9rDaYJ09G3z0yu7ISp PJjWHe420ifxHqK4cPR3sNeIXISuIW4rhAzfoHF9U1PvE0IxhijIpWd5WUJW0jesKWEV Qm9X2OI8apQSu5tixRGTtM9I0u9qbhef05Ud3ghUGzz4c7SARvSuDUwjZx9+x6dvuLS/ ggGA== X-Gm-Message-State: AKS2vOzd8QFz78H8jPxwrurt4B0WFV92mF4o8bIZv8uOwU69TAkNhByS Xw+Wnkj5LL/xOcVe63JIwVKPyzKa3w== X-Received: by 10.237.54.71 with SMTP id e65mr23119977qtb.146.1497242461289; Sun, 11 Jun 2017 21:41:01 -0700 (PDT) Original-Received: by 10.140.97.55 with HTTP; Sun, 11 Jun 2017 21:40:40 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c0d::233 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:215588 Archived-At: --001a114547da0c43020551bbedae Content-Type: text/plain; charset="UTF-8" Hi, Thanks Noam. Yes, the case is handled for getenv. The problem seems to be with setenv. The following is a possible fix. diff --git a/lisp/env.el b/lisp/env.el index 859f280802..c93be80e84 100644 --- a/lisp/env.el +++ b/lisp/env.el @@ -105,7 +105,7 @@ setenv-internal "Set VARIABLE to VALUE in ENV, adding empty entries if KEEP-EMPTY. Changes ENV by side-effect, and returns its new value." (let ((pattern (concat "\\`" (regexp-quote variable) "\\(=\\|\\'\\)")) - (case-fold-search nil) + (case-fold-search (memq system-type '(ms-dos windows-nt)) (scan env) prev found) ;; Handle deletions from the beginning of the list specially. Fabrice 2017-06-11 23:33 GMT+02:00 Noam Postavsky : > On Sun, Jun 11, 2017 at 4:33 PM, Fabrice Popineau > wrote: > > > AFAIK, environment variables are case insensitive under Windows. > > So there is something that is not taken care of for the case of case > > insensitive environment variables. > > I haven't (yet) been able to find where this magic happens however. > > It looks like there is code for it in callproc.c: > > static bool > getenv_internal_1 (const char *var, ptrdiff_t varlen, char **value, > ptrdiff_t *valuelen, Lisp_Object env) > { > for (; CONSP (env); env = XCDR (env)) > { > Lisp_Object entry = XCAR (env); > if (STRINGP (entry) > && SBYTES (entry) >= varlen > #ifdef WINDOWSNT > /* NT environment variables are case insensitive. */ > && ! strnicmp (SSDATA (entry), var, varlen) > --001a114547da0c43020551bbedae Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,

Thanks Noam.
Yes, the cas= e is handled for getenv.=C2=A0
The problem seems to be with seten= v.
The following is a possible fix.

diff --git a/lisp/env.el b/lisp/env.el
index 859f280802..c93be80= e84 100644
--- a/lisp/env.el
+++ b/lisp/env.el
@@ -105,7 +105,7 @@ setenv-internal
=C2=A0 =C2=A0"Set VARI= ABLE to VALUE in ENV, adding empty entries if KEEP-EMPTY.
=C2=A0C= hanges ENV by side-effect, and returns its new value."
=C2= =A0 =C2=A0(let ((pattern (concat "\\`" (regexp-quote variable) &q= uot;\\(=3D\\|\\'\\)"))
- =C2=A0 =C2=A0 =C2=A0 (case-fold= -search nil)
+ =C2=A0 =C2=A0 =C2=A0 (case-fold-search (memq syste= m-type '(ms-dos windows-nt))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (sca= n env)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 prev found)
=C2=A0 = =C2=A0 =C2=A0;; Handle deletions from the beginning of the list specially.<= /div>

Fabrice

2017-06-11 23:33 GMT+02:00 Noam Postavsky = <npostavs@users.sourceforge.net>:
On Sun, Jun 11, 2017 at 4:33 PM, Fabr= ice Popineau
<fabrice.popineau@gmail.co= m> wrote:

> AFAIK, environment variables are case insensitive under Windows.
> So there is something that is not taken care of for the case of case > insensitive environment variables.
> I haven't (yet) been able to find where this magic happens however= .

It looks like there is code for it in callproc.c:

static bool
getenv_internal_1 (const char *var, ptrdiff_t varlen, char **value,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ptrdiff_t *valuelen, Lisp_Object e= nv)
{
=C2=A0 for (; CONSP (env); env =3D XCDR (env))
=C2=A0 =C2=A0 {
=C2=A0 =C2=A0 =C2=A0 Lisp_Object entry =3D XCAR (env);
=C2=A0 =C2=A0 =C2=A0 if (STRINGP (entry)
=C2=A0 =C2=A0 =C2=A0 && SBYTES (entry) >=3D varlen
#ifdef WINDOWSNT
=C2=A0 =C2=A0 =C2=A0 /* NT environment variables are case insensitive.=C2= =A0 */
=C2=A0 =C2=A0 =C2=A0 && ! strnicmp (SSDATA (entry), var, varlen)

--001a114547da0c43020551bbedae--