unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Strange behaviour on Windows 10
@ 2019-09-27 12:48 Pascal Quesseveur
  2019-09-27 13:23 ` Eli Zaretskii
  2019-09-27 13:45 ` Óscar Fuentes
  0 siblings, 2 replies; 9+ messages in thread
From: Pascal Quesseveur @ 2019-09-27 12:48 UTC (permalink / raw)
  To: help-gnu-emacs

Hello,

I am encountering a strange problem with emacs on Windows 10 (perhaps
it is not related to emacs but I have not found nothing about it). I
have written a cmd script on Windows 7 which uses plink to launch a
remote command. The script works fine and I use it in emacs through
(call-process) without problems.

As Windows 10 comes with OpenSSH I decided to update my script and use
ssh instead of plink. The script works fine, but it doesn't work
anymore through (call-process). Calls to ssh cause an error:

Le chemin d'accès spécifié est introuvable.

which means the specified filepath cannot be found. ssh.exe is in
C:/Windows/System32/OpenSSH and that directory is in PATH. It seems
that when the script is activated by (call-process) it is unable to
access the C:/Windows/System32/OpenSSH directory. I made the following
test.

#+BEGIN_EXAMPLE
>type xtest.cmd
@echo off
if exist "C:\Windows\System32" (echo OK) else (echo NOK)
if exist "C:\Windows\System32\OpenSSH" (echo OK) else (echo NOK)

>xtest
OK
OK
#+END_EXAMPLE

and in emacs -Q (version 26.1):

#+BEGIN_EXAMPLE
(defun xtest()
  (interactive)
  (call-process "xtest" nil t nil))
M-x xtest
OK
NOK
#+END_EXAMPLE

The problem arises for OpenSHH directory but this is not the only
case. Directory C:\Windows\System32\Microsoft doesn't work either.
The problem is not limited to emacs as I also noted a stange behavior
from which command from EzWin:

#+BEGIN_EXAMPLE
> which --version
GNU which v2.20, Copyright (C) 1999 - 2008 Carlo Wood.
(Modified for MS-Windows/MinGW by Eli Zaretskii.)
> which ssh.exe
which: no ssh.exe in (.;C:\Program...;C:\WINDOWS\System32\OpenSSH\;...)
#+END_EXAMPLE


-- 
Pascal Quesseveur
pquessev@gmail.com




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Strange behaviour on Windows 10
  2019-09-27 12:48 Strange behaviour on Windows 10 Pascal Quesseveur
@ 2019-09-27 13:23 ` Eli Zaretskii
  2019-09-27 14:15   ` Pascal Quesseveur
  2019-09-27 13:45 ` Óscar Fuentes
  1 sibling, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2019-09-27 13:23 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Pascal Quesseveur <pquessev@gmail.com>
> Date: Fri, 27 Sep 2019 14:48:41 +0200
> 
> #+BEGIN_EXAMPLE
> >type xtest.cmd
> @echo off
> if exist "C:\Windows\System32" (echo OK) else (echo NOK)
> if exist "C:\Windows\System32\OpenSSH" (echo OK) else (echo NOK)
> 
> >xtest
> OK
> OK
> #+END_EXAMPLE
> 
> and in emacs -Q (version 26.1):
> 
> #+BEGIN_EXAMPLE
> (defun xtest()
>   (interactive)
>   (call-process "xtest" nil t nil))
> M-x xtest
> OK
> NOK
> #+END_EXAMPLE

One possible reason is that your Emacs is a 32-bit build.  Windows
silently redirects all accesses to C:\Windows\System32 from 32-bit
programs to C:\Windows\SysWOW64.  If there's no OpenSSH there, you get
an error.

> #+BEGIN_EXAMPLE
> > which --version
> GNU which v2.20, Copyright (C) 1999 - 2008 Carlo Wood.
> (Modified for MS-Windows/MinGW by Eli Zaretskii.)
> > which ssh.exe
> which: no ssh.exe in (.;C:\Program...;C:\WINDOWS\System32\OpenSSH\;...)
> #+END_EXAMPLE

This which.exe is a 32-bit program, so it gets the same treatment from
Windows.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Strange behaviour on Windows 10
  2019-09-27 12:48 Strange behaviour on Windows 10 Pascal Quesseveur
  2019-09-27 13:23 ` Eli Zaretskii
