Subject: Re: bug#24478: 25.1; Regression in 25.1: .tramp_history files are littered in non-$HOME working directories

From: Michael Albinus <[email-masked]>
Date: Thu, 22 Sep 2016 20:02:59 +0200

Ævar Arnfjörð Bjarmason <[email-masked]> writes:

Hi,

> There's a regression in 25.1 introduced by 1e04ea9 (although that seems
> to also have fixed an issue): Now tramp-histfile-override is set to
> ".tramp_history", which is good, but I would expect it to be created in
> $HOME on remote hosts.
>
> Instead when I e.g.:
>
>  1. C-x C-f //ssh:<hostname>:/usr/local/git_tree/sysadmin/
>  2. Run e.g. magit to make a commit
>  3. I end up with:
>
>     $ echo $PWD/.tramp_history
>     /usr/local/git_tree/sysadmin/.tramp_history
>     $ wc -l !$
>     wc -l $PWD/.tramp_history
>     34 /usr/local/git_tree/sysadmin/.tramp_history

Most of the shells I know off use the home directory, when you specify
just the relative file name ".tramp_history".

> From reading https://debbugs.gnu.org/cgi/bugreport.cgi?bug=20446 and
> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=19731#56 this seems like
> an unintended bug.
>
> Just setting:
>
>     (setq tramp-histfile-override "~/.tramp_history")
>
> Works for me. Now it's always created in ~.

I have thought about this, when I was fixing bug#19731. Unfortunately,
there exist shells which cannot expand "~/". Other shells cannot expand
"$HOME/". So I really don't know a robust default we could offer.

Maybe one should give this problem more emphasis in the Tramp
manual. But who reads manuals?

Best regards, Michael.