From: Juanma Barranquero <lekktu@gmail.com>
To: 36270@debbugs.gnu.org
Subject: bug#36270: executable-find does not find shell commands on MSYS2
Date: Tue, 18 Jun 2019 01:42:29 +0200 [thread overview]
Message-ID: <CAAeL0SQU2t8LwyGJoWpxTpj3ebw=qNr1aT0RS6-ggWBqdYfteQ@mail.gmail.com> (raw)
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.
next reply other threads:[~2019-06-17 23:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-17 23:42 Juanma Barranquero [this message]
2019-06-18 0:23 ` bug#36270: executable-find does not find shell commands on MSYS2 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
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAAeL0SQU2t8LwyGJoWpxTpj3ebw=qNr1aT0RS6-ggWBqdYfteQ@mail.gmail.com' \
--to=lekktu@gmail.com \
--cc=36270@debbugs.gnu.org \
/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 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).