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


View this message in rfc822 format

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

> Liu Hui <liuhui1610 <at> gmail.com> writes:
>
> Hi,
>
>> There is still a corner case: if python-shell-process-environment
>> contains an environment variable that already exists in the default
>> process-environment, the environment variable is not applied by tramp
>> for the remote Python shell. For example, the following test fails:
>>
>> FOO=1 REMOTE_TEMPORARY_FILE_DIRECTORY=/ssh:remote:/tmp/ \
>>   make python-tests SELECTOR='"python-tests-remote-env"'
>>
>> where FOO=1 is in both python-shell-process-environment and default
>> process-environment. This issue may need to be addressed in tramp.
>
> 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?

Otherwise, we have to continue using
python-shell-tramp-refresh-process-environment, which I think should
be moved from python.el to tramp?




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.