From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jim Porter Newsgroups: gmane.emacs.bugs Subject: bug#71655: Eshell external commands do not work under GNU Emacs for Windows Date: Wed, 19 Jun 2024 22:34:02 -0700 Message-ID: <8b97b729-c431-1dc2-d4d4-b988120e7de0@gmail.com> References: <86y170oifx.fsf@gnu.org> <86v824ohym.fsf@gnu.org> <86r0csnrk7.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39743"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 71655@debbugs.gnu.org, james@literate-devops.io To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jun 20 07:36:22 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sKAT8-000A6g-4h for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 20 Jun 2024 07:36:22 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sKASm-0003Q5-Q9; Thu, 20 Jun 2024 01:36:00 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sKASl-0003Pv-GO for bug-gnu-emacs@gnu.org; Thu, 20 Jun 2024 01:35:59 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sKASl-0000Qb-7w for bug-gnu-emacs@gnu.org; Thu, 20 Jun 2024 01:35:59 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sKASn-0001rV-TP for bug-gnu-emacs@gnu.org; Thu, 20 Jun 2024 01:36:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Jim Porter Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 20 Jun 2024 05:36:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71655 X-GNU-PR-Package: emacs Original-Received: via spool by 71655-submit@debbugs.gnu.org id=B71655.17188617167087 (code B ref 71655); Thu, 20 Jun 2024 05:36:01 +0000 Original-Received: (at 71655) by debbugs.gnu.org; 20 Jun 2024 05:35:16 +0000 Original-Received: from localhost ([127.0.0.1]:44261 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sKAS4-0001qE-9x for submit@debbugs.gnu.org; Thu, 20 Jun 2024 01:35:16 -0400 Original-Received: from mail-pf1-f174.google.com ([209.85.210.174]:44497) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sKAS1-0001pt-6z for 71655@debbugs.gnu.org; Thu, 20 Jun 2024 01:35:14 -0400 Original-Received: by mail-pf1-f174.google.com with SMTP id d2e1a72fcca58-7062bf6d9a1so409110b3a.1 for <71655@debbugs.gnu.org>; Wed, 19 Jun 2024 22:35:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718861644; x=1719466444; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=khEyYjkCEYdoVEgqD0bdPAhgrIPEx8Di5KdziJjB9OE=; b=R+JRyb0atSk4t2s9zoVLMRTdeWJ+7lbR5CgdSPQAunDIrY3aT/UOgJHej/vYrSZ5Rn BZuD3iq9dn8QpujGepDnseUD1iKsTzZXVnVNi/V0lVKIkArfXwovSFwJD9YwxTz9bfQa +R9f8T3/HD3Ca6RqIC/ugZKsHMExMbPS0xtnRfDXTCRiu2/zmpP5hHcHbUE1vWCGKTZf cBQj0S77H3jWesp64SryTI7ocU8CYM7ZNHleWk83eetFknSu1Ducj1Or8ukHPbF+nZSN cW8Rfvq6Szu0Y+8MdIlwZCnFMIxFo8SIQ6nOp7G5Gj538PS/C/I9+mhrFN3/HFL6Wt2Q C4Cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718861644; x=1719466444; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=khEyYjkCEYdoVEgqD0bdPAhgrIPEx8Di5KdziJjB9OE=; b=m1hFDiA30UpFCesn7Rh62Icvi79TrnC+EC1B6MTfv/f5TTLHJ91cBdAZ3yk002zmze A03Scbv2+o/OHNAvpGVpZFRCqQ8R6ZPQnDD9TocFaSPxLpyJ3fZ85cwkUMZ+AvkZtIyx LZo7dt054wHSsdbeCJlpDnQI/lUuBBZLUkxK+D/MpTEB+e/8FchpVaMn41Lj7xqey8Iz bBmWLKJL5b0YNxG8yoEvBbmgc/V32Do3KAG9p4kRoe4ciRGj9SDN73ZZtC99rSmJSR8q Y4KS8o8JDfZxbZ0HXD71k7fY40+bEp1Bef+5Oy6c3BXk/6dYIAsAHF05KEI1ktZqidIi tG9A== X-Gm-Message-State: AOJu0YyBjFtTutVaHpGMt+Cp13ueN+dMeHsUWMifJ9Q2eoF2eFlsLtO6 eyqn/ecn+DZsljYUloZgIkfnDoA0x9Oa/Z30NfvT3m/2R0k1c8TX X-Google-Smtp-Source: AGHT+IFwQ2wpvdCE4Lkh8gc1rGc+UXKzblF+oKIr1cqlu94TLHUikoNY4bmDv9lvwqiB5p5qFWYWew== X-Received: by 2002:a05:6a00:278e:b0:706:2954:36f5 with SMTP id d2e1a72fcca58-70629c67897mr4693778b3a.18.1718861643499; Wed, 19 Jun 2024 22:34:03 -0700 (PDT) Original-Received: from [192.168.1.2] (syn-023-240-098-037.res.spectrum.com. [23.240.98.37]) by smtp.googlemail.com with ESMTPSA id d2e1a72fcca58-705ccb6b110sm11601025b3a.153.2024.06.19.22.34.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 19 Jun 2024 22:34:03 -0700 (PDT) Content-Language: en-US In-Reply-To: <86r0csnrk7.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:287529 Archived-At: 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 >> >> 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.