GNU bug report logs - #74550
eshell cannot set the environment variable PATH on Windows

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Siyuan Chen <chansey97@HIDDEN>; dated Tue, 26 Nov 2024 20:39:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 74550 <at> debbugs.gnu.org:


Received: (at 74550) by debbugs.gnu.org; 27 Nov 2024 18:53:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Nov 27 13:53:50 2024
Received: from localhost ([127.0.0.1]:34552 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tGNAc-0004JB-Kz
	for submit <at> debbugs.gnu.org; Wed, 27 Nov 2024 13:53:50 -0500
Received: from mail-pl1-f178.google.com ([209.85.214.178]:46170)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jporterbugs@HIDDEN>) id 1tGNAb-0004J1-KH
 for 74550 <at> debbugs.gnu.org; Wed, 27 Nov 2024 13:53:50 -0500
Received: by mail-pl1-f178.google.com with SMTP id
 d9443c01a7336-20cf3e36a76so241125ad.0
 for <74550 <at> debbugs.gnu.org>; Wed, 27 Nov 2024 10:53:49 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1732733568; x=1733338368; darn=debbugs.gnu.org;
 h=content-transfer-encoding:in-reply-to:from:references:cc:to
 :content-language:subject:mime-version:date:message-id:from:to:cc
 :subject:date:message-id:reply-to;
 bh=WBswkJW3w7NxTqBCuD5yIRhsLI1gX8JFkY23Sdb2iLY=;
 b=FgKfljcCghTkHIecZu6d18MTwNFvz0KLqcsvM/VolTZTR3UOKdhMxCCmCAjemewsqV
 eUSGLbdsxVOKxw8rK2maIOQIVAi3kQGMDSRYQ3CNQWNatmhRcsXDfU1Akil/R8DGAiIU
 rhe4PNkM859CZ1R81QfSEltqBvVTsoFtM3kO0Cn+xJ3EyreDK9rjtK2vBrlRzYJ46WUK
 OHjaFrRqK5U3cveaTT/MLLguSbiQVqh/xwWZpReFRIde2zbUJ52fCXSvaO0lYnyxsQlU
 stXHySidS7XMO2FNDvLzd57eoxNXHCNN1atChyYU4L71sElh3hj5Hf1t2zo/+TYkLH1i
 bLdg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1732733568; x=1733338368;
 h=content-transfer-encoding:in-reply-to:from:references:cc:to
 :content-language:subject:mime-version:date:message-id
 :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=WBswkJW3w7NxTqBCuD5yIRhsLI1gX8JFkY23Sdb2iLY=;
 b=lRYJVvlnEPaSBQNbYWZ1NTrJxztcyXHBT3q2rhz4tc3xVXLqj+R3tyTJdK4edZAL+Y
 TyDnWc00K8l5IX3kLg8sBuuCgyHvFePMp7QfD7V9hgcAeCCSSz1m7EDMVPVOLGCtWftj
 wTW3mg12+MX1GRuYK+8SVAeKiFhI8nB+vIivSC4Hvs7r+Gancf8wIbIFkozOJ0EKfLKM
 aUUQHTirAdXchIGkBtKsJQ3afGhrsmlQw+uQZ77mDELKSXfjQUMugpx6Jzwve4JaIyUm
 09ble9YFKcWP/qghE9jQfgqgMUuUPlfUrYve84RSSOhz7aiNaA2FY2wAOEoJt7Raqul0
 hhEQ==
X-Gm-Message-State: AOJu0YwrTWZ1pW+0n3l+zeadmIvsPj6SIjQUGnuyEiSXEVHsk+y6iJ0G
 tj7fk6PLg9z++6KSi0uMr142fwLgWRWwOMixK6ik2jJTDtNWHODD
X-Gm-Gg: ASbGncs9lzbNXgliBTIM4HzF6Dtlk73T0SMbCEj56WDWownZgkH1QwX0WZMwQrnfQWM
 PFwz+a7ngsf95tDGq8eaMG79V4/saep/WgWQQqd9C2e8m61X/BXP/zI14Y4VuWaaFEV7sDoS2lq
 ZhvWo/AZuYsWze2Vnfv7E7JgfuCLCJDx1z8RnVOaypHoPangKTxUdxOrVlPd8r9PlXPEKl/ec6r
 gQuP8TyaDoDuJpHmSAeNgz04VyDcDVOKDzkxPgAjKkms6DNcA5CnsmmIXuhFG8RLedYLcqIIZu+
 283wHTxyHPNSCTp4+rY64pSXYEk=
