Subject: Re: bug#17295: 24.3; Add TRAMP fixes for history clobbering to pretest

From: Michael Albinus <[email-masked]>
Date: Mon, 28 Apr 2014 12:07:53 +0200

Vasilij Schneidermann <[email-masked]> writes:

> Hi Michael,

Hi Vasilij,

[pls keep [email-masked] in Cc, for the archives]

> I've applied the patch successfully and did a comparision test between
> both Emacs 24.3.1 and 24.3.90. In that test I first open a file from a
> remote host via `C-x C-f /ssh:user@host:/path/to/file`, then open a
> shell, do `ssh user@host` and hit `C-p` to check whether the history
> file has been clobbered.
>
> With Emacs 24.3.1 the test output is:
>
> [user@host ~]$ exec env ENV='' PROMPT_COMMAND='' PS1=\#\$\  PS2='' PS3='' /bin/sh
>
> With the patched Emacs 24.3.90 the test output is:
>
> [user@host ~]$ exec env ENV='' HISTFILE=/dev/null PROMPT_COMMAND='' PS1=\#\$\  PS2='' PS3='' /bin/sh
>
> So, the difference seems to be an extra environment variable set.
> Clobbering on the remote side is not prevented. Perhaps it the changes
> prevent it on the local side? I'm not sure as I've only briefly looked
> at TRAMP internals and didn't understand much.

In the past, *all* Tramp commands were visible in your remote history
file. With my patch, only the very first command is still visible, the
one you have quoted. Tramp cannot avoid this behaviour, because it has
no mean to set the remote environment prior running the very first
command. You could do this yourself by creating a local ~/.ssh/environment
file, containing

HISTFILE=/dev/null

See the ssh(1) manpage for details.

The local history shall be clean, because Tramp sets $HISTFILE locally
prior to calling anything.

> Best regards
> Vasilij

Best regards, Michael.