unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Michael Albinus <michael.albinus@gmx.de>
To: Stefan Monnier <monnier@IRO.UMontreal.CA>
Cc: Eli Zaretskii <eliz@gnu.org>, emacs-devel@gnu.org, dpittman@fb.com
Subject: Re: Environment variables for remote processes
Date: Tue, 18 Nov 2014 22:45:46 +0100	[thread overview]
Message-ID: <87h9xwdvxx.fsf@gmx.de> (raw)
In-Reply-To: <jwvwq6sgqjh.fsf-monnier+emacsbugs@gnu.org> (Stefan Monnier's message of "Tue, 18 Nov 2014 16:24:11 -0500")

Stefan Monnier <monnier@IRO.UMontreal.CA> writes:

> Not sure what you mean by "before Tramp connection".  The issue is what
> environment to give to the command run via `process-file'.
> Whether there's a pre-existing Tramp connection or not is an
> implementation detail of Tramp.  But the semantics of `process-file' is
> clearly that it should receive in its environment the things that are in
> `process-environment', and currently Tramp fails to obey this part of
> the semantics of `process-file'.
>
> Of course, it wouldn't be correct to inherit the whole of
> `process-environment' either.  And of course, I understand that
> implementing this environment handling might take more than a quick
> half-hour hack.

It's not so simple to decide what's appropriate settings. You do NOT
want to propagate all your local environment variables to the remote
process. Your local settings of DISPLAY or DBUS_SESSION_BUS_ADDRESS, to
give prominent examples, would confuse your remote process heavily.

And there might be application specific environment variables we've
never heard about, which could damage the remote process as well.

How to decide what's appropriate for the remote process? I don't know.

> In my naive mental model, Tramp's implementation of `process-file' will
> run "env <ENVVARS> <COMMAND>" on the remote host, so we could use "-u"
> to remove elements from the environment.

No. With a sufficient amount of environment variables, you would exceed
the maximum length of shell command lines. Tramp did it several times
already, and I had to work-around that. Then "env ..." construct is
applicable only, when you know in advance that there aren't too many settings.

> But let's start by handling additions, and then we'll see if/when we need to
> handle removals.
>
>>>> Furthermore, some remote settings might be requested which are not in
>>>> process-environment by default.
>>> Not sure what you're referring to here, but it seems like a different
>>> issue than the one at hand (which is to propagate let-bound
>>> process-environment values).
>> I'm speaking about tramp-remote-process-environment, which uses another
>> mechanism. But if we have an accepted mechanism for environment
>> variables on remote hosts, there shall be only The One Way to set them.
>
> So it does seem like a completely different issue.  What I'm concerned
> here is about the environment that is "per subprocess" rather than "per
> connection".

Yes, but here we must speak about implementation. Tramp opens a
connection (a shell) on the remote host, and sends all its internal
commands via this shell. It sends also the command intended for
process-file to that shell. It does *not* open a new (sub)process, which
could inherit environment variables from Emacs, and alike. The
environment is the same as when that shell has been started. That's why
it is, at least as of today, "per connection".

>         Stefan

Best regards, Michael.



  reply	other threads:[~2014-11-18 21:45 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <030C5AEB-C009-4995-B153-6EECD44802C8@fb.com>
     [not found] ` <87y4rkhdt6.fsf@gmx.de>
     [not found]   ` <87y4rf2jtx.fsf@gmx.de>
     [not found]     ` <jwv4mu3rniq.fsf-monnier+emacsbugs@gnu.org>
     [not found]       ` <87r3x6eq8w.fsf@gmx.de>
     [not found]         ` <jwvh9y23640.fsf-monnier+emacsbugs@gnu.org>
     [not found]           ` <87mw7rtnxg.fsf@gmx.de>
     [not found]             ` <83a93rduz4.fsf@gnu.org>
     [not found]               ` <jwv4mtyua90.fsf-monnier+emacsbugs@gnu.org>
2014-11-17 18:48                 ` Environment variables for remote processes (was: bug#18940: 24.4; vc-hg does not disable pager, leading to hangs (at least with tramp)) Michael Albinus
2014-11-18  2:15                   ` Environment variables for remote processes Stefan Monnier
2014-11-18 19:14                     ` Michael Albinus
2014-11-18 21:24                       ` Stefan Monnier
2014-11-18 21:45                         ` Michael Albinus [this message]
2014-11-19  3:16                           ` Stefan Monnier
2014-11-19 15:12                             ` andres.ramirez
2014-11-23 10:22                               ` Michael Albinus
2014-11-19 18:18                             ` Michael Albinus
2014-11-19 18:31                               ` Michael Albinus
2014-11-20  4:29                               ` Stefan Monnier
2014-11-20 15:52                                 ` Michael Albinus
2014-11-21  2:46                                   ` Stefan Monnier
2014-11-22 11:43                                     ` Michael Albinus
2014-11-22 16:33                                       ` Stefan Monnier
2014-11-22 16:49                                         ` Michael Albinus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h9xwdvxx.fsf@gmx.de \
    --to=michael.albinus@gmx.de \
    --cc=dpittman@fb.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@IRO.UMontreal.CA \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).