X-Google-Smtp-Source: AGHT+IFUJhdhvyPTDJpTHcyiNAmfFkvkhyM4AgPCkMUEjN8vmB5KvKWC6Dx3RkkwwVQ//FOHyj8u8A==
X-Received: by 2002:a17:903:41d1:b0:20c:5fd7:d71 with SMTP id
 d9443c01a7336-2150128abb4mr48074585ad.22.1732733568456; 
 Wed, 27 Nov 2024 10:52:48 -0800 (PST)
Received: from [192.168.1.2] (syn-023-240-098-037.res.spectrum.com.
 [23.240.98.37]) by smtp.googlemail.com with ESMTPSA id
 d9443c01a7336-2129db8c404sm106490975ad.40.2024.11.27.10.52.47
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Wed, 27 Nov 2024 10:52:48 -0800 (PST)
Message-ID: <cb451250-b09e-302b-18b0-4597400af27e@HIDDEN>
Date: Wed, 27 Nov 2024 10:52:47 -0800
MIME-Version: 1.0
Subject: Re: bug#74550: eshell cannot set the environment variable PATH on
 Windows
Content-Language: en-US
To: Siyuan Chen <chansey97@HIDDEN>
References: <CAHWTsYnSNUYnBkoLGf+XfmfVZ9XebLq6EiCo3-K3HU47ObCuMw@HIDDEN>
 <c4ea213a-df40-b9ee-b555-6bb456da31cc@HIDDEN>
 <CAHWTsYmgo983bESi8siYZCXc+3_Znsx=jRtKaz=RYxAFLpHoDA@HIDDEN>
From: Jim Porter <jporterbugs@HIDDEN>
In-Reply-To: <CAHWTsYmgo983bESi8siYZCXc+3_Znsx=jRtKaz=RYxAFLpHoDA@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 74550
Cc: 74550 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On 11/27/2024 9:15 AM, Siyuan Chen wrote:
> It works, thanks.
> 
> However, this seems to be a global setting only. Is there any equivalent 
> of with-environment-variables for exec-path?

