unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Jim Porter <jporterbugs@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 71655@debbugs.gnu.org, james@literate-devops.io
Subject: bug#71655: Eshell external commands do not work under GNU Emacs for Windows
Date: Wed, 19 Jun 2024 22:34:02 -0700	[thread overview]
Message-ID: <8b97b729-c431-1dc2-d4d4-b988120e7de0@gmail.com> (raw)
In-Reply-To: <86r0csnrk7.fsf@gnu.org>

On 6/19/2024 9:53 PM, Eli Zaretskii wrote:
>> Date: Wed, 19 Jun 2024 12:40:12 -0700
>> Cc: 71655@debbugs.gnu.org, james@literate-devops.io
>> From: Jim Porter <jporterbugs@gmail.com>
>>
>> It's trying to find a shebang, which I guess(?) is so that Eshell can
>> support shebangs on MS-Windows. What's strange is that 'file-readable-p'
>> is non-nil, but 'insert-file-contents-literally' fails.
> 
> It fails because winget.exe is not a regular file, and
> insert-file-contents barely supports non-regular files (and even that
> almost exclusively on Posix systems).

'file-regular-p' for that file is also non-nil. Should we change that?

> Not here.  The native cat.exe says "Invalid argument", just like
> Emacs, and the one from MSYS says "Permission denied".  I get similar
> errors from other utilities, for example wc.  And MSYS ls shows it as
> a regular file of size zero.

My version of ls reports it as a symlink, interestingly enough. I'm 
using the MSYS2 binaries that come with Git for Windows to test this. I 
think they apply some additional patches on top so maybe the versions I 
have include some special support for reparse points like this?

> So my opinion on this is that Eshell should really skip reading files
> whose size is zero when it looks for an interpreter, since we will
> never find anything useful that way.

Well, I don't think size=0 is the only way that we could skip over files 
like this. If 'file-regular-p' or 'file-readable-p' returned nil, we 
could use that to skip it. We could also skip files ending in ".exe". We 
could skip files that signal from 'insert-file-contents-literally'.

I don't mind checking for size=0 if that's what we decide, but my 
reading of the existing 'eshell-script-interpreter' suggests that it 
should have already worked. If there's a bug in 'file-regular-p' (or 
some other function Eshell uses here), I think it's work fixing it at 
the source so that we squash the bug once and for all. Otherwise, some 
other Lisp code might try to do something similar one day (maybe a Lisp 
version of file(1)?) and get bitten by this bug.

If that's not convincing, then I'll just add the size=0 check.





  reply	other threads:[~2024-06-20  5:34 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-19 15:53 bug#71655: Eshell external commands do not work under GNU Emacs for Windows James Hilling via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-19 19:12 ` Eli Zaretskii
2024-06-19 19:22   ` Eli Zaretskii
2024-06-19 19:40     ` Jim Porter
2024-06-20  4:53       ` Eli Zaretskii
2024-06-20  5:34         ` Jim Porter [this message]
2024-06-20  7:45           ` Eli Zaretskii
2024-06-22 19:55             ` Jim Porter
2024-06-23  4:36               ` Eli Zaretskii
2024-06-24  1:40                 ` Jim Porter
2024-06-24  5:56                   ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-08  3:26                     ` Jim Porter
2024-07-08 11:09                       ` Eli Zaretskii
2024-06-19 19:30   ` Eli Zaretskii

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=8b97b729-c431-1dc2-d4d4-b988120e7de0@gmail.com \
    --to=jporterbugs@gmail.com \
    --cc=71655@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=james@literate-devops.io \
    /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).