@ 2019-09-27 13:45 ` Óscar Fuentes
  1 sibling, 0 replies; 9+ messages in thread
From: Óscar Fuentes @ 2019-09-27 13:45 UTC (permalink / raw)
  To: Pascal Quesseveur; +Cc: help-gnu-emacs

Pascal Quesseveur <pquessev@gmail.com> writes:

> Hello,
>
> I am encountering a strange problem with emacs on Windows 10 (perhaps
> it is not related to emacs but I have not found nothing about it). I
> have written a cmd script on Windows 7 which uses plink to launch a
> remote command. The script works fine and I use it in emacs through
> (call-process) without problems.
>
> As Windows 10 comes with OpenSSH I decided to update my script and use
> ssh instead of plink. The script works fine, but it doesn't work
> anymore through (call-process). Calls to ssh cause an error:
>
> Le chemin d'accès spécifié est introuvable.
>
> which means the specified filepath cannot be found. ssh.exe is in
> C:/Windows/System32/OpenSSH and that directory is in PATH. It seems
> that when the script is activated by (call-process) it is unable to
> access the C:/Windows/System32/OpenSSH directory. I made the following
> test.
>
> #+BEGIN_EXAMPLE
>>type xtest.cmd
> @echo off
> if exist "C:\Windows\System32" (echo OK) else (echo NOK)
> if exist "C:\Windows\System32\OpenSSH" (echo OK) else (echo NOK)
>
>>xtest
> OK
> OK
> #+END_EXAMPLE
>
>
> and in emacs -Q (version 26.1):
>
> #+BEGIN_EXAMPLE
> (defun xtest()
>   (interactive)
>   (call-process "xtest" nil t nil))
> M-x xtest
> OK
> NOK
> #+END_EXAMPLE
>
>
> The problem arises for OpenSHH directory but this is not the only
> case. Directory C:\Windows\System32\Microsoft doesn't work either.
> The problem is not limited to emacs as I also noted a stange behavior
> from which command from EzWin:
>
> #+BEGIN_EXAMPLE
>> which --version
> GNU which v2.20, Copyright (C) 1999 - 2008 Carlo Wood.
> (Modified for MS-Windows/MinGW by Eli Zaretskii.)
>> which ssh.exe
> which: no ssh.exe in (.;C:\Program...;C:\WINDOWS\System32\OpenSSH\;...)
> #+END_EXAMPLE

Cannot reproduce the problem here with your xtest.cmd.

Probably a permissions problem. I only know the basics about Windows
access control, but maybe your Emacs executable has some attribute that
restricts the files it can see.

Can you navigate with Dired to the OpenSSH directory? If you execute
emacs.exe as Administrator, the problem persists?



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Strange behaviour on Windows 10
  2019-09-27 13:23 ` Eli Zaretskii
@ 2019-09-27 14:15   ` Pascal Quesseveur
  2019-09-27 18:26     ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Pascal Quesseveur @ 2019-09-27 14:15 UTC (permalink / raw)
  To: help-gnu-emacs

>"EZ" == Eli Zaretskii <eliz@gnu.org> writes:

  EZ> One possible reason is that your Emacs is a 32-bit build.  Windows
  EZ> silently redirects all accesses to C:\Windows\System32 from 32-bit
  EZ> programs to C:\Windows\SysWOW64.  If there's no OpenSSH there, you get
  EZ> an error.

Thank you. Yes, there is no OpenSSH dir in SysWOW64. I totally forgot
about 32/64 bits problems.

Does that mean I have to install a 64 bits emacs to make it work?


-- 
Pascal Quesseveur
pquessev@gmail.com




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Strange behaviour on Windows 10
  2019-09-27 14:15   ` Pascal Quesseveur
@ 2019-09-27 18:26     ` Eli Zaretskii
  2019-09-30  9:14       ` Pascal Quesseveur
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2019-09-27 18:26 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Pascal Quesseveur <pquessev@gmail.com>
> Date: Fri, 27 Sep 2019 16:15:36 +0200
> 
> >"EZ" == Eli Zaretskii <eliz@gnu.org> writes:
> 
>   EZ> One possible reason is that your Emacs is a 32-bit build.  Windows
>   EZ> silently redirects all accesses to C:\Windows\System32 from 32-bit
>   EZ> programs to C:\Windows\SysWOW64.  If there's no OpenSSH there, you get
>   EZ> an error.
> 
> Thank you. Yes, there is no OpenSSH dir in SysWOW64. I totally forgot
> about 32/64 bits problems.
> 
> Does that mean I have to install a 64 bits emacs to make it work?

First, did you verify that your Emacs is a 32-bit build?  What is the
value of system-configuration?

If that indeed indicates a 32-bit build, you have 2 alternatives:

  . install a 64-bit build of Emacs (this is the preferred solution,
    and will serve you better down the road)

  . continue using the 32-bit build, but make a batch file that will
    call OpenSSH, then put that batch file somewhere on PATH.  The
    batch file should have the same base name as the OpenSSH program
    you are invoking, probably ssh.cm (this assumes the corresponding
    Lisp program calls "ssh", not "ssh.exe")



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Strange behaviour on Windows 10
  2019-09-27 18:26     ` Eli Zaretskii
@ 2019-09-30  9:14       ` Pascal Quesseveur
  2019-09-30  9:27         ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Pascal Quesseveur @ 2019-09-30  9:14 UTC (permalink / raw)
  To: help-gnu-emacs

>"EZ" == Eli Zaretskii <eliz@gnu.org> writes:

  EZ> First, did you verify that your Emacs is a 32-bit build?  What is the
  EZ> value of system-configuration?