Not exactly. However, you can use setq-local or eshell/addpath:

   (defun shell1 ()
     (interactive)
     (let ((current-prefix-arg 4))
       (call-interactively 'shell)
       (setq-local exec-path (cons "C:/foo" exec-path))
       ;; or ...
       (eshell/addpath "-b" "C:/foo")))

That's probably the best way to do it for now. I think it's probably 
reasonable for Eshell to work correctly when you've let-bound 
'exec-path' like in your examples, but I'll have to think about the best 
way to do it.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#74550; Package emacs. Full text available.

Message received at 74550 <at> debbugs.gnu.org:


Received: (at 74550) by debbugs.gnu.org; 27 Nov 2024 17:16:38 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Nov 27 12:16:38 2024
Received: from localhost ([127.0.0.1]:34429 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tGLeX-0008Cr-MI
	for submit <at> debbugs.gnu.org; Wed, 27 Nov 2024 12:16:38 -0500
Received: from mail-yw1-f179.google.com ([209.85.128.179]:57529)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <chansey97@HIDDEN>) id 1tGLeV-0008Ci-Q5
 for 74550 <at> debbugs.gnu.org; Wed, 27 Nov 2024 12:16:36 -0500
Received: by mail-yw1-f179.google.com with SMTP id
 00721157ae682-6ef0c64d75cso37400737b3.2
 for <74550 <at> debbugs.gnu.org>; Wed, 27 Nov 2024 09:16:35 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1732727735; x=1733332535; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:from:to:cc:subject:date:message-id:reply-to;
 bh=7/sPUXr7+zk58+K8Yh2QJ4+NBDBsRu3cocw+nEBwlgA=;
 b=alFNb1GN8J1W/Bv/x7C9a9JB2muT/68qxfPffbe15GfwH89emz6e9WNGM2tQXFLsBa
 hg/bQ2Q3cu+6p6FAOTRdfRF5KH4mg++BCewVedW//3wDYLnNHTu7qiNPCYu1khqBqKDW
 5uLOn5u0a3yKQjG1gYgq/dgMq3/TNVSk1kLE7mYb8cPkVT4F8peQ4Y2BAcpYpy5Ybb11
 V1WwIM0Q/CG2r5f4PEgw+hHKVhQqtGwohE3cTJNZJ6avI0UZ25MdnZ3hnllMMlQ+61tn
 Q8Rw40Dptma2TJUCidBGuXumZed8q8aQnKPegyNDtLYeJ+aqzTFVv4/2B8t59cRFsSGn
 gZQQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1732727735; x=1733332535;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=7/sPUXr7+zk58+K8Yh2QJ4+NBDBsRu3cocw+nEBwlgA=;
 b=cBAxdNB72yP0eOobZF626rHO8+Kw9QNZQu3bbsN6veVSskwvMudc85xadtxo9i4uyv
 OjY8vd4ZnuxPgo1q8IYqYOGbtwLLfnOn1T5r6rZrC/QSiRGDcqKXQqwV2R9K581wlLer
 9UF3kqWK+32rPzWT54DoOebSGVprfL0Zb6SjyfadJnOmGPUqy+GrjDCVejI9YGz/mxbX
 gOGr/i0gP9BhKx4oIMJ1hHPfSQYo066EgSf9BXrTKIZygdJ/WEoBARQYSI7DXXVd0U3h
 aegKt7JEdBcVgD1aMts5/xue3MAI8j8dPa/4pf4VNQDuoaIrVD9T94WymfeVp8lOzL6O
 rkEA==
X-Gm-Message-State: AOJu0YwqD1zV6lL9i3WKTjWpGnI0ET8gVliyQmHBJjDNEtjHNJ7p6i4R
 lXInLzPhIfguWXGiabCW+aMHZQTuLjG+LMO8Iw/9x/2T0ISVeDS1g7QOUObSRbJJQ8v/txpwXrp
 rdtkFWSHEQFR+ninAIfZ50DPEr2U=
X-Gm-Gg: ASbGncsnS25lDvfmKy6BTtiNcKXl3DLxWFIKBLqIOjxT067tirSqJaT71MDX+4cMJXP
 DBnwzYs2sMwExkubFjkOaBXiFG3jhNV9AaqndCtBiqFF/pVYWdhTRfEODvV/rFbc=
X-Google-Smtp-Source: AGHT+IFfKSzzaYAK8mE+0r5+ktF3RAtpUKcQ2BMsawnyPxzPJyu5GfpSTOjIizSp9qUm9ACA5k5+cK8+LXNSssQ7VlA=
X-Received: by 2002:a05:690c:74c2:b0:6ee:9ca0:aa32 with SMTP id
 00721157ae682-6ef37289bd1mr46321707b3.36.1732727734894; Wed, 27 Nov 2024
 09:15:34 -0800 (PST)
MIME-Version: 1.0
References: <CAHWTsYnSNUYnBkoLGf+XfmfVZ9XebLq6EiCo3-K3HU47ObCuMw@HIDDEN>
 <c4ea213a-df40-b9ee-b555-6bb456da31cc@HIDDEN>
In-Reply-To: <c4ea213a-df40-b9ee-b555-6bb456da31cc@HIDDEN>
From: Siyuan Chen <chansey97@HIDDEN>
Date: Thu, 28 Nov 2024 01:15:34 +0800
Message-ID: <CAHWTsYmgo983bESi8siYZCXc+3_Znsx=jRtKaz=RYxAFLpHoDA@HIDDEN>
Subject: Re: bug#74550: eshell cannot set the environment variable PATH on
 Windows
To: Jim Porter <jporterbugs@HIDDEN>
Content-Type: multipart/alternative; boundary="00000000000021880d0627e81d9e"
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 74550
Cc: 74550 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)

--00000000000021880d0627e81d9e
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Dear Jim,

It works, thanks.

However, this seems to be a global setting only. Is there any equivalent of
with-environment-variables for exec-path?

For example, with regular shell, I can do something like:

```
(defun shell1 ()
  (interactive)
  (let ((explicit-shell-file-name "cmdproxy")
        (current-prefix-arg 4))
    (with-environment-variables (("PATH" (concat "C:/env1" path-separator
(getenv "PATH"))))
      (call-interactively 'shell))
    ))

(defun shell2 ()
  (interactive)
  (let ((explicit-shell-file-name "cmdproxy")
        (current-prefix-arg 4))
    (with-environment-variables (("PATH" (concat "C:/env2" path-separator
(getenv "PATH"))))
      (call-interactively 'shell))
    ))
```

to create two *shell* buffers with different PATH "C:/env1" and "C:/env2".

How to do the same thing in eshell?

