unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#30419: tramp-sh-process-file: effect of tramp-remote-process-environment vs non-top level value of process-environment
@ 2018-02-11  2:11 Noam Postavsky
  2018-02-11  9:37 ` Michael Albinus
  0 siblings, 1 reply; 5+ messages in thread
From: Noam Postavsky @ 2018-02-11  2:11 UTC (permalink / raw)
  To: 30419; +Cc: michael albinus

X-Debbugs-CC: Michael Albinus <michael.albinus@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?






^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#30419: tramp-sh-process-file: effect of tramp-remote-process-environment vs non-top level value of process-environment
  2018-02-11  2:11 bug#30419: tramp-sh-process-file: effect of tramp-remote-process-environment vs non-top level value of process-environment Noam Postavsky
@ 2018-02-11  9:37 ` Michael Albinus
  2018-02-11 14:28   ` Noam Postavsky
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Albinus @ 2018-02-11  9:37 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: 30419

Noam Postavsky <npostavs@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.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#30419: tramp-sh-process-file: effect of tramp-remote-process-environment vs non-top level value of process-environment
  2018-02-11  9:37 ` Michael Albinus
@ 2018-02-11 14:28   ` Noam Postavsky
  2018-02-12  8:52     ` Michael Albinus
  0 siblings, 1 reply; 5+ messages in thread
From: Noam Postavsky @ 2018-02-11 14:28 UTC (permalink / raw)
  To: Michael Albinus; +Cc: 30419

[-- Attachment #1: Type: text/plain, Size: 518 bytes --]

tags 30419 + patch
quit

Michael Albinus <michael.albinus@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:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 2285 bytes --]

From 9cafeec6027947e28e3f54ffc7f975a4845227de Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* bug#30419: tramp-sh-process-file: effect of tramp-remote-process-environment vs non-top level value of process-environment
  2018-02-11 14:28   ` Noam Postavsky
@ 2018-02-12  8:52     ` Michael Albinus
  2018-02-13  0:28       ` Noam Postavsky
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Albinus @ 2018-02-12  8:52 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: 30419

Noam Postavsky <npostavs@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.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#30419: tramp-sh-process-file: effect of tramp-remote-process-environment vs non-top level value of process-environment
  2018-02-12  8:52     ` Michael Albinus
@ 2018-02-13  0:28       ` Noam Postavsky
  0 siblings, 0 replies; 5+ messages in thread
From: Noam Postavsky @ 2018-02-13  0:28 UTC (permalink / raw)
  To: Michael Albinus; +Cc: 30419

close 30419 26.1
quit

Michael Albinus <michael.albinus@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





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-02-13  0:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-11  2:11 bug#30419: tramp-sh-process-file: effect of tramp-remote-process-environment vs non-top level value of process-environment Noam Postavsky
2018-02-11  9:37 ` Michael Albinus
2018-02-11 14:28   ` Noam Postavsky
2018-02-12  8:52     ` Michael Albinus
2018-02-13  0:28       ` Noam Postavsky

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).