unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#36270: executable-find does not find shell commands on MSYS2
@ 2019-06-17 23:42 Juanma Barranquero
  2019-06-18  0:23 ` Glenn Morris
  0 siblings, 1 reply; 9+ messages in thread
From: Juanma Barranquero @ 2019-06-17 23:42 UTC (permalink / raw)
  To: 36270

c:\Tools\msys64 is the root of my MSYS2 / MingW64 installation.

From the mingw64 console:

Juanma@ODIEFAST MINGW64 /d/Devel/emacs/repo/trunk
$ mount
C:/Tools/msys64 on / type ntfs (binary,noacl,auto)
C:/Tools/msys64/usr/bin on /bin type ntfs (binary,noacl,auto)
C: on /c type ntfs (binary,noacl,posix=0,user,noumount,auto)

Juanma@ODIEFAST MINGW64 /d/Devel/emacs/repo/trunk
$ which ci
/usr/bin/ci

Juanma@ODIEFAST MINGW64 /d/Devel/emacs/repo/trunk
$ ls -l /usr/bin/ci
-rwxr-xr-x 1 Juanma Juanma 806 Jun  1  2017 /usr/bin/ci

Juanma@ODIEFAST MINGW64 /d/Devel/emacs/repo/trunk
$ file /usr/bin/ci
/usr/bin/ci: POSIX shell script, ASCII text executable

Juanma@ODIEFAST MINGW64 /d/Devel/emacs/repo/trunk
$ ci --version
ci (GNU RCS) 5.9.4
Copyright (C) 2010-2017 Thien-Thi Nguyen
Copyright (C) 1990-1995 Paul Eggert
Copyright (C) 1982,1988,1989 Walter F. Tichy, Purdue CS
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.



Then, from Emacs (master or release branch):

ELISP> (setq shell-file-name "c:/Tools/msys64/usr/bin/bash.exe")
"c:/Tools/msys64/usr/bin/bash.exe"
ELISP> (shell-command-to-string "ci --version")
"ci (GNU RCS) 5.9.4
Copyright (C) 2010-2017 Thien-Thi Nguyen
Copyright (C) 1990-1995 Paul Eggert
Copyright (C) 1982,1988,1989 Walter F. Tichy, Purdue CS
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
"
ELISP> (executable-find "ci")
nil
ELISP> (locate-file "ci" exec-path exec-suffixes)
"c:/Tools/msys64/usr/bin/ci"
ELISP> (locate-file "ci" exec-path exec-suffixes 1)
nil


executable-find passes 1 to locate-file:

    ;; Use 1 rather than file-executable-p to better match the
    ;; behavior of call-process.
    (let ((default-directory (file-name-quote default-directory 'top)))
      (locate-file command exec-path exec-suffixes 1))))


Now, it is true that call-process will not find the shell command:

ELISP> (call-process "c:/Tools/msys64/usr/bin/ci" nil t)
*** Eval error ***  Searching for program: No such file or directory,
c:/Tools/msys64/usr/bin/ci


but 'executable-find' is not defined in terms of call-process, but
finding commands in the exec-path:

(executable-find COMMAND &optional REMOTE)

Search for COMMAND in ‘exec-path’ and return the absolute file name.
Return nil if COMMAND is not found anywhere in ‘exec-path’.


so there's at least some tension between these two interpretations,
IMO. It's weird that you can make shell-command to execute a program
(with a relative, not absolute, name, like "ci"), and yet
executable-find fails to find it in the exec-path, where it, in fact,
is located.





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

end of thread, other threads:[~2019-06-19 19:22 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-17 23:42 bug#36270: executable-find does not find shell commands on MSYS2 Juanma Barranquero
2019-06-18  0:23 ` Glenn Morris
2019-06-18  0:57   ` Juanma Barranquero
2019-06-18 16:51     ` Eli Zaretskii
2019-06-18 20:49       ` Juanma Barranquero
2019-06-19 16:24         ` Eli Zaretskii
2019-06-19 17:38           ` Andy Moreton
2019-06-19 19:22             ` Juanma Barranquero
2019-06-19 19:20           ` Juanma Barranquero

Code repositories for project(s) associated with this public inbox

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

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).