I have tried with the following code but it doesn't work as expected.

 ```
 (defun eshell1()
  (interactive)
  (let ((exec-path (cons "C:/env1" (copy-sequence exec-path)))
        (current-prefix-arg "new"))
    (call-interactively 'eshell)))
 ```

 ```
 (defun eshell2()
  (interactive)
  (let ((exec-path (cons "C:/env2" (copy-sequence exec-path)))
        (current-prefix-arg "new"))
    (call-interactively 'eshell)))
 ```

M-x eshell1 and echo $PATH

M-x eshell2 and echo $PATH

The result is that the eshell1 buffer can show C:/env1, but eshell2 can not=
.

Thanks.

Best regards,
Siyuan Chen

On Wed, Nov 27, 2024 at 5:14=E2=80=AFAM Jim Porter <jporterbugs@HIDDEN> =
wrote:

> On 11/26/2024 12:38 PM, Siyuan Chen wrote:
> > Reproduce steps:
> >
> > 1. Emacs -Q
> >
> > 2. M-x eval-expression `(setenv "PATH" (concat "C:/env" path-separator
> > (getenv "PATH")))`
> >
> > 3. M-x eshell
> >
> > 4. In the *eshell* window, type `echo $PATH`, but the path "C:/env"
> > doesn't show in the result.
>
> Thanks for the bug report. This is an intentionally-incompatible change
> in Eshell to improve behavior with remote systems via Tramp. Here's the
> relevant section from the Emacs 29 NEWS:
>
> > *** Eshell's PATH is now derived from 'exec-path'.
> > For consistency with remote connections, Eshell now uses 'exec-path'
> > to determine the execution path on the local or remote system, instead
> > of using the PATH environment variable directly.
>
> So instead, you want to do something like '(push "C:/env" exec-path)' in
> order to update the PATH in a way where Eshell sees it.
>
>

