GNU bug report logs - #30419
tramp-sh-process-file: effect of tramp-remote-process-environment vs non-top level value of process-environment

Previous Next

Package: emacs;

Reported by: Noam Postavsky <npostavs <at> users.sourceforge.net>

Date: Sun, 11 Feb 2018 02:12:01 UTC

Severity: minor

Tags: patch

Fixed in version 26.1

Done: Noam Postavsky <npostavs <at> users.sourceforge.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 30419 in the body.
You can then email your comments to 30419 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to michael.albinus <at> gmx.de, bug-gnu-emacs <at> gnu.org:
bug#30419; Package emacs. (Sun, 11 Feb 2018 02:12:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Noam Postavsky <npostavs <at> users.sourceforge.net>:
New bug report received and forwarded. Copy sent to michael.albinus <at> gmx.de, bug-gnu-emacs <at> gnu.org. (Sun, 11 Feb 2018 02:12:02 GMT) Full text and rfc822 format available.

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

From: Noam Postavsky <npostavs <at> users.sourceforge.net>
To: bug-gnu-emacs <at> gnu.org
Subject: tramp-sh-process-file: effect of tramp-remote-process-environment vs
 non-top level value of process-environment
Date: Sat, 10 Feb 2018 21:11:03 -0500
X-Debbugs-CC: Michael Albinus <michael.albinus <at> gmx.de>
Severity: minor

`(tramp) Remote processes' says:

       TRAMP does not use the defaults specified in `process-environment'
    for running `process-file' or `start-file-process' on remote hosts.
    When values from `process-environment' are needed for remote processes,
    then set them as follows:

         (let ((process-environment (cons "HGPLAIN=1" process-environment)))
           (process-file ...))

       This works only for environment variables not already set in the
    `process-environment'.

I'm confused as to why the environment variables aren't controlled by
tramp-remote-process-environment.  Or is that in addition to the effect
of tramp-remote-process-environment?  Does one take precedence over the
other?





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30419; Package emacs. (Sun, 11 Feb 2018 09:38:01 GMT) Full text and rfc822 format available.

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

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Noam Postavsky <npostavs <at> users.sourceforge.net>
Cc: 30419 <at> debbugs.gnu.org
Subject: Re: bug#30419: tramp-sh-process-file: effect of
 tramp-remote-process-environment vs non-top level value of
 process-environment
Date: Sun, 11 Feb 2018 10:37:23 +0100
Noam Postavsky <npostavs <at> users.sourceforge.net> writes:

Hi Noam,

> `(tramp) Remote processes' says:
>
>        TRAMP does not use the defaults specified in `process-environment'
>     for running `process-file' or `start-file-process' on remote hosts.
>     When values from `process-environment' are needed for remote processes,
>     then set them as follows:
>
>          (let ((process-environment (cons "HGPLAIN=1" process-environment)))
>            (process-file ...))
>
>        This works only for environment variables not already set in the
>     `process-environment'.
>
> I'm confused as to why the environment variables aren't controlled by
> tramp-remote-process-environment.  Or is that in addition to the effect
> of tramp-remote-process-environment?  Does one take precedence over the
> other?

`tramp-remote-process-environment' is still in play. The let-bound
environment variables from `process-environment' are taken additionally,
and afterwards. So they would have precedence.

See bug#18940. The major reasoning is, that other packages do not want
to preload Tramp in order to set `tramp-remote-process-environment',
even if Tramp isn't used ever.

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30419; Package emacs. (Sun, 11 Feb 2018 14:29:02 GMT) Full text and rfc822 format available.

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

From: Noam Postavsky <npostavs <at> users.sourceforge.net>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 30419 <at> debbugs.gnu.org
Subject: Re: bug#30419: tramp-sh-process-file: effect of
 tramp-remote-process-environment vs non-top level value of
 process-environment
Date: Sun, 11 Feb 2018 09:28:09 -0500
[Message part 1 (text/plain, inline)]
tags 30419 + patch
quit

Michael Albinus <michael.albinus <at> gmx.de> writes:

> `tramp-remote-process-environment' is still in play. The let-bound
> environment variables from `process-environment' are taken additionally,
> and afterwards. So they would have precedence.
>
> See bug#18940. The major reasoning is, that other packages do not want
> to preload Tramp in order to set `tramp-remote-process-environment',
> even if Tramp isn't used ever.

Thanks, I propose the following patch to the manual to clarify this:

[v1-0001-Clarify-TRAMP-process-environment-interaction-Bug.patch (text/x-diff, inline)]
From 9cafeec6027947e28e3f54ffc7f975a4845227de Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs <at> gmail.com>
Date: Sun, 11 Feb 2018 09:20:29 -0500
Subject: [PATCH v1] Clarify TRAMP process-environment interaction (Bug#30419)

* doc/misc/tramp.texi (Remote processes): Index the
tramp-remote-process-environment description.  Clarify the effects of
let-binding process-environment and the motivation for that behavior.
---
 doc/misc/tramp.texi | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi
index 25ae8ae3e8..4723547419 100644
--- a/doc/misc/tramp.texi
+++ b/doc/misc/tramp.texi
@@ -2596,6 +2596,7 @@ Remote processes
 @end group
 @end lisp
 
+@vindex tramp-remote-process-environment
 Customize user option @option{tramp-remote-process-environment} to
 suit the remote program's environment for the remote host.
 @option{tramp-remote-process-environment} is a list of strings
@@ -2641,11 +2642,13 @@ Remote processes
 @end group
 @end lisp
 
-@value{tramp} does not use the defaults specified in
-@code{process-environment} for running @code{process-file} or
-@code{start-file-process} on remote hosts.  When values from
-@code{process-environment} are needed for remote processes, then set
-them as follows:
+In addition to @option{tramp-remote-process-environment}, you can set
+environment variables for invidivual remote process calls by
+let-binding @code{process-environment}.  @value{tramp} will apply any
+entries which are not present in the global default value of
+@code{process-environment} (overriding
+@option{tramp-remote-process-environment} settings, if they conflict).
+For example:
 
 @lisp
 @group
@@ -2654,8 +2657,10 @@ Remote processes
 @end group
 @end lisp
 
-This works only for environment variables not already set in the
-@code{process-environment}.
+Let-binding in this way works regardless of whether the process to be
+called is local or remote, since @value{tramp} would add just the
+@code{HGPLAIN} setting and local processes would take whole value of
+@code{process-environment} along with the new value of @code{HGPLAIN}.
 
 For integrating other Emacs packages so @value{tramp} can execute
 remotely, please file a bug report.  @xref{Bug Reports}.
-- 
2.11.0


Added tag(s) patch. Request was from Noam Postavsky <npostavs <at> users.sourceforge.net> to control <at> debbugs.gnu.org. (Sun, 11 Feb 2018 14:29:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30419; Package emacs. (Mon, 12 Feb 2018 08:53:01 GMT) Full text and rfc822 format available.

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

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Noam Postavsky <npostavs <at> users.sourceforge.net>
Cc: 30419 <at> debbugs.gnu.org
Subject: Re: bug#30419: tramp-sh-process-file: effect of
 tramp-remote-process-environment vs non-top level value of
 process-environment
Date: Mon, 12 Feb 2018 09:52:38 +0100
Noam Postavsky <npostavs <at> users.sourceforge.net> writes:

Hi Noam,

> Thanks, I propose the following patch to the manual to clarify this:

Please use @env{HGPLAIN} instead of @code{HGPLAIN}. Otherwise, it
LGTM. Please push to the emacs-26 branch.

Thanks, and best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30419; Package emacs. (Tue, 13 Feb 2018 00:29:01 GMT) Full text and rfc822 format available.

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

From: Noam Postavsky <npostavs <at> users.sourceforge.net>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 30419 <at> debbugs.gnu.org
Subject: Re: bug#30419: tramp-sh-process-file: effect of
 tramp-remote-process-environment vs non-top level value of
 process-environment
Date: Mon, 12 Feb 2018 19:28:24 -0500
close 30419 26.1
quit

Michael Albinus <michael.albinus <at> gmx.de> writes:

> Please use @env{HGPLAIN} instead of @code{HGPLAIN}. Otherwise, it
> LGTM. Please push to the emacs-26 branch.

Done.

[1: 96b6e243ec]: 2018-02-12 19:25:09 -0500
  Clarify TRAMP process-environment interaction (Bug#30419)
  https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=96b6e243ec006b6c69642506a4f470aa5878e299




bug marked as fixed in version 26.1, send any further explanations to 30419 <at> debbugs.gnu.org and Noam Postavsky <npostavs <at> users.sourceforge.net> Request was from Noam Postavsky <npostavs <at> users.sourceforge.net> to control <at> debbugs.gnu.org. (Tue, 13 Feb 2018 00:29:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 13 Mar 2018 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 7 years and 185 days ago.

Previous Next


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