GNU bug report logs - #36270
executable-find does not find shell commands on MSYS2

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: wishlist; Reported by: Juanma Barranquero <lekktu@HIDDEN>; merged with #7784; dated Mon, 17 Jun 2019 23:44:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 36270 <at> debbugs.gnu.org:


Received: (at 36270) by debbugs.gnu.org; 19 Jun 2019 19:23:42 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jun 19 15:23:42 2019
Received: from localhost ([127.0.0.1]:47434 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hdgBK-00085a-5x
	for submit <at> debbugs.gnu.org; Wed, 19 Jun 2019 15:23:42 -0400
Received: from mail-qk1-f181.google.com ([209.85.222.181]:40166)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <lekktu@HIDDEN>) id 1hdgBI-00085N-Nq
 for 36270 <at> debbugs.gnu.org; Wed, 19 Jun 2019 15:23:41 -0400
Received: by mail-qk1-f181.google.com with SMTP id c70so280682qkg.7
 for <36270 <at> debbugs.gnu.org>; Wed, 19 Jun 2019 12:23:40 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to
 :cc; bh=DDbDg6U1UeQNagnAqwMkIWaHRqK6q6LDpfEdOMJFD70=;
 b=ek7Zu5KtP3H9DA60fgF3iOy2g7Xj8CloqaxNH0YnUfrPyDBcpJSiT7OC+wgjVdWuSr
 xzwx9rMlMlRWou/q8lxDnBQB+xHSQLdGPTVpYkZr/iqRYzuMO3siaKdg7h/UJgNZooIf
 +m/Y2NCJXBxQa7O+l6SScAzz8BlnBshK0xABT9ZIJQ5CRGe09kSL3lXhiJ9Y2IyYU8HA
 aiRllmNEVJtmzFP4WrrIMekEy8N6mRfuUKo7AZpcjPYOxDBFy6d1m+//7E17wTiHyALc
 0X1WOlwGunh+WxkmN2WBmHhFU0b73wzE3YT9XFS3HtRgz76+nzniSxDsSVCyIA48X+u2
 hmdg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=DDbDg6U1UeQNagnAqwMkIWaHRqK6q6LDpfEdOMJFD70=;
 b=HD5g43eHasms0se3zaoWf4EnuKhnwrasWqbrjigTPLJXKKymd+8NwNA9FtTbUgcec0
 Aeou9HfdNTtwn+EVJRgFq5mzGiw0WfzngPg4iYP9ScEzbx/iFVoXbA2ajzmhqnd/qAWl
 qddU81JfJNeJSIUzfbe6vRy2PJL/jACB6M831/XzfPCmjZ6mOO1WenKGRszGqmyd1TZ/
 sWJ40xYFNdhDVeUmo+NvYs3UwMvflVS8b2Ivz7eYV4kH1s3zeCcwcHKAVvsgqNFC3Xnd
 lnQXRrF40HWr7AZrD3V96xAhWrAH5HPizT5BCWhs2FeS1PAeaLFaTuxprrHFBikZn8Md
 u+Bw==
X-Gm-Message-State: APjAAAW01JSFS0YtdcgB4DkO8HaklB+fnURgWdA82L/Gay1/DY2Ix1HT
 wWCqMgcUx64gTxjTkcGuY5L+vKWvM62L6K+Xysg=
X-Google-Smtp-Source: APXvYqxaOsFxBcHPzPs3abeuY7fI3O+qtuONJQlabugErPjKBQtvF1NaXalUuFFMedrsCp6AW3qKGmHAgfZxizVHdt0=
X-Received: by 2002:a37:ea0c:: with SMTP id t12mr32432394qkj.117.1560972215169; 
 Wed, 19 Jun 2019 12:23:35 -0700 (PDT)
MIME-Version: 1.0
References: <2lef3rrbaa.fsf@HIDDEN>
 <CAAeL0SQcW8Wxb9wGjxV+xaHeZ6KtkfdCObRiyRtTNiUzHHgJow@HIDDEN>
 <83r27qsuox.fsf@HIDDEN>
 <CAAeL0SS4zhoqL-ifWzeQ3wRxjCrCAU_vV4oHppSZrcGf-C=9=Q@HIDDEN>
 <83o92tr1b2.fsf@HIDDEN>
 <CAAeL0SQU2t8LwyGJoWpxTpj3ebw=qNr1aT0RS6-ggWBqdYfteQ@HIDDEN>
 <vz1fto5xypx.fsf@HIDDEN>
In-Reply-To: <vz1fto5xypx.fsf@HIDDEN>
From: Juanma Barranquero <lekktu@HIDDEN>
Date: Wed, 19 Jun 2019 21:22:59 +0200
Message-ID: <CAAeL0SQ-XCHoP6XRo62QOUrKtx6X=JB6h22rh2Lp5Cd+2o=ELw@HIDDEN>
Subject: Re: bug#36270: executable-find does not find shell commands on MSYS2
To: Andy Moreton <andrewjmoreton@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 36270
Cc: 36270 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On Wed, Jun 19, 2019 at 7:44 PM Andy Moreton <andrewjmoreton@HIDDEN> wrote:

> I use the following advice in a Windows build of emacs to get shell
> scripts working for Cygwin. MSYS2 should be similar, with a suitable
> setting for `shell-file-name':

That seems useful, thanks.

Though there's no error checking at all, isn't it? You try to execute
a command, and if it is not executable from `executable-find' POV, off
to the shell it goes...




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36270; Package emacs. Full text available.

Message received at 36270 <at> debbugs.gnu.org:


Received: (at 36270) by debbugs.gnu.org; 19 Jun 2019 19:21:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jun 19 15:21:15 2019
Received: from localhost ([127.0.0.1]:47430 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hdg8w-000822-Nv
	for submit <at> debbugs.gnu.org; Wed, 19 Jun 2019 15:21:14 -0400
Received: from mail-qt1-f170.google.com ([209.85.160.170]:42712)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <lekktu@HIDDEN>) id 1hdg8v-00081o-Tj
 for 36270 <at> debbugs.gnu.org; Wed, 19 Jun 2019 15:21:14 -0400
Received: by mail-qt1-f170.google.com with SMTP id s15so357980qtk.9
 for <36270 <at> debbugs.gnu.org>; Wed, 19 Jun 2019 12:21:13 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to
 :cc; bh=v3t7ttak4FLX65e9JnXAjVaRjIJ0+Sww7BRDuKGmWc8=;
 b=dxerEsD5PqhDBrr1o1sglPiUTk64IygYDco3UxhWmeaVHp34GmDpJaheBvlSI2LGTT
 DX39JETmTPrUtax4VVLL4xrdQCiG42b3VdZlxQTHDPuW6Z+nVWvK+QsH3GJqweE8tyw4
 PFiCfTR/U82eMzNuHgRH9X46i2RSt3xxI7ue8mb0xnNuj8wxWb9kmYnX+/0+QBTKjHWP
 SviHTbX8Sae1rBvxYu8NiV9GCS9s5JpBSiuZwCQkZmEOMsbCAfIPew0n5Tdxi8ZRWmTV
 jjAraMyTbUFgijdPpI056b1koFoh3gPgv0ZR8Tke0go2/uPTBGAX8+savsed67/AcMSd
 cxdg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=v3t7ttak4FLX65e9JnXAjVaRjIJ0+Sww7BRDuKGmWc8=;
 b=Fxx6oxvECWC4uyQjqr2Zj5uR7gfUAiMyuh1Oxnt9/mZqvEKAiHp5CzF7zuMYfZ5sNp
 KCLvbpXDv5YDjT1TesGZFjrU7gDzI6muNp+CIhe8ZPtazhWhvK8k7kE4LGt0mX4l6SpE
 40fQ6hGWhd7hBleu7pjS5GYzhRLOkmoh8NmNdZrfMnA602FNBJ8cPVNjuvbQ4xQ5DtHn
 GMT7nFXuA0OY7wBZzjDAab9bw9PfyH2AUFZcCYIjW3bVtpEfR7Q6Qs7Wc4j/rLS2bt1H
 GaXtdu9yGFAycXOnP8lxYpHUF5nqJPo84TaT/vPG2Nc9gOGzjUbbKSoWBaXexqqi3S1i
 BPSw==
X-Gm-Message-State: APjAAAUSkmgIKKCb7UrM1ULof29KWcmZXgVELINse8xIYMeFCQjWwFgo
 3RsmF6gcuZcqkFK6rQe+PiwMVNn78RVbpa8bGsnwLh2m
X-Google-Smtp-Source: APXvYqzaNgMliCcFTNC+gmJ/g0+ULQQ01QZn3GZvVniE9oKjRj7qYVLjiKMMU5o8UUnoZ0sVE5WIbY/ISbXKDZ/zPcc=
X-Received: by 2002:ac8:376e:: with SMTP id
 p43mr108688022qtb.354.1560972067143; 
 Wed, 19 Jun 2019 12:21:07 -0700 (PDT)
MIME-Version: 1.0
References: <CAAeL0SQU2t8LwyGJoWpxTpj3ebw=qNr1aT0RS6-ggWBqdYfteQ@HIDDEN>
 <2lef3rrbaa.fsf@HIDDEN>
 <CAAeL0SQcW8Wxb9wGjxV+xaHeZ6KtkfdCObRiyRtTNiUzHHgJow@HIDDEN>
 <83r27qsuox.fsf@HIDDEN>
 <CAAeL0SS4zhoqL-ifWzeQ3wRxjCrCAU_vV4oHppSZrcGf-C=9=Q@HIDDEN>
 <83o92tr1b2.fsf@HIDDEN>
In-Reply-To: <83o92tr1b2.fsf@HIDDEN>
From: Juanma Barranquero <lekktu@HIDDEN>
Date: Wed, 19 Jun 2019 21:20:30 +0200
Message-ID: <CAAeL0STQEsc9JeBmPBhOn9vdjpXfSGXTHNVAaH6AcoT5Bnm8gQ@HIDDEN>
Subject: Re: bug#36270: executable-find does not find shell commands on MSYS2
To: Eli Zaretskii <eliz@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 36270
Cc: Glenn Morris <rgm@HIDDEN>, 36270 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On Wed, Jun 19, 2019 at 6:24 PM Eli Zaretskii <eliz@HIDDEN> wrote:

