From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Environment variables for remote processes Date: Tue, 18 Nov 2014 16:24:11 -0500 Message-ID: References: <030C5AEB-C009-4995-B153-6EECD44802C8@fb.com> <87y4rkhdt6.fsf@gmx.de> <87y4rf2jtx.fsf@gmx.de> <87r3x6eq8w.fsf@gmx.de> <87mw7rtnxg.fsf@gmx.de> <83a93rduz4.fsf@gnu.org> <87h9xxvf31.fsf_-_@gmx.de> <87mw7oe2y3.fsf@gmx.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1416345892 25165 80.91.229.3 (18 Nov 2014 21:24:52 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 18 Nov 2014 21:24:52 +0000 (UTC) Cc: Eli Zaretskii , emacs-devel@gnu.org, dpittman@fb.com To: Michael Albinus Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Nov 18 22:24:43 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XqqGJ-0007mk-LB for ged-emacs-devel@m.gmane.org; Tue, 18 Nov 2014 22:24:35 +0100 Original-Received: from localhost ([::1]:55456 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XqqGJ-0003b4-84 for ged-emacs-devel@m.gmane.org; Tue, 18 Nov 2014 16:24:35 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39459) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XqqGA-0003ax-1e for emacs-devel@gnu.org; Tue, 18 Nov 2014 16:24:33 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XqqG2-0002mC-IF for emacs-devel@gnu.org; Tue, 18 Nov 2014 16:24:25 -0500 Original-Received: from pruche.dit.umontreal.ca ([132.204.246.22]:60665) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XqqG2-0002m8-D6; Tue, 18 Nov 2014 16:24:18 -0500 Original-Received: from pastel.home (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id sAILOB3b006777; Tue, 18 Nov 2014 16:24:11 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id 15971987C; Tue, 18 Nov 2014 16:24:11 -0500 (EST) In-Reply-To: <87mw7oe2y3.fsf@gmx.de> (Michael Albinus's message of "Tue, 18 Nov 2014 20:14:28 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV5129=0 X-NAI-Spam-Version: 2.3.0.9393 : core <5129> : inlines <1538> : streams <1344756> : uri <1835209> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 132.204.246.22 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:177665 Archived-At: > That sounds terrible: two classes of citizens in > process-environment. Some of them being there before Tramp connection > happened, and some of them added later, via let-bind or permanently. 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. > How do you want to explain the difference to a user? It would make a > difference, whether an entry has been added to process-environment > before a Tramp connection, or afterwards. No, the particular time at which the Tramp connection was made shouldn't make any appreciable difference. > (let ((process-environment process-environment)) > (setenv "DISPLAY") > (process-file ...)) In my naive mental model, Tramp's implementation of `process-file' will run "env " on the remote host, so we could use "-u" to remove elements from the environment. 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". Stefan