Subject: Re: bug#23186: closed (Re: bug#23186: 25.0.92; Tramp: Windows does not always set COMSPEC, tramp blows up in a string-match)

From: Michael Albinus <[email-masked]>
Date: Sun, 03 Apr 2016 17:55:29 +0200

Eli Zaretskii <[email-masked]> writes:

Hi Eli,

>> Make a proposal about a config option which could be used
>> instead of the COMSPEC env which doesn't exist in your environment. Make
>> a proposal how to avoid calling cmd.exe at all, it seems not be
>> mandatory, I believe. Propose something else what is possible.
>
> Let me try ;-)
>
> Can you (Michael) explain why does Tramp need this variable, and also
> why it needs the companion tramp-encoding-command-switch?  Why not
> just use shell-file-name and shell-command-switch?  Or, if you must
> look deeper, why not call w32-shell-name or w32-shell-dos-semantics?
> I think these already do what you need tramp-encoding-shell for, but
> maybe I'm missing something.

Well, this is set this way for decades. I don't remember the datails;
likely it was used also for other cases than just local encoding/
decoding. And don't forget, Tramp has carried a lot of compat code, back
to Emacs 21 and XEmacs. Maybe it was not possible to trust on `w32-shell-name'.

This compat code has been removed recently. So it is applicable indeed,
to use `w32-shell-name'. I've committed a patch to master, doing this. I
don't know, whether the setting for `tramp-encoding-command-switch' is
OK, 'tho.

As usual, I cannot test it for w32. Let's see, whether we get reports :-)

> If I'm right, and Tramp doesn't really need to calculate the shell's
> name separately from the rest of Emacs, then this problem will cease
> to be a "Tramp problem".  That won't solve the larger problems the OP
> would have in Emacs, but at least Tramp will no longer be accused ;-)

Agreed. This fits perfectly to the Tramp cleanup, I have applied back in
January.

Best regards, Michael.