GNU bug report logs - #79413
[PATCH] Fix path and environment in remote Python shell

Previous Next

Package: emacs;

Reported by: Liu Hui <liuhui1610 <at> gmail.com>

Date: Tue, 9 Sep 2025 09:54:01 UTC

Severity: normal

Tags: patch

Full log


Message #14 received at 79413 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Liu Hui <liuhui1610 <at> gmail.com>
Cc: 79413 <at> debbugs.gnu.org
Subject: Re: bug#79413: [PATCH] Fix path and environment in remote Python shell
Date: Wed, 10 Sep 2025 10:46:48 +0200
Liu Hui <liuhui1610 <at> gmail.com> writes:

Hi,

>> This is a Tramp feature. See this comment in tramp-handle-make-process,
>> tramp-sh-handle-make-process and tramp-sh-handle-process-file:
>>
>> --8<---------------cut here---------------start------------->8---
>> 	   ;; We use as environment the difference to toplevel
>> 	   ;; `process-environment'.
>> --8<---------------cut here---------------end--------------->8---
>>
>> The reason is, that often a local value of $FOO might be wrong on the
>> remote host.
>
> Thanks for the explanation. Then let-binding process-environment is
> not a reliable way if we want to ensure some environment variables,
> python-shell-process-environment in this case, are applied to the
> remote process.
>
> Could tramp add an option that disables this feature temporarily or
> ensures specific environment variables are always applied in
> tramp-sh-handle-make-process and tramp-sh-handle-process-file?

You would run into the same problem why this feature exist. You don't
want to expand local environment variables like DISPLAY, SSH_* or
whatever to the remote host.

You could let-bind and modify tramp-remote-process-environment for
tramp-sh-handle-make-process. Note, that this won't work for direct
async processes, which use tramp-handle-make-process internally. And it
won't work for tramp-sh-handle-process-file.

Alternatively, you could call "env VAR1=VAL1 VAR2=VAL2 ... program ..."
instead of "program ...".

Best regards, Michael.




This bug report was last modified 2 days ago.

Previous Next


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