--00000000000021880d0627e81d9e
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Dear Jim,<br></div><div dir=3D"ltr"><br></div><div di=
r=3D"ltr">It works, thanks.<br><br>However, this seems to be a global setti=
ng only. Is there any equivalent of with-environment-variables for exec-pat=
h? <br><br>For example, with regular shell, I can do something like:<br><br=
>```<br>(defun shell1 ()<br>=C2=A0 (interactive)<br>=C2=A0 (let ((explicit-=
shell-file-name &quot;cmdproxy&quot;)<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 (curre=
nt-prefix-arg 4))<br>=C2=A0 =C2=A0 (with-environment-variables ((&quot;PATH=
&quot; (concat &quot;C:/env1&quot; path-separator (getenv &quot;PATH&quot;)=
)))<br>=C2=A0 =C2=A0 =C2=A0 (call-interactively &#39;shell))<br>=C2=A0 =C2=
=A0 ))<br><br>(defun shell2 ()<br>=C2=A0 (interactive)<br>=C2=A0 (let ((exp=
licit-shell-file-name &quot;cmdproxy&quot;)<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =
(current-prefix-arg 4))<br>=C2=A0 =C2=A0 (with-environment-variables ((&quo=
t;PATH&quot; (concat &quot;C:/env2&quot; path-separator (getenv &quot;PATH&=
quot;))))<br>=C2=A0 =C2=A0 =C2=A0 (call-interactively &#39;shell))<br>=C2=
=A0 =C2=A0 ))<br>```<br>=C2=A0<br>to create two *shell* buffers with differ=
ent PATH &quot;C:/env1&quot; and &quot;C:/env2&quot;.</div><div dir=3D"ltr"=
><br></div><div dir=3D"ltr">How to do the same thing in eshell?</div><div d=
ir=3D"ltr"><br></div><div dir=3D"ltr">I have tried with the following code =
but it doesn&#39;t work as expected. <br>=C2=A0<br>=C2=A0```<br>=C2=A0(defu=
n eshell1()<br>=C2=A0 (interactive)<br>=C2=A0 (let ((exec-path (cons &quot;=
C:/env1&quot; (copy-sequence exec-path)))<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 (c=
urrent-prefix-arg &quot;new&quot;))<br>=C2=A0 =C2=A0 (call-interactively &#=
39;eshell)))<br>=C2=A0```<br>=C2=A0<br>=C2=A0```<br>=C2=A0(defun eshell2()<=
br>=C2=A0 (interactive)<br>=C2=A0 (let ((exec-path (cons &quot;C:/env2&quot=
; (copy-sequence exec-path)))<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 (current-prefi=
x-arg &quot;new&quot;))<br>=C2=A0 =C2=A0 (call-interactively &#39;eshell)))=
<br>=C2=A0```<br>=C2=A0<br>M-x eshell1 and echo $PATH<br><br>M-x eshell2 an=
d echo $PATH<br>=C2=A0</div><div dir=3D"ltr">The result is that the=20
eshell1=20

buffer can show C:/env1, but eshell2 can not.<div><span class=3D"gmail-HwtZ=
e" lang=3D"en"></span> <br></div><div>
<div>Thanks.</div><div><br></div><div>Best regards,</div><div>Siyuan Chen</=
div>

</div></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_=
attr">On Wed, Nov 27, 2024 at 5:14=E2=80=AFAM Jim Porter &lt;<a href=3D"mai=
lto:jporterbugs@HIDDEN">jporterbugs@HIDDEN</a>&gt; wrote:<br></div><b=
lockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-le=
ft:1px solid rgb(204,204,204);padding-left:1ex">On 11/26/2024 12:38 PM, Siy=
uan Chen wrote:<br>
&gt; Reproduce steps:<br>
&gt; <br>
&gt; 1. Emacs -Q<br>
&gt; <br>
&gt; 2. M-x eval-expression `(setenv &quot;PATH&quot; (concat &quot;C:/env&=
quot; path-separator <br>
&gt; (getenv &quot;PATH&quot;)))`<br>
&gt; <br>
&gt; 3. M-x eshell<br>
&gt; <br>
&gt; 4. In the *eshell* window, type `echo $PATH`, but the path &quot;C:/en=
v&quot; <br>
&gt; doesn&#39;t show in the result.<br>
<br>
Thanks for the bug report. This is an intentionally-incompatible change <br=
>
in Eshell to improve behavior with remote systems via Tramp. Here&#39;s the=
 <br>
relevant section from the Emacs 29 NEWS:<br>
<br>
&gt; *** Eshell&#39;s PATH is now derived from &#39;exec-path&#39;.<br>
&gt; For consistency with remote connections, Eshell now uses &#39;exec-pat=
h&#39;<br>
&gt; to determine the execution path on the local or remote system, instead=
<br>
&gt; of using the PATH environment variable directly.<br>
<br>
So instead, you want to do something like &#39;(push &quot;C:/env&quot; exe=
c-path)&#39; in <br>
order to update the PATH in a way where Eshell sees it.<br>
<br>
</blockquote></div></div>

--00000000000021880d0627e81d9e--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#74550; Package emacs. Full text available.

Message received at 74550 <at> debbugs.gnu.org:


Received: (at 74550) by debbugs.gnu.org; 26 Nov 2024 21:15:53 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Nov 26 16:15:53 2024
Received: from localhost ([127.0.0.1]:53347 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tG2uW-0000of-Oj
	for submit <at> debbugs.gnu.org; Tue, 26 Nov 2024 16:15:53 -0500
Received: from mail-pf1-f175.google.com ([209.85.210.175]:51482)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jporterbugs@HIDDEN>) id 1tG2uT-0000oJ-Tk
 for 74550 <at> debbugs.gnu.org; Tue, 26 Nov 2024 16:15:50 -0500
Received: by mail-pf1-f175.google.com with SMTP id
 d2e1a72fcca58-724d57a9f7cso5007025b3a.3
 for <74550 <at> debbugs.gnu.org>; Tue, 26 Nov 2024 13:15:49 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1732655684; x=1733260484; darn=debbugs.gnu.org;
 h=content-transfer-encoding:in-reply-to:from:references:to
 :content-language:subject:mime-version:date:message-id:from:to:cc
 :subject:date:message-id:reply-to;
 bh=74lf+lT2Xw4QoBS10Y7IP1kDRFEvXVEAIkul8hQ74A4=;
 b=BpKPHQndC/uJGtyHDjsFJn4zYzPbAGImfEoiKDjq4Yhabz1XGkp+dhd4eY/HRTgC9G
 PUYkqU9IxssMMKZq5HX47Aae8ExQ+a5yPHNMilAk/qD9DaDOVApcQsoWeaj+isNQKGD4
 cBmRiwCvxvcELIKYvzvueGa1JvUUcuV092PGvxF6r98Bn6eY2lmHMW/rgMTh7twsFfUm
 iPAjDlgAm49kQWVOZUm/9ch7p0oYW4CQFRMJVrUm9HUddqNVowVoeblR4leMz1uyRy0B
 YsPbmwisJo4pRvlhKrk6OsyeNQ9nUc3tcI72NQuVkJMW6D3I9z18uwTebv3AHf4QT1Xb
 WKuQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1732655684; x=1733260484;
 h=content-transfer-encoding:in-reply-to:from:references:to
 :content-language:subject:mime-version:date:message-id
 :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=74lf+lT2Xw4QoBS10Y7IP1kDRFEvXVEAIkul8hQ74A4=;
 b=Jn+Qwf5WxZ2KhTU1mwO4a2SbyvwoCU9V8pJ2vZ6JXwIH6XPJtzRGMvKWfijLvyxDU2
 XZuIvqsqUJCOPbsQK8cJ4KNrHC60ObiAbK3jDFmMz2qFdO5XLzvJIFS3peNeMeVZ/FdB
 AF9SRwqhyq8glj7dLgNJlc1+Ag//IWBmf3X6ZpBmnVFLayE7jWFZEfVsBdNawrW3oNVw
 lzPGfW5AfFdfc4cgxb+uDWjKF6C2MycTOCXe59KbRBgIEbqfybpFV5KQF3txmZge5q7D
 vspfqCK9feB3v+8+m7/cjEJqpp42GZDMMMVLJQu1Avhq40sU5LN4WL5EwZzJyRvBNbjo
 +mKg==
X-Forwarded-Encrypted: i=1;
 AJvYcCWArwfKLKFyLo3h4YBASu0lrZwt/h5t4q1Q1/piGr0yfO+1sC3t4XFmY0O3JCIHA0pWe1jRiw==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YzS+aLG2+Og1n9XJPbCWbKlgfSCK9f6EaWnLCHym7JCV5llaSxg
 86NDmfYVwcUoEMCPJ5dU8Iv4RoG9IK+hAd5eBK9OtWfWUmzQaamW
X-Gm-Gg: ASbGncvYBNcrrDWtHZJSZoYb0/JhLyD4S+YYBbK0pNC0fDfzFqUQIjA31UEdhvOk83q
 XuItPgnoPLlDmxvEsTbdWK6aQUvaHH3jD4jGSqBdW9hACqPQszCz/yxN4qRJvlFckJcn+YzTnpA
 UeMFiSazqtf9EugFRGrwPmJpCmr2OrFuuYCFYJ/142MwEVlIME/E7SWVLHwRMBBWVmC8dENFRln
 gThlOXQcKUckOhcb1o4wH2REhatZja2f2Nubat//v3vLBm2+SZQiXQI+vyni5pfFRGh+l8bolJp
 pXAk+T3K8eqZ56KvegMD0tB000g=
X-Google-Smtp-Source: AGHT+IGs5g7Y5lNmXBbR/5OsdsZBII60RjxSe28i9L9bM6sVpAlZgzeOPrlRvLsY64FcJyeXInglcQ==
X-Received: by 2002:a17:90b:4b51:b0:2ea:88d4:a0cb with SMTP id
 98e67ed59e1d1-2ee08eb2f50mr1022988a91.16.1732655683855; 
 Tue, 26 Nov 2024 13:14:43 -0800 (PST)
Received: from [192.168.1.2] (syn-023-240-098-037.res.spectrum.com.
 [23.240.98.37]) by smtp.googlemail.com with ESMTPSA id
 98e67ed59e1d1-2eb14397a6fsm9086753a91.51.2024.11.26.13.14.43
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Tue, 26 Nov 2024 13:14:43 -0800 (PST)
Message-ID: <c4ea213a-df40-b9ee-b555-6bb456da31cc@HIDDEN>
Date: Tue, 26 Nov 2024 13:14:42 -0800
MIME-Version: 1.0
Subject: Re: bug#74550: eshell cannot set the environment variable PATH on
 Windows
Content-Language: en-US
To: Siyuan Chen <chansey97@HIDDEN>, 74550 <at> debbugs.gnu.org
References: <CAHWTsYnSNUYnBkoLGf+XfmfVZ9XebLq6EiCo3-K3HU47ObCuMw@HIDDEN>
From: Jim Porter <jporterbugs@HIDDEN>
In-Reply-To: <CAHWTsYnSNUYnBkoLGf+XfmfVZ9XebLq6EiCo3-K3HU47ObCuMw@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 74550
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On 11/26/2024 12:38 PM, Siyuan Chen wrote:
> Reproduce steps:
> 
> 1. Emacs -Q
> 
> 2. M-x eval-expression `(setenv "PATH" (concat "C:/env" path-separator 
> (getenv "PATH")))`
> 
> 3. M-x eshell
> 
> 4. In the *eshell* window, type `echo $PATH`, but the path "C:/env" 
> doesn't show in the result.

Thanks for the bug report. This is an intentionally-incompatible change 
in Eshell to improve behavior with remote systems via Tramp. Here's the 
relevant section from the Emacs 29 NEWS:

> *** Eshell's PATH is now derived from 'exec-path'.
> For consistency with remote connections, Eshell now uses 'exec-path'
> to determine the execution path on the local or remote system, instead
> of using the PATH environment variable directly.

So instead, you want to do something like '(push "C:/env" exec-path)' in 
order to update the PATH in a way where Eshell sees it.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#74550; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 26 Nov 2024 20:38:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Nov 26 15:38:41 2024
Received: from localhost ([127.0.0.1]:52815 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tG2KW-0007Mm-Lj
	for submit <at> debbugs.gnu.org; Tue, 26 Nov 2024 15:38:40 -0500
Received: from lists.gnu.org ([209.51.188.17]:44286)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <chansey97@HIDDEN>) id 1tG2KU-0007Mc-AE
 for submit <at> debbugs.gnu.org; Tue, 26 Nov 2024 15:38:38 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <chansey97@HIDDEN>)
 id 1tG2KT-0001oq-Vj
 for bug-gnu-emacs@HIDDEN; Tue, 26 Nov 2024 15:38:38 -0500
Received: from mail-yw1-x112c.google.com ([2607:f8b0:4864:20::112c])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <chansey97@HIDDEN>)
 id 1tG2KS-0000R6-Jj
 for bug-gnu-emacs@HIDDEN; Tue, 26 Nov 2024 15:38:37 -0500
Received: by mail-yw1-x112c.google.com with SMTP id
 00721157ae682-6ef0c64d75cso27665407b3.2
 for <bug-gnu-emacs@HIDDEN>; Tue, 26 Nov 2024 12:38:35 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1732653515; x=1733258315; darn=gnu.org;
 h=to:subject:message-id:date:from:mime-version:from:to:cc:subject
 :date:message-id:reply-to;
 bh=O+lDxM0T7ZtI5obNtNyMBuG907gs1RlKb7DEzduQZKc=;
 b=KmCF7yMsAPPZ+yoEcjV6RbAckeJa+ekh4NoQT/0Pspuc8eiNESjxLPONKxoVtxRkir
 Ol4EU0Xnfwfw7S1A4Uhd5lWI5nf1yWT2OIG5P1QuqrxemYPWy0lA1CrwCcTFWJFPSvI6
 UwVLw2N/KrtNgoY0Sggezf1iOO0BVdoNJk0yy+Fc6JvtsLQgl2TvDq4oNuqg4VMlsotS
 vE+ngKWpaBP6VYXg0eG84VYvESN6D0FVg6OhfwtC0lRimIiv0jiU7iuN+jtfZAa64bvF
 K8kvJrB6mLmlshK3wPtfBlbDlnbE8laExTi6OxSRcLxk702D72nRXsXHD1BHpQr/SvrN
 fizg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1732653515; x=1733258315;
 h=to:subject:message-id:date:from:mime-version:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=O+lDxM0T7ZtI5obNtNyMBuG907gs1RlKb7DEzduQZKc=;
 b=bxKSiq3HuY/2U955qOh4j4o0hAOo0YNoGOrM920gfch+CxQVkdI9iwT9eNlSVL6Qrn
 6fEsrA+obbq6+CyC+zy2mzR8lCgH/C/a4NTrGtvQLiX9bRD8YnOqw29nY08F3F6yKOlo
 /ssP2pVbbZCnF4GkA4mS5eY3xk1PMEzHbqBcXT+yFB0ExmfSnKMe/LIyOL+unbVbnE/v
 QpjXxKrpUXwfUPPXrd0e40fH5mT8swQNqsrdgeYjnO4ODp2uqJ72Y9opbLmGakW4mT3L
 asim1StVHW/zR+WI51FpYx7W0d9TvXSyB/4+FbFiJCVpYa75zt0EpvRio5OgnmktaVGh
 AW3w==
X-Gm-Message-State: AOJu0YyLNOESruOZ/NvPC5nVmq/KZBs20DtfYHr55jBJh7JuTCMpl48a
 vwqYVzSxP/KzWx9qo92ErTIhNWwZYE63C9mRzNDU+p+/H0zjcb8ldxHC8ZyMVQ+CgRoKOUgIpgE
 TbNtbJ5DOJCqpaIwxzas3Up6valmpxboK
X-Gm-Gg: ASbGncs/DRx+JZABvcAEh4oaTe2b/YRp0+e8/y3saqdk6AT7PHFGRGW2+asO0cymHge
 wMAdT4mT4vOYAHFwVjBWiOesOM/GMupu5mVgvfJ+z0yFNvGlXEaB9940DORc6wsk=
X-Google-Smtp-Source: AGHT+IHbc1dDwAXnnEpouVeS74Q4kTJrDrlkEz0ZIT9zqkWcQ860HEE0Ik/TM2GvNc9Eukr8Y0T5I9EWQwYvk7bu5lg=
X-Received: by 2002:a05:690c:48c8:b0:6e2:aceb:fb34 with SMTP id
 00721157ae682-6ef371dfabcmr7442227b3.1.1732653513794; Tue, 26 Nov 2024
 12:38:33 -0800 (PST)
MIME-Version: 1.0
From: Siyuan Chen <chansey97@HIDDEN>
Date: Wed, 27 Nov 2024 04:38:30 +0800
Message-ID: <CAHWTsYnSNUYnBkoLGf+XfmfVZ9XebLq6EiCo3-K3HU47ObCuMw@HIDDEN>
Subject: eshell cannot set the environment variable PATH on Windows
To: bug-gnu-emacs@HIDDEN
Content-Type: multipart/alternative; boundary="000000000000356f760627d6d599"
Received-SPF: pass client-ip=2607:f8b0:4864:20::112c;
 envelope-from=chansey97@HIDDEN; helo=mail-yw1-x112c.google.com
X-Spam_score_int: -17
X-Spam_score: -1.8
X-Spam_bar: -
X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.1 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.1 (--)

--000000000000356f760627d6d599
Content-Type: text/plain; charset="UTF-8"

Reproduce steps:

1. Emacs -Q

2. M-x eval-expression `(setenv "PATH" (concat "C:/env" path-separator
(getenv "PATH")))`

3. M-x eshell

4. In the *eshell* window, type `echo $PATH`, but the path "C:/env" doesn't
show in the result.

P.S. I have also tried `eshell-set-path` and `with-environment-variables`,
but they cannot set PATH as well. For example,

(require 'eshell)

(defun eshell2()
  (interactive)
  (eshell-set-path '("C:/env"))
  (call-interactively 'eshell))

(defun eshell3()
  (interactive)
  (with-environment-variables (("PATH" (concat "C:/env" path-separator
(getenv "PATH"))))
    (call-interactively 'eshell)))

Emacs 29.4 on Windows 10.

Thanks.

Best regards,
Siyuan Chen

--000000000000356f760627d6d599
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Reproduce steps:<br><br>1. Emacs -Q<br><br>2. M-x eval-exp=
ression `(setenv &quot;PATH&quot; (concat &quot;C:/env&quot; path-separator=
 (getenv &quot;PATH&quot;)))`<br><br>3. M-x eshell<br><br>4. In the *eshell=
* window, type `echo $PATH`, but the path &quot;C:/env&quot; doesn&#39;t sh=
ow in the result.<br><br>P.S. I have also tried `eshell-set-path` and `with=
-environment-variables`, but they cannot set PATH  as well. For example,<br=
><div><br></div><div>(require &#39;eshell)</div><div><br></div>(defun eshel=
l2()<br>=C2=A0 (interactive)<br>=C2=A0 (eshell-set-path &#39;(&quot;C:/env&=
quot;))<br>=C2=A0 (call-interactively &#39;eshell))<br><br>(defun eshell3()=
<br>=C2=A0 (interactive)<br>=C2=A0 (with-environment-variables ((&quot;PATH=
&quot; (concat &quot;C:/env&quot; path-separator (getenv &quot;PATH&quot;))=
))<br><div>=C2=A0 =C2=A0 (call-interactively &#39;eshell)))</div><div><br><=
/div><div>
Emacs 29.4 on Windows 10.<br></div><div><br></div><div>
<div>Thanks.</div><div><br></div><div>Best regards,</div><div>Siyuan Chen</=
div>

</div><div><br></div><div><br></div></div>

--000000000000356f760627d6d599--




Acknowledgement sent to Siyuan Chen <chansey97@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#74550; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 12 Jan 2025 05:45:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.