> Kids down here have a saying: "almost doesn't count" ;-)

Err... Don't want to think about the context for *that* ;-)

> Exactly.  So what would be the point of having a general-purpose API
> return files that can be useful only with some methods of running a
> program?  It will only cause confusion and bug reports.

That's an argument about the general-purpose API return these files,
not about having a special-purpose API, isn't it?

> So to support that, we will need to change sys_spawnve and/or
> cmdproxy to detect an extension that appears in PATHEXT, and then
> either invoke through cmdproxy or use ShellExecute instead of
> CreateProcess.  And this is the more complex part of the job.

Ok, now I understand. I will look into it, but no promises and of
course no hurry.

> One non-ugly fix is to use RCS from the ezwinports site.  The binaries
> there are 32-bit, but I don't think it will make any difference.

With your binaries installed the test will pass (haven't tested yet,
but seems likely). But that does not solve the issue that someone with
a MSYS2 build environment has a working rcs installation, and yet the
vc-tests fail. Of course, the thing is that, from Emacs POV, that's
not a "working rcs installation" at all...




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36270; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 19 Jun 2019 17:42:47 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jun 19 13:42:47 2019
Received: from localhost ([127.0.0.1]:47391 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hdebe-0003SL-OQ
	for submit <at> debbugs.gnu.org; Wed, 19 Jun 2019 13:42:46 -0400
Received: from lists.gnu.org ([209.51.188.17]:59083)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1hdebc-0003SC-2s
 for submit <at> debbugs.gnu.org; Wed, 19 Jun 2019 13:42:45 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:49538)
 by lists.gnu.org with esmtp (Exim 4.86_2)
 (envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1hdebb-0002QN-3R
 for bug-gnu-emacs@HIDDEN; Wed, 19 Jun 2019 13:42:43 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,FREEMAIL_FROM,
 RDNS_NONE autolearn=disabled version=3.3.2
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1hdeXP-0004w9-PH
 for bug-gnu-emacs@HIDDEN; Wed, 19 Jun 2019 13:38:24 -0400
Received: from [195.159.176.226] (port=50040 helo=blaine.gmane.org)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <geb-bug-gnu-emacs@HIDDEN>)
 id 1hdeXP-0004hj-Ez
 for bug-gnu-emacs@HIDDEN; Wed, 19 Jun 2019 13:38:23 -0400
