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 22:16:14 -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> <87h9xwdvxx.fsf@gmx.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1416367018 24779 80.91.229.3 (19 Nov 2014 03:16:58 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 19 Nov 2014 03:16:58 +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 Wed Nov 19 04:16:51 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 1XqvlC-0003Lx-Tb for ged-emacs-devel@m.gmane.org; Wed, 19 Nov 2014 04:16:51 +0100 Original-Received: from localhost ([::1]:56324 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XqvlC-0005cy-GF for ged-emacs-devel@m.gmane.org; Tue, 18 Nov 2014 22:16:50 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50899) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xqvkr-0005ce-UU for emacs-devel@gnu.org; Tue, 18 Nov 2014 22:16:37 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xqvkk-0008TG-Dy for emacs-devel@gnu.org; Tue, 18 Nov 2014 22:16:29 -0500 Original-Received: from chene.dit.umontreal.ca ([132.204.246.20]:44850) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xqvkk-0008SE-7j; Tue, 18 Nov 2014 22:16:22 -0500 Original-Received: from pastel.home (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id sAJ3GEM9010400; Tue, 18 Nov 2014 22:16:15 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id C80C3987C; Tue, 18 Nov 2014 22:16:14 -0500 (EST) In-Reply-To: <87h9xwdvxx.fsf@gmx.de> (Michael Albinus's message of "Tue, 18 Nov 2014 22:45:46 +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 <1539> : streams <1344888> : uri <1835241> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 132.204.246.20 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:177704 Archived-At: > 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. Check again: these will not be present in "the difference between process-environment and (default-toplevel-value 'process-environment)". >> 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. > 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 whichever other scheme we end up using, removing env-vars shouldn't be any harder than adding some. > 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". I know that. That's why I suggested to send "env ". Another option might be: (export VAR1=VAL1 unset VAR2 export VAR3=VAL3 ... ) -- Stefan