From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.bugs Subject: bug#24478: 25.1; Regression in 25.1: .tramp_history files are littered in non-$HOME working directories Date: Tue, 11 Oct 2016 15:54:36 +0200 Message-ID: <87y41vm1nn.fsf@gmx.de> References: <8737kuan39.fsf@booking.com> <87zimzke24.fsf@gmx.de> <83int0ebfz.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1476194365 8789 195.159.176.226 (11 Oct 2016 13:59:25 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 11 Oct 2016 13:59:25 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) Cc: 24478@debbugs.gnu.org, Ted Zlatanov To: =?UTF-8?Q?=C3=86var_?= =?UTF-8?Q?Arnfj=C3=B6r=C3=B0?= Bjarmason Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Oct 11 15:59:21 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1btxaE-0008B1-5Y for geb-bug-gnu-emacs@m.gmane.org; Tue, 11 Oct 2016 15:59:06 +0200 Original-Received: from localhost ([::1]:55955 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1btxaC-00033P-Lu for geb-bug-gnu-emacs@m.gmane.org; Tue, 11 Oct 2016 09:59:04 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43585) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1btxWO-0008Q2-TR for bug-gnu-emacs@gnu.org; Tue, 11 Oct 2016 09:55:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1btxWI-0002Bg-U8 for bug-gnu-emacs@gnu.org; Tue, 11 Oct 2016 09:55:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:45678) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1btxWI-0002Ba-R2 for bug-gnu-emacs@gnu.org; Tue, 11 Oct 2016 09:55:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1btxWI-0002Qg-Fm for bug-gnu-emacs@gnu.org; Tue, 11 Oct 2016 09:55:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Michael Albinus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 11 Oct 2016 13:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24478 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 24478-submit@debbugs.gnu.org id=B24478.14761940909312 (code B ref 24478); Tue, 11 Oct 2016 13:55:02 +0000 Original-Received: (at 24478) by debbugs.gnu.org; 11 Oct 2016 13:54:50 +0000 Original-Received: from localhost ([127.0.0.1]:51867 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1btxW6-0002Q8-3y for submit@debbugs.gnu.org; Tue, 11 Oct 2016 09:54:50 -0400 Original-Received: from mout.gmx.net ([212.227.17.22]:57757) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1btxW3-0002Pu-Ib for 24478@debbugs.gnu.org; Tue, 11 Oct 2016 09:54:48 -0400 Original-Received: from detlef.gmx.de ([87.146.44.182]) by mail.gmx.com (mrgmx102) with ESMTPSA (Nemesis) id 0LqF9o-1bGF2d1bfM-00dlw2; Tue, 11 Oct 2016 15:54:39 +0200 In-Reply-To: ("=?UTF-8?Q?=C3=86var_?= =?UTF-8?Q?Arnf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MdaGfVyu87OS5tMxDr F8fQx5eI6ddWg1Sihf+pyxjiCRo2DGZnx+3AhV+ZTBNDG7hfQWjEEPVFPUySq9ToJ/jl9YOX X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:124332 Archived-At: =C3=86var Arnfj=C3=B6r=C3=B0 Bjarmason writes: Hi =C3=86var, > I'm the reporter, so I obviously have a dog in this fight, but I don't > think that makes sense. This whole facility introduced in the emacs-25 > series still seems really broken since its introduction, and the > various regressions reported have just resulted in other regressions > taking their place, the latest one being discussed in this ticket. I'm also unhappy about this story. I really would like to use a proper and robust default value for this. But there isn't one so far. > * In emacs-24 there was no way to have a Tramp history file, we'd > just specify a HISTFILE=3D/dev/null environment variable. This was introduced back in 2014. Before this change, HISFILE was unset somewhere else in the initialization hand-shake, but at a later point. It didn't work properly then. > * 9be1538 added an option to change that, so you could have a history > file as a file, defaulting to /dev/null, but they way it was > implemented caused it to unlink /dev/null, as reported in > https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D19731 Bug#19371 has reported, that there is a bash bug which has this effect. It is no Tramp error, and I would regard this setting still be the best one if possible. But due to this bash bug, this setting would damage the remote system. So we cannot use "/dev/null" as default, even if the bash bug has been fixed. There will still be system in the wild with this bug. > * So Michael patched it to make 'unset an option, which was > implemented in 6f8372d, as far as I can tell at this point the > facility worked the way it did in emacs-24 again. I.e. no history by > default, but no regression with unlinking /dev/null > > * 'unset was made the default by Michael in 954ca0f, but just a few > hours later this was set to t instead in c10828b, which does the same > thing as 'unset according to the commit message. I.e. just an internal > refactoring. This was followed-up by 24fa4ff to refactor it some more. Yes. > * It was then changed from t to ".tramp_history" in 1e04ea9. The > commit message says to fix > https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D20446 but I don't see > how it could eat the bash history if it's set to not have any history > file by default. Glenn did report, that in his use case unsetting HISTFILE has changed his ~/.bash_history to a zero size. Not acceptable, and again a special behaviour of bash :-( So the only solution I could thing about is setting this variable to a Tramp specific value. > * Now because it's ".tramp_history" and not "~/.tramp_history" it gets > created in random non-~ directories you open with tramp, but more > importantly, and I didn't realize this in my initial report, the shell > history *might be shared between multiple users*, which seems like a > bad security issue. "~/.tramp_history" would be the obvious choice, but "~/" is not guaranteed to exist. An example is hydra, were the tests failed with this setting. > It seems to me that the best solution to this whole problem is to set > it to "t" again which would return to the non-history days of > emacs-24, since apparently using ~ can't be counted on. How do you want explain it to bash users like Glenn? Their history file will get lost, again. > In addition, depending on the bug with history potentially being > shared between users now that it's being dumped in random potentially > shared FS directories they open with tramp, changing this to > ".tramp_history" might have caused a security issue worth of a CVE, > but I haven't investigated that, but we *certainly* went from no > history by default in emacs-24 to history littered in potentially > world readable directories in emacs-25. I still don't understand why the ".tramp_history" file is spread over the file system. This setting is apllied immediately after connecting to the remote host. I would assume that one lands in the home directory there; ".tramp_history" should be expanded relatively to that directory. Could you show hot it happens to you that it is expanded to another place? Pls run Tramp from scratch, after increasing the debug level by (setq tramp-verbose 6) There will be a Tramp debug buffer, which might tell us what happens. Best regards, Michael.