Received: from list by blaine.gmane.org with local (Exim 4.89)
 (envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1hdeXC-000uoj-W9
 for bug-gnu-emacs@HIDDEN; Wed, 19 Jun 2019 19:38:11 +0200
X-Injected-Via-Gmane: http://gmane.org/
To: bug-gnu-emacs@HIDDEN
From: Andy Moreton <andrewjmoreton@HIDDEN>
Subject: Re: bug#36270: executable-find does not find shell commands on MSYS2
Date: Wed, 19 Jun 2019 18:38:02 +0100
Message-ID: <vz1fto5xypx.fsf@HIDDEN>
References: <CAAeL0SQU2t8LwyGJoWpxTpj3ebw=qNr1aT0RS6-ggWBqdYfteQ@HIDDEN>
 <2lef3rrbaa.fsf@HIDDEN>
 <CAAeL0SQcW8Wxb9wGjxV+xaHeZ6KtkfdCObRiyRtTNiUzHHgJow@HIDDEN>
 <83r27qsuox.fsf@HIDDEN>
 <CAAeL0SS4zhoqL-ifWzeQ3wRxjCrCAU_vV4oHppSZrcGf-C=9=Q@HIDDEN>
 <83o92tr1b2.fsf@HIDDEN>
Mime-Version: 1.0
Content-Type: text/plain
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (windows-nt)
Cancel-Lock: sha1:3L6ZdPO5v8hnmLdEIRdVRnN5Q5Q=
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 195.159.176.226
X-Spam-Score: -0.8 (/)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.8 (-)

On Wed 19 Jun 2019, Eli Zaretskii wrote:
>> From: Juanma Barranquero <lekktu@HIDDEN>
>> I stumbled upon this because I was trying to understand failures in
>> vc-tests.el on Windows, and the reason is that it calls call-process
>> to run some shell scripts, like ci. I'd like to fix that and run the
>> tests, but I haven't really stared at it long enough to know if
>> there's any non-ugly fix.
>
> One non-ugly fix is to use RCS from the ezwinports site.  The binaries
> there are 32-bit, but I don't think it will make any difference.

I use the following advice in a Windows build of emacs to get shell
scripts working for Cygwin. MSYS2 should be similar, with a suitable
setting for `shell-file-name':

  (defun call-process:filter-args (args)
    "Ensure native Windows emacs can run shell script programs."
    (let ((program (nth 0 args)))
      (if (executable-find program)
          args
        (list shell-file-name (nth 1 args) (nth 2 args) (nth 3 args)
              shell-command-switch
              (mapconcat #'shell-quote-argument
                         (append (list program) (nthcdr 4 args)) " ")))))
  (advice-add 'call-process :filter-args #'call-process:filter-args)

  (defun make-process:filter-args (args)
    "Ensure native Windows emacs can run shell script programs."
    (let* ((command (plist-get args :command)))
      (if (executable-find (car command))
          args
        (plist-put args :command
                   (list shell-file-name shell-command-switch
                         (mapconcat #'shell-quote-argument command " "))))))
  (advice-add 'make-process :filter-args #'make-process:filter-args))


Perhaps something similar could be added for Windows builds.

    AndyM





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36270; Package emacs. Full text available.

Message received at 36270 <at> debbugs.gnu.org:


Received: (at 36270) by debbugs.gnu.org; 19 Jun 2019 16:24:29 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jun 19 12:24:29 2019
Received: from localhost ([127.0.0.1]:47355 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hddNs-0001Os-NO
	for submit <at> debbugs.gnu.org; Wed, 19 Jun 2019 12:24:28 -0400
Received: from eggs.gnu.org ([209.51.188.92]:50617)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1hddNr-0001Of-5N
 for 36270 <at> debbugs.gnu.org; Wed, 19 Jun 2019 12:24:27 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:41240)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>)
 id 1hddNm-00087N-1Q; Wed, 19 Jun 2019 12:24:22 -0400
Received: from [176.228.60.248] (port=2470 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1hddNf-0006d6-Q8; Wed, 19 Jun 2019 12:24:18 -0400
Date: Wed, 19 Jun 2019 19:24:01 +0300
Message-Id: <83o92tr1b2.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Juanma Barranquero <lekktu@HIDDEN>
In-reply-to: <CAAeL0SS4zhoqL-ifWzeQ3wRxjCrCAU_vV4oHppSZrcGf-C=9=Q@HIDDEN>
 (message from Juanma Barranquero on Tue, 18 Jun 2019 22:49:33 +0200)
Subject: Re: bug#36270: executable-find does not find shell commands on MSYS2
References: <CAAeL0SQU2t8LwyGJoWpxTpj3ebw=qNr1aT0RS6-ggWBqdYfteQ@HIDDEN>
 <2lef3rrbaa.fsf@HIDDEN>
 <CAAeL0SQcW8Wxb9wGjxV+xaHeZ6KtkfdCObRiyRtTNiUzHHgJow@HIDDEN>
 <83r27qsuox.fsf@HIDDEN>
 <CAAeL0SS4zhoqL-ifWzeQ3wRxjCrCAU_vV4oHppSZrcGf-C=9=Q@HIDDEN>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 36270
Cc: rgm@HIDDEN, 36270 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Juanma Barranquero <lekktu@HIDDEN>
> Date: Tue, 18 Jun 2019 22:49:33 +0200
> Cc: Glenn Morris <rgm@HIDDEN>, 36270 <at> debbugs.gnu.org
> 
> On Tue, Jun 18, 2019 at 6:51 PM Eli Zaretskii <eliz@HIDDEN> wrote:
> 
> > We want to declare a file "executable" only if it can be invoked by _all_
> > possible means of running an executable file.
> 
> Sure. But let's perhaps agree that there's something to be said for
> files that are "almost executable".

Kids down here have a saying: "almost doesn't count" ;-)

> shell-command and variants are used (counting *very* roughly) about
> 150 times in the elisp sources, vs. ~300 invocations of
> call-process.

Exactly.  So what would be the point of having a general-purpose API
return files that can be useful only with some methods of running a
program?  It will only cause confusion and bug reports.

> > We could
> > make the situation a tad better if we add support for the PATHEXT
> > environment variable, as suggested in bug#7784, patches welcome.
> 
> I've read the bug thread. What exactly does mean to "add support for
> the PATHEXT environment variable"? Making file-executable-p take it
> into account?

That's one part, but it isn't the most important (nor the hardest)
part.

> Are files in the path with one of PATHEXT extensions runnable with
> call-process?

No, PATHEXT is consulted by cmd.exe and AFAIK also the ShellExecute
API.  So to support that, we will need to change sys_spawnve and/or
cmdproxy to detect an extension that appears in PATHEXT, and then
either invoke through cmdproxy or use ShellExecute instead of
CreateProcess.  And this is the more complex part of the job.

> I stumbled upon this because I was trying to understand failures in
> vc-tests.el on Windows, and the reason is that it calls call-process
> to run some shell scripts, like ci. I'd like to fix that and run the
> tests, but I haven't really stared at it long enough to know if
> there's any non-ugly fix.

One non-ugly fix is to use RCS from the ezwinports site.  The binaries
there are 32-bit, but I don't think it will make any difference.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36270; Package emacs. Full text available.

Message received at 36270 <at> debbugs.gnu.org:


Received: (at 36270) by debbugs.gnu.org; 18 Jun 2019 20:50:18 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jun 18 16:50:18 2019
Received: from localhost ([127.0.0.1]:45680 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hdL3a-0008VJ-BM
	for submit <at> debbugs.gnu.org; Tue, 18 Jun 2019 16:50:18 -0400
Received: from mail-qk1-f177.google.com ([209.85.222.177]:35145)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <lekktu@HIDDEN>) id 1hdL3Y-0008V2-7s
 for 36270 <at> debbugs.gnu.org; Tue, 18 Jun 2019 16:50:16 -0400
Received: by mail-qk1-f177.google.com with SMTP id l128so9530192qke.2
 for <36270 <at> debbugs.gnu.org>; Tue, 18 Jun 2019 13:50:16 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to
 :cc; bh=RyApn14whyo8grJ1OzJKIVFMrSpUFy6qithWmUx/SUQ=;
 b=h9qGMaBe1/tmA9wnOtH6nV0ZS+3gnq5wtsMxPzRtBRKrWvKBZdbaasYybEbsZo9//I
 VQy5/h4tFtdlt/MnuCQW0aVb66dJYoOs6YhDuBPILXvILtDvMqb341//5lqDecyehkhy
 jrKByftQe4Wf7yKjmRbkhnIHLpptaatcdQW+50IqJO5g4/y14qUB+V0smNIPDQONvSvm
 k3xn0drbcScY4PHUmWZAc208mD2Z0ksonW9oxxPe3lcrMDO+TKletaSWahnzDfYLI1nE
 g4CMS7RNXfcLjT4mepsyUlzp565vh/FJGjLT2EYy6qmfwYlu9YZWh7BDcPNopVYalhr3
 zv1w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=RyApn14whyo8grJ1OzJKIVFMrSpUFy6qithWmUx/SUQ=;
 b=rCb+NzR2xyw/e3ADtIWuxiQQb6KRTYkjnSagT83ScnIakIoR0EARwR0EvHaw1hhaSW
 DSlrhKdq2KDF4guDYbJ/ZOgdN+KU8k7duwn3oo9enP+Qfz41JyLitKeogJ2/KZ/YeT+R
 MDaLIJYsQNR6zXebSOwcD3ubysctdt9B98LXmxigMl74+ufuT1aQZXzVWuGFI2hMF4Az
 6GHrBpevZn9lUl5K8eC4bVGbJnZeSbODNE5VZ2CFuIu7VCEjsAJQYTzv73fUMQzKEb/n
 P49EVUiF0cnGoTVv6YnLKhDNiGafyefW63dF5A1jVY9si/Dnv47gp6ON85ZjG+Y6lzv9
 FTCA==
X-Gm-Message-State: APjAAAUmZNcwFpxG9DDYEmz9GHEjjOYz2BAjs22EgYRnJVkDuNEon/6I
 HiS29JAlOG4/ZqGhdkJ+uXL810m1uen0fizUf70=
X-Google-Smtp-Source: APXvYqx8Oh99pNBFehI8ncVpah31+FodXXBno/ySMTZSduBUVx8KVyT6SrllYpRD8a1OsBHTde02zN/yluJKQt1hCL4=
X-Received: by 2002:a37:c45:: with SMTP id 66mr78571308qkm.31.1560891010476;
 Tue, 18 Jun 2019 13:50:10 -0700 (PDT)
MIME-Version: 1.0
References: <CAAeL0SQU2t8LwyGJoWpxTpj3ebw=qNr1aT0RS6-ggWBqdYfteQ@HIDDEN>
 <2lef3rrbaa.fsf@HIDDEN>
 <CAAeL0SQcW8Wxb9wGjxV+xaHeZ6KtkfdCObRiyRtTNiUzHHgJow@HIDDEN>
 <83r27qsuox.fsf@HIDDEN>
In-Reply-To: <83r27qsuox.fsf@HIDDEN>
From: Juanma Barranquero <lekktu@HIDDEN>
Date: Tue, 18 Jun 2019 22:49:33 +0200
Message-ID: <CAAeL0SS4zhoqL-ifWzeQ3wRxjCrCAU_vV4oHppSZrcGf-C=9=Q@HIDDEN>
Subject: Re: bug#36270: executable-find does not find shell commands on MSYS2
To: Eli Zaretskii <eliz@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 36270
Cc: Glenn Morris <rgm@HIDDEN>, 36270 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On Tue, Jun 18, 2019 at 6:51 PM Eli Zaretskii <eliz@HIDDEN> wrote:

> We want to declare a file "executable" only if it can be invoked by _all_
> possible means of running an executable file.

Sure. But let's perhaps agree that there's something to be said for
files that are "almost executable". shell-command and variants are
used (counting *very* roughly) about 150 times in the elisp sources,
vs. ~300 invocations of call-process.

> We could
> make the situation a tad better if we add support for the PATHEXT
> environment variable, as suggested in bug#7784, patches welcome.

I've read the bug thread. What exactly does mean to "add support for
the PATHEXT environment variable"? Making file-executable-p take it
into account? Are files in the path with one of PATHEXT extensions
runnable with call-process?

> I might be okay with adding a new function, shell-executable-find,
> say.  But we must first define what that means, exactly, and whether
> it's feasible to implement something like that with reasonable effort
> and complexity.

Yeah, no rush.

> Meanwhile, just set up trivial batch file wrappers for your shell
> scripts, and Bob's your uncle.

Sure. My shell scripts weren't the problem, anyhow. I know how to work
around the issue.

I stumbled upon this because I was trying to understand failures in
vc-tests.el on Windows, and the reason is that it calls call-process
to run some shell scripts, like ci. I'd like to fix that and run the
tests, but I haven't really stared at it long enough to know if
there's any non-ugly fix.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36270; Package emacs. Full text available.

Message received at 36270 <at> debbugs.gnu.org:


Received: (at 36270) by debbugs.gnu.org; 18 Jun 2019 16:51:39 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jun 18 12:51:39 2019
Received: from localhost ([127.0.0.1]:45503 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hdHKc-0001rU-TP
	for submit <at> debbugs.gnu.org; Tue, 18 Jun 2019 12:51:39 -0400
Received: from eggs.gnu.org ([209.51.188.92]:50942)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1hdHKb-0001rG-IQ
 for 36270 <at> debbugs.gnu.org; Tue, 18 Jun 2019 12:51:37 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:48258)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>)
 id 1hdHKW-0007fA-Bu; Tue, 18 Jun 2019 12:51:32 -0400
Received: from [176.228.60.248] (port=3639 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1hdHKU-0004qm-9M; Tue, 18 Jun 2019 12:51:30 -0400
Date: Tue, 18 Jun 2019 19:51:42 +0300
Message-Id: <83r27qsuox.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Juanma Barranquero <lekktu@HIDDEN>
In-reply-to: <CAAeL0SQcW8Wxb9wGjxV+xaHeZ6KtkfdCObRiyRtTNiUzHHgJow@HIDDEN>
 (message from Juanma Barranquero on Tue, 18 Jun 2019 02:57:59 +0200)
Subject: Re: bug#36270: executable-find does not find shell commands on MSYS2
References: <CAAeL0SQU2t8LwyGJoWpxTpj3ebw=qNr1aT0RS6-ggWBqdYfteQ@HIDDEN>
 <2lef3rrbaa.fsf@HIDDEN>
 <CAAeL0SQcW8Wxb9wGjxV+xaHeZ6KtkfdCObRiyRtTNiUzHHgJow@HIDDEN>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 36270
Cc: rgm@HIDDEN, 36270 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Juanma Barranquero <lekktu@HIDDEN>
> Date: Tue, 18 Jun 2019 02:57:59 +0200
> Cc: 36270 <at> debbugs.gnu.org
> 
> Still, there's nothing magic about call-process. Is the native way,
> but not the only way to execute programs on Emacs. Why should
> file-executable-p and executable-find privilege native vs shell
> commands, in contexts where you can run the shell command easily?

Because otherwise we would have inconsistencies: executable-find will
find an "executable" which Emacs may or may not be able to run.  We
want to declare a file "executable" only if it can be invoked by _all_
possible means of running an executable file.

This is a Windows-specific subtlety, because the mechanism for running
arbitrary scripts is different from that of Posix systems.  We could
make the situation a tad better if we add support for the PATHEXT
environment variable, as suggested in bug#7784, patches welcome.  But
this won't solve the problem entirely, when the user has some
interpreter installed which doesn't register itself in PATHEXT.

> (let ((shell-file-name "bash"))
>   (shell-command "ci --version"))
> 
> => 0
> 
> As I said above, there's tension between two meanings of "executable"
> here. Both are meaningful.

I might be okay with adding a new function, shell-executable-find,
say.  But we must first define what that means, exactly, and whether
it's feasible to implement something like that with reasonable effort
and complexity.

Meanwhile, just set up trivial batch file wrappers for your shell
scripts, and Bob's your uncle.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36270; Package emacs. Full text available.
Merged 7784 36270. Request was from Juanma Barranquero <lekktu@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Severity set to 'wishlist' from 'normal' Request was from Juanma Barranquero <lekktu@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 36270 <at> debbugs.gnu.org:


Received: (at 36270) by debbugs.gnu.org; 18 Jun 2019 00:58:44 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jun 17 20:58:43 2019
Received: from localhost ([127.0.0.1]:43505 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hd2SR-0002ZF-Fk
	for submit <at> debbugs.gnu.org; Mon, 17 Jun 2019 20:58:43 -0400
Received: from mail-qk1-f182.google.com ([209.85.222.182]:40467)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <lekktu@HIDDEN>) id 1hd2SO-0002Yr-U3
 for 36270 <at> debbugs.gnu.org; Mon, 17 Jun 2019 20:58:41 -0400
Received: by mail-qk1-f182.google.com with SMTP id c70so7467817qkg.7
 for <36270 <at> debbugs.gnu.org>; Mon, 17 Jun 2019 17:58:40 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to
 :cc; bh=GJd1HYAI+6WHVXFc6CKBI6cRclclN8QIuna4btIXTs8=;
 b=i2JQEanVwbSQj2vFdh4GVnMBCgvJi6IJXRP4vc77vUDqjcGZWmPk8nSadiTwF1CtGv
 N3M4f3MOVwfJmLC92EbriWIgOeLMXFIbOZ/Hf5TGl/zRO7y02GcoOoWKSBK6OlctB6fd
 eWdHMvHwqNMjk9AyurbG8mKf+sed4PH+/M0U1/h9qbbBYi1mn//4bHK/V98PBFHPWwRx
 /oPfYX8Wrxh5UrzUNTSWMd1d+XsbIuh6+LFd3ALZ0D4dpAGnDUl8HC3Rn3EuhzXbWb4U
 sPbMyhV9lk0hbiW4DJpfCA+/GeWPxi8GdCVFK9urkbrKJ/XdHvK8+Yh9VAG6rPanR9te
 zSdg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=GJd1HYAI+6WHVXFc6CKBI6cRclclN8QIuna4btIXTs8=;
 b=DQfGoXh7TsZ0jVXxCmKzlPwUH/5a5FvmpzXy+M+cpBBAg73IVT0pu8zilqJh1s8FRA
 UdpVNoTr5wAJPNCLyHXQqOrh/wJ1kafFWr3cVJxXjRPPXy66L7+eBwv83PVJhjScinP3
 1ltsRhu8SSzFHsw/IQEwcPPnL2sakr1DVCymyc1zJlWpn8j2AMIkZAEZw00hsGF0pSGi
 MGa2WVuiN7GbDBRbZTpJs4OGW969j4woD03iyZT9DEHLddH7O9x2gy6VfgMxJMaZOnOf
 pGBSZmXaVELI20We/p+vwOD4QFrxLwDh5Nrx3eEkW0ACbnU+mknqqgJBRE+IPefQikbC
 pFUQ==
X-Gm-Message-State: APjAAAVVxAnrNMPO+AVhk7iLr31RuLy2Kf8PvBY6Xv7ALpD7gh3C+qKP
 rQnXSuRnJ6/Qvs+dbFZwVIcKccyIXLlEWGQCnOeAEdWhPuc=
X-Google-Smtp-Source: APXvYqxn5wwjWETDCj2qiFVW23XmnnoqMlQybitxit+W0718CV3Mi/pco9WozyKbdvEgmG5PACcQ6y5guC5alWa7KrE=
X-Received: by 2002:a37:ea0c:: with SMTP id t12mr22699854qkj.117.1560819515165; 
 Mon, 17 Jun 2019 17:58:35 -0700 (PDT)
MIME-Version: 1.0
References: <CAAeL0SQU2t8LwyGJoWpxTpj3ebw=qNr1aT0RS6-ggWBqdYfteQ@HIDDEN>
 <2lef3rrbaa.fsf@HIDDEN>
In-Reply-To: <2lef3rrbaa.fsf@HIDDEN>
From: Juanma Barranquero <lekktu@HIDDEN>
Date: Tue, 18 Jun 2019 02:57:59 +0200
Message-ID: <CAAeL0SQcW8Wxb9wGjxV+xaHeZ6KtkfdCObRiyRtTNiUzHHgJow@HIDDEN>
Subject: Re: bug#36270: executable-find does not find shell commands on MSYS2
To: Glenn Morris <rgm@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 36270
Cc: 36270 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

merge 7784 36270
quit


 I hadn't found that one. Thanks.

And yes, it's obviously mostly the same issue. Merged.

Still, there's nothing magic about call-process. Is the native way,
but not the only way to execute programs on Emacs. Why should
file-executable-p and executable-find privilege native vs shell
commands, in contexts where you can run the shell command easily?

(let ((shell-file-name "bash"))
  (shell-command "ci --version"))

=> 0

As I said above, there's tension between two meanings of "executable"
here. Both are meaningful.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36270; Package emacs. Full text available.

Message received at 36270 <at> debbugs.gnu.org:


Received: (at 36270) by debbugs.gnu.org; 18 Jun 2019 00:24:07 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jun 17 20:24:07 2019
Received: from localhost ([127.0.0.1]:43493 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hd1ux-0001ia-Gb
	for submit <at> debbugs.gnu.org; Mon, 17 Jun 2019 20:24:07 -0400
Received: from eggs.gnu.org ([209.51.188.92]:48360)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rgm@HIDDEN>) id 1hd1uv-0001i6-BK
 for 36270 <at> debbugs.gnu.org; Mon, 17 Jun 2019 20:24:05 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:60480)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <rgm@HIDDEN>)
 id 1hd1uq-00055t-7a; Mon, 17 Jun 2019 20:24:00 -0400
Received: from rgm by fencepost.gnu.org with local (Exim 4.82)
 (envelope-from <rgm@HIDDEN>)
 id 1hd1un-0007jc-Hr; Mon, 17 Jun 2019 20:23:57 -0400
From: Glenn Morris <rgm@HIDDEN>
To: Juanma Barranquero <lekktu@HIDDEN>
Subject: Re: bug#36270: executable-find does not find shell commands on MSYS2
References: <CAAeL0SQU2t8LwyGJoWpxTpj3ebw=qNr1aT0RS6-ggWBqdYfteQ@HIDDEN>
X-Spook: bootleg 2600 Capricorn UMTS SAPO World Trade Center
X-Ran: ,L:MJ<koFFv4`w&bi@a}|eGFemz6V@&!BF>R`efvUN*9d]}6uPnq/Bo>03T}ue\gj]>ZQJ
X-Hue: red
X-Debbugs-No-Ack: yes
X-Attribution: GM
Date: Mon, 17 Jun 2019 20:23:57 -0400
In-Reply-To: <CAAeL0SQU2t8LwyGJoWpxTpj3ebw=qNr1aT0RS6-ggWBqdYfteQ@HIDDEN>
 (Juanma Barranquero's message of "Tue, 18 Jun 2019 01:42:29 +0200")
Message-ID: <2lef3rrbaa.fsf@HIDDEN>
User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/)
MIME-Version: 1.0
Content-Type: text/plain
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 36270
Cc: 36270 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)


https://debbugs.gnu.org/7784 ?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36270; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 17 Jun 2019 23:43:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jun 17 19:43:11 2019
Received: from localhost ([127.0.0.1]:43469 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hd1HL-0000kA-7Y
	for submit <at> debbugs.gnu.org; Mon, 17 Jun 2019 19:43:11 -0400
Received: from lists.gnu.org ([209.51.188.17]:59076)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <lekktu@HIDDEN>) id 1hd1HJ-0000k1-E5
 for submit <at> debbugs.gnu.org; Mon, 17 Jun 2019 19:43:09 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:49950)
 by lists.gnu.org with esmtp (Exim 4.86_2)
 (envelope-from <lekktu@HIDDEN>) id 1hd1HI-0000vo-5N
 for bug-gnu-emacs@HIDDEN; Mon, 17 Jun 2019 19:43:09 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM,
 URIBL_BLOCKED autolearn=disabled version=3.3.2
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <lekktu@HIDDEN>) id 1hd1HG-00027s-OH
 for bug-gnu-emacs@HIDDEN; Mon, 17 Jun 2019 19:43:08 -0400
Received: from mail-qt1-x829.google.com ([2607:f8b0:4864:20::829]:37447)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <lekktu@HIDDEN>) id 1hd1HG-000279-Ix
 for bug-gnu-emacs@HIDDEN; Mon, 17 Jun 2019 19:43:06 -0400
Received: by mail-qt1-x829.google.com with SMTP id y57so13101680qtk.4
 for <bug-gnu-emacs@HIDDEN>; Mon, 17 Jun 2019 16:43:06 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=mime-version:from:date:message-id:subject:to
 :content-transfer-encoding;
 bh=Z5SygoWcAdLYXycEIHpMjjBuTvR/p/OysI2/ara6I4s=;
 b=ckwEbNC9OxGxJwpPcgXlUmqxlhjLQQntiHx9xecImHKQh74BnOPLsMQgiLaICBft/3
 dtG60OBWv9HQtghgO5cZwxrH5lNTX+eUwvnG4FNfFBmPdYKFLmYJRvd0woSgNycyomGv
 tE9Ml63BxzkX/J1O7BRkus273abGdJj9cMDxZ5Hk2ii+ewV7uFjyFNWY0TUamYgaFqzc
 8T/5T8X0W62bfXij4VVBZ4LmP4nwI6POC4OCThRByw5LLEeMxyI1BCUYEx16ND8Mq/aa
 8NiQMfyJ8/ly7n/h8ry4bk2icxNWfcBdii4S+OtI83fz9IZksOf9EcwKF0vZVOp7R0pv
 hoyA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:from:date:message-id:subject:to
 :content-transfer-encoding;
 bh=Z5SygoWcAdLYXycEIHpMjjBuTvR/p/OysI2/ara6I4s=;
 b=lJFSyMnthFry/l8yHhunkmbvpvSm6VOajcwiWT1Tc9PteW5AX1+HBIPjviG5Ixbv3F
 fM4Eljbh8eIVlxaGD/Sh33VPKOPSvpzW6vgJrVUw/ijgVjCs+0LIgZMZNlUpvIQamVG9
 /Cy4YwgX7bACnmsPb0/DjtpROuKcoce5A351SSbScSHjTX55S4qFP4gtlcAkOvjuyNFk
 P/B8dsJ/h9X41kUCXjPVs+G45eASPK731BX+wRL7d8mhFSvBxBCadWNdiiShSRgPhAwM
 yR6E5Vuo/KpzylhAH1D8rvHtOULIm2+2teb+FLQSkCl5mBkhTrD8/NR9jK1V59FwKKuf
 5+Xg==
X-Gm-Message-State: APjAAAWShHhvsDkdt7Nsfa+ZH5TmUVE16vpDF3+i74Ok5/+WPLSLSY1s
 66a5rJkkofJ2X1fjzIKg2SxTJdDPGDqEX52nBj3NXlqIZXU=
X-Google-Smtp-Source: APXvYqxRk7dppJQO01/W+gLtOSGd1WaLzL1F7MQLzcKb143qyQnUfe7vZ9g2pBrpSiLw3jq3fRqdAvoEm2OExgwfJS4=
X-Received: by 2002:a0c:8a23:: with SMTP id 32mr24655580qvt.231.1560814985604; 
 Mon, 17 Jun 2019 16:43:05 -0700 (PDT)
MIME-Version: 1.0
From: Juanma Barranquero <lekktu@HIDDEN>
Date: Tue, 18 Jun 2019 01:42:29 +0200
Message-ID: <CAAeL0SQU2t8LwyGJoWpxTpj3ebw=qNr1aT0RS6-ggWBqdYfteQ@HIDDEN>
Subject: executable-find does not find shell commands on MSYS2
To: Bug-Gnu-Emacs <bug-gnu-emacs@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-Received-From: 2607:f8b0:4864:20::829
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

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=3D0,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.htm=
l>
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.htm=
l>
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 =E2=80=98exec-path=E2=80=99 and return the absolute f=
ile name.
Return nil if COMMAND is not found anywhere in =E2=80=98exec-path=E2=80=99.


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.




Acknowledgement sent to Juanma Barranquero <lekktu@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#36270; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.