all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Jerry Asher <ja2038@gmail.com>
Cc: 23186@debbugs.gnu.org
Subject: bug#23186: 25.0.92; Tramp: Windows does not always set COMSPEC, tramp blows up in a string-match
Date: Sun, 03 Apr 2016 17:51:58 +0300	[thread overview]
Message-ID: <83egamrbht.fsf@gnu.org> (raw)
In-Reply-To: <CACTc7Z=D-2pS4g=_KtKm1N+f21ThRp_-Ep-CBGjPUa=SuhkdCQ@mail.gmail.com> (message from Jerry Asher on Sat, 2 Apr 2016 09:06:57 -0700)

> From: Jerry Asher <ja2038@gmail.com>
> Date: Sat, 2 Apr 2016 09:06:57 -0700
> 
> The problem is that Windows can sometimes (see caveat below) start emacs such that COMSPEC is not defined.

(The caveat being that the OP poked the PE headers of the Emacs binary
to change its subsystem from 'console' to 'windows'.)

FWIW, I cannot reproduce this problem.  I've compiled a simple Windows
GUI program that calls 'getenv', and it can access the COMSPEC
variable without any trouble.  I also used 'objcopy' to change the
subsystem of the Emacs executable to 'windows' (which should have the
same effect as what the OP did with a Python script), and the
resulting executable does have COMSPEC in the environment when it
starts.

So I'm quite sure some other factor is at work here, most probably
something in the user customizations.  Looking at the value of
process-environment after starting "emacs -Q" should be the first step
for investigating the reasons for this behavior.  If COMSPEC is not
there in "emacs -Q", the next step is to describe the local
configuration with system shells; if it is, look at your
customizations in ~/.emacs and elsewhere.

> Once more, I am not a windows developer, you are the maintainer, I have reported a bug, a bug felt not just by me but by many others, the current code, which sets it to NIL is 10,000% guaranteed to be wrong, since you REJECTED my proposed suggestion which would seem to work in most cases and be a great place to start,
> 
> Here are a list of many other people who see this bug:
> https://www.google.com/search?q=emacs+cmd.exe+tramp-encoding-shell+string-match

The relevant hits of this Google search seems to point to just 2
reports, both of them look like they are related to magit.  (Another
report, where it turns out the user tried to use PowerShell as the
system shell, can be disregarded as a situation that will never work
on Windows without a lot of tinkering.)  I didn't find any such issue
in the magit issue tracker, so I'm not sure what's going on there.  I
suspect something related to the local setup with shells, perhaps, or
maybe something related to Python mode.

In any case, these reports don't seem to provide any useful
information about the reason for the problem, as they all end in the
user using the Tramp customizations to set tramp-encoding-shell
directly, which btw is an okay solution, it just cannot be used in the
default value of the defcustom, for the reasons explained up-thread.

Last, but not least: COMSPEC is used in Emacs by more than just Tramp.
For example, using M-! etc. to run commands that require a shell will
not work without COMSPEC in the environment, because cmdproxy.exe uses
the same method to find cmd.exe that Tramp does, and will fail if it
cannot find it.  So the Tramp problem is just the tip of a rather
large iceberg.

To summarize:

  . making Emacs a GUI app doesn't in itself interfere with COMSPEC
  . without COMSPEC in the environment many other Emacs features will fail
  . more information about the OP's setup is required to understand
    the reason(s) for the problem





      parent reply	other threads:[~2016-04-03 14:51 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-02 16:06 bug#23186: 25.0.92; Tramp: Windows does not always set COMSPEC, tramp blows up in a string-match Jerry Asher
2016-04-02 16:44 ` Eli Zaretskii
2016-04-02 17:26   ` Eli Zaretskii
2016-04-02 19:37   ` Michael Albinus
2016-04-02 20:03     ` Eli Zaretskii
2016-04-02 20:21       ` Jerry Asher
2016-04-02 20:29         ` Eli Zaretskii
2016-04-03  7:05         ` Michael Albinus
     [not found] ` <handler.23186.D23186.145961804117806.notifdone@debbugs.gnu.org>
2016-04-02 17:32   ` bug#23186: closed (Re: bug#23186: 25.0.92; Tramp: Windows does not always set COMSPEC, tramp blows up in a string-match) Jerry Asher
2016-04-02 17:37     ` Jerry Asher
2016-04-02 17:50       ` Jerry Asher
2016-04-02 19:47         ` Michael Albinus
2016-04-02 20:02           ` Eli Zaretskii
2016-04-02 20:19             ` Jerry Asher
2016-04-02 20:33               ` Eli Zaretskii
2016-04-02 20:11           ` bug#23186: closed (Re: " Jerry Asher
2016-04-02 20:28             ` Eli Zaretskii
2016-04-03  7:15               ` Michael Albinus
2016-04-02 21:35             ` John Wiegley
2016-04-03 14:54           ` Eli Zaretskii
2016-04-03 15:55             ` Michael Albinus
2016-04-03 16:17               ` Eli Zaretskii
2016-04-03 16:49                 ` Michael Albinus
2016-04-03 14:51 ` Eli Zaretskii [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83egamrbht.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=23186@debbugs.gnu.org \
    --cc=ja2038@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.