GNU bug report logs -
#7784
executable-find does not find scripts on woe32
Previous Next
To reply to this bug, email your comments to 7784 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#7784
; Package
emacs
.
(Tue, 04 Jan 2011 23:38:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Sam Steingold <sds <at> gnu.org>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Tue, 04 Jan 2011 23:38:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
GNU Emacs 23.2.1 (i386-mingw-nt5.2.3790)
of 2010-05-08 on G41R2F1
--with-gcc (3.4) --no-opt --cflags -Ic:/xpm/include
(executable-find "bzr")
==> nil
(executable-find "svn")
==> "c:/gnu/cygwin/bin/svn.exe"
the problem, apparently, stems from:
(file-exists-p "c:/gnu/cygwin/bin/bzr")
==> t
(file-executable-p "c:/gnu/cygwin/bin/bzr")
==> nil
which is wrong because bzr is an executable python script.
--
Sam Steingold <http://sds.podval.org>
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#7784
; Package
emacs
.
(Wed, 05 Jan 2011 01:11:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 7784 <at> debbugs.gnu.org (full text, mbox):
Sam Steingold <sds <at> gnu.org> writes:
> (file-executable-p "c:/gnu/cygwin/bin/bzr")
> ==> nil
> which is wrong because bzr is an executable python script.
How does Emacs know that bzr is a Python script? Because it has
#!/usr/bin/python
as the first line? That only makes sense within the Cygwin environment,
i.e. if you are running a Cygwin-based Emacs.
As you know, there is no 'executable' attribute on Windows. Cygwin fakes
it.
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#7784
; Package
emacs
.
(Wed, 05 Jan 2011 03:59:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 7784 <at> debbugs.gnu.org (full text, mbox):
On Tue, Jan 4, 2011 at 8:18 PM, Óscar Fuentes <ofv <at> wanadoo.es> wrote:
> Sam Steingold <sds <at> gnu.org> writes:
>
>> (file-executable-p "c:/gnu/cygwin/bin/bzr")
>> ==> nil
>> which is wrong because bzr is an executable python script.
>
> As you know, there is no 'executable' attribute on Windows.
that's correct.
therefore the emacs code which calls stat() on the filename and checks
the mode is wrong.
check_executable() should return true for all arguments.
--
Sam Steingold <http://sds.podval.org>
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#7784
; Package
emacs
.
(Wed, 05 Jan 2011 07:08:01 GMT)
Full text and
rfc822 format available.
Message #14 received at submit <at> debbugs.gnu.org (full text, mbox):
On 05/01/2011 07:44, Sam Steingold wrote:
> GNU Emacs 23.2.1 (i386-mingw-nt5.2.3790)
> of 2010-05-08 on G41R2F1
> --with-gcc (3.4) --no-opt --cflags -Ic:/xpm/include
>
> (executable-find "bzr")
> ==> nil
> (executable-find "svn")
> ==> "c:/gnu/cygwin/bin/svn.exe"
>
> the problem, apparently, stems from:
>
> (file-exists-p "c:/gnu/cygwin/bin/bzr")
> ==> t
> (file-executable-p "c:/gnu/cygwin/bin/bzr")
> ==> nil
> which is wrong because bzr is an executable python script.
>
It may well be, but Windows does not know how to execute it. You either
need to run it by specifying the script as an argument to python.exe
explicitly, or run it from within Cygwin bash, which interprets the #!
comment syntax and presumably has some Cygwin specific way to simulate
the executable bit in the filesystem.
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#7784
; Package
emacs
.
(Wed, 05 Jan 2011 11:20:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 7784 <at> debbugs.gnu.org (full text, mbox):
> Date: Tue, 4 Jan 2011 23:05:16 -0500
> From: Sam Steingold <sds <at> gnu.org>
> Cc: 7784 <at> debbugs.gnu.org
>
> check_executable() should return true for all arguments.
How would this be useful? Right now, it returns true for files that
you can "execute" from the native Windows build of Emacs using native
Windows shells and the cmd proxy that is part of the Emacs package.
Returning true for every file will give gobs of false positives,
because most files on Windows are not executable, not even by Cygwin
wizardry.
Could you please describe the specific use-case where this issue got
in your way? Because otherwise this discussion sounds a bit academic
to me.
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#7784
; Package
emacs
.
(Wed, 05 Jan 2011 11:24:02 GMT)
Full text and
rfc822 format available.
Message #20 received at 7784 <at> debbugs.gnu.org (full text, mbox):
> From: Óscar Fuentes <ofv <at> wanadoo.es>
> Date: Wed, 05 Jan 2011 02:18:04 +0100
> Cc: 7784 <at> debbugs.gnu.org
>
> As you know, there is no 'executable' attribute on Windows. Cygwin fakes
> it.
Actually, there is an execute permission bit on Windows, but only on
NTFS; Cygwin uses that to "fake" Posix-style x bit. But Emacs (the
native Windows build of it) does not use these NTFS features, and
frankly, I'm not sure it's worth the hassle (and there _is_ a very
real hassle, because mapping Posix rwx bits into NTFS ACLs is a
non-trivial job).
But I digress. The real question in this bug report is why did the
OP need a Python script to appear as executable to Emacs.
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#7784
; Package
emacs
.
(Wed, 05 Jan 2011 14:18:02 GMT)
Full text and
rfc822 format available.
Message #23 received at 7784 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
> How would this be useful? Right now, it returns true for files that
> you can "execute" from the native Windows build of Emacs using native
> Windows shells and the cmd proxy that is part of the Emacs package.
One thing I noticed while experimenting with file-executable-p is that
it returns false for files with extensions listed in PATHEXT. For
instance, .JS is listed on one machine's PATHEXT but, after creating
foo.js, (file-executable-p "foo.js") returns nil.
As those files are directly executable from the shell, maybe Emacs
should recognize them as executables as well?
[snip]
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#7784
; Package
emacs
.
(Wed, 05 Jan 2011 14:33:02 GMT)
Full text and
rfc822 format available.
Message #26 received at 7784 <at> debbugs.gnu.org (full text, mbox):
On Wed, Jan 5, 2011 at 6:26 AM, Eli Zaretskii <eliz <at> gnu.org> wrote:
>> Date: Tue, 4 Jan 2011 23:05:16 -0500
>> From: Sam Steingold <sds <at> gnu.org>
>> Cc: 7784 <at> debbugs.gnu.org
>>
>
> Could you please describe the specific use-case where this issue got
> in your way? Because otherwise this discussion sounds a bit academic
> to me.
when I try to use cygwin in native windows emacs, this works for
binaries but not for scripts.
e.g., using VC with cygwin-provided bzr and hg does not work.
there is no reason for this not to work except for the
check_executable()'s return value.
--
Sam Steingold <http://sds.podval.org>
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#7784
; Package
emacs
.
(Wed, 05 Jan 2011 16:18:02 GMT)
Full text and
rfc822 format available.
Message #29 received at 7784 <at> debbugs.gnu.org (full text, mbox):
> Date: Wed, 5 Jan 2011 09:40:06 -0500
> From: Sam Steingold <sds <at> gnu.org>
> Cc: ofv <at> wanadoo.es, 7784 <at> debbugs.gnu.org
>
> On Wed, Jan 5, 2011 at 6:26 AM, Eli Zaretskii <eliz <at> gnu.org> wrote:
> >> Date: Tue, 4 Jan 2011 23:05:16 -0500
> >> From: Sam Steingold <sds <at> gnu.org>
> >> Cc: 7784 <at> debbugs.gnu.org
> >>
> >
> > Could you please describe the specific use-case where this issue got
> > in your way? Because otherwise this discussion sounds a bit academic
> > to me.
>
> when I try to use cygwin in native windows emacs, this works for
> binaries but not for scripts.
> e.g., using VC with cygwin-provided bzr and hg does not work.
Using any Emacs command that goes through shell-command-* should work
if you configure Emacs to use the Cygwin Bash as the shell.
Emacs commands that invoke programs directly (call/start-process etc.)
will not work with Unix shell scripts, but you can craft trivial *.bat
files that invoke the script via the Cygwin Bash, and put them on
PATH. E.g., to invoke Cygwin bzr, create a bzr.bat (untested) with
this single line:
@X:\path\to\cygwin\bash $*
> there is no reason for this not to work except for the
> check_executable()'s return value.
Yes, there is a reason: the native Windows build of Emacs uses native
Windows APIs to run subprocesses, and those APIs don't know how to run
a Unix shell script.
Or maybe I misunderstand the details, in which case please tell more
regarding the Emacs functions which failed (those that eventually
called executable-find) and the relevant error message(s).
In general, though, if you want to use Cygwin tools, I suggest to use
a Cygwin build of Emacs. Then everything should "just work".
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#7784
; Package
emacs
.
(Wed, 05 Jan 2011 16:19:01 GMT)
Full text and
rfc822 format available.
Message #32 received at 7784 <at> debbugs.gnu.org (full text, mbox):
> From: Óscar Fuentes <ofv <at> wanadoo.es>
> Cc: Sam Steingold <sds <at> gnu.org>, 7784 <at> debbugs.gnu.org
> Date: Wed, 05 Jan 2011 15:24:26 +0100
>
> One thing I noticed while experimenting with file-executable-p is that
> it returns false for files with extensions listed in PATHEXT. For
> instance, .JS is listed on one machine's PATHEXT but, after creating
> foo.js, (file-executable-p "foo.js") returns nil.
>
> As those files are directly executable from the shell, maybe Emacs
> should recognize them as executables as well?
Patches for supporting PATHEXT are most welcome, TIA.
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#7784
; Package
emacs
.
(Wed, 05 Jan 2011 23:07:02 GMT)
Full text and
rfc822 format available.
Message #35 received at 7784 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
>> From: Óscar Fuentes <ofv <at> wanadoo.es>
>> Cc: Sam Steingold <sds <at> gnu.org>, 7784 <at> debbugs.gnu.org
>> Date: Wed, 05 Jan 2011 15:24:26 +0100
>>
>> One thing I noticed while experimenting with file-executable-p is that
>> it returns false for files with extensions listed in PATHEXT. For
>> instance, .JS is listed on one machine's PATHEXT but, after creating
>> foo.js, (file-executable-p "foo.js") returns nil.
>>
>> As those files are directly executable from the shell, maybe Emacs
>> should recognize them as executables as well?
>
> Patches for supporting PATHEXT are most welcome, TIA.
It might also be a good idea to merge the list used by is_exec in w32.c
with the list that is used as the initial value of exec-suffixes.
Merged 7784 36270.
Request was from
Juanma Barranquero <lekktu <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Tue, 18 Jun 2019 01:03:02 GMT)
Full text and
rfc822 format available.
This bug report was last modified 5 years and 154 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.