i686-w64-mingw32

  EZ>   . install a 64-bit build of Emacs (this is the preferred solution,
  EZ>     and will serve you better down the road)

  EZ>   . continue using the 32-bit build, but make a batch file that will
  EZ>     call OpenSSH, then put that batch file somewhere on PATH.  The
  EZ>     batch file should have the same base name as the OpenSSH program
  EZ>     you are invoking, probably ssh.cm (this assumes the corresponding
  EZ>     Lisp program calls "ssh", not "ssh.exe")

I am not sure it will work. The lisp program calls a script that calls
ssh. That script is unable to call ssh.exe when it is called from
emacs. It is definitely better to install a 64 bits version of emacs.

Thanks for your help.


-- 
Pascal Quesseveur
pquessev@gmail.com




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Strange behaviour on Windows 10
  2019-09-30  9:14       ` Pascal Quesseveur
@ 2019-09-30  9:27         ` Eli Zaretskii
  2019-09-30 12:47           ` Pascal Quesseveur
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2019-09-30  9:27 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Pascal Quesseveur <pquessev@gmail.com>
> Date: Mon, 30 Sep 2019 11:14:08 +0200
> 
> >"EZ" == Eli Zaretskii <eliz@gnu.org> writes:
> 
>   EZ> First, did you verify that your Emacs is a 32-bit build?  What is the
>   EZ> value of system-configuration?
> 
> i686-w64-mingw32

OK, that's a 32-bit build, allright.

>   EZ>   . continue using the 32-bit build, but make a batch file that will
>   EZ>     call OpenSSH, then put that batch file somewhere on PATH.  The
>   EZ>     batch file should have the same base name as the OpenSSH program
>   EZ>     you are invoking, probably ssh.cm (this assumes the corresponding
>   EZ>     Lisp program calls "ssh", not "ssh.exe")
> 
> I am not sure it will work. The lisp program calls a script that calls
> ssh. That script is unable to call ssh.exe when it is called from
> emacs.

"Script" meaning what here? a batch file or a Unix shell script?  In
the former case, if you put a ssh.cmd on PATH, the script will call it
instead of the missing ssh.exe

> It is definitely better to install a 64 bits version of emacs.

Of course.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Strange behaviour on Windows 10
  2019-09-30  9:27         ` Eli Zaretskii
@ 2019-09-30 12:47           ` Pascal Quesseveur
  2019-09-30 13:50             ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Pascal Quesseveur @ 2019-09-30 12:47 UTC (permalink / raw)
  To: help-gnu-emacs

>"EZ" == Eli Zaretskii <eliz@gnu.org> writes:

  EZ> "Script" meaning what here? a batch file or a Unix shell script?  In
  EZ> the former case, if you put a ssh.cmd on PATH, the script will call it
  EZ> instead of the missing ssh.exe

In that case script is a windows batch file called query-pr.cmd. The
script uses ssh to call query-pr on a Linux server. I use it in
association with gnats.el.

The query-pr.cmd script calls ssh.exe which is located in
C:\Windows\System32\OpenSSH. The exe is not found when query-pr.cmd is
called from gnats.el. I have checked with ssh.exe and with the full
path C:\Windows\System32\OpenSSH\ssh.exe.

When i replace calls to ssh by calls to plink (32 bits exe) in
query-pr.cmd everything is ok.

I will change from 32 bits to 64 bits version. Are there any
disadvantages to go with a 64 bits version of Emacs?


-- 
Pascal Quesseveur
pquessev@gmail.com




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Strange behaviour on Windows 10
  2019-09-30 12:47           ` Pascal Quesseveur
@ 2019-09-30 13:50             ` Eli Zaretskii
  0 siblings, 0 replies; 9+ messages in thread
From: Eli Zaretskii @ 2019-09-30 13:50 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Pascal Quesseveur <pquessev@gmail.com>
> Date: Mon, 30 Sep 2019 14:47:18 +0200
> 
> In that case script is a windows batch file called query-pr.cmd. The
> script uses ssh to call query-pr on a Linux server. I use it in
> association with gnats.el.
> 
> The query-pr.cmd script calls ssh.exe which is located in
> C:\Windows\System32\OpenSSH. The exe is not found when query-pr.cmd is
> called from gnats.el. I have checked with ssh.exe and with the full
> path C:\Windows\System32\OpenSSH\ssh.exe.

Strange, it should have worked, I think.

> I will change from 32 bits to 64 bits version. Are there any
> disadvantages to go with a 64 bits version of Emacs?

None that I know of, no.



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-09-30 13:50 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-27 12:48 Strange behaviour on Windows 10 Pascal Quesseveur
2019-09-27 13:23 ` Eli Zaretskii
2019-09-27 14:15   ` Pascal Quesseveur
2019-09-27 18:26     ` Eli Zaretskii
2019-09-30  9:14       ` Pascal Quesseveur
2019-09-30  9:27         ` Eli Zaretskii
2019-09-30 12:47           ` Pascal Quesseveur
2019-09-30 13:50             ` Eli Zaretskii
2019-09-27 13:45 ` Óscar Fuentes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).