From unknown Mon Aug 18 17:54:38 2025 X-Loop: help-debbugs@gnu.org Subject: bug#7793: inconsistent behavior of exec-path Resent-From: Sam Steingold Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 05 Jan 2011 23:03:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 7793 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 7793@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.129426852524855 (code B ref -1); Wed, 05 Jan 2011 23:03:01 +0000 Received: (at submit) by debbugs.gnu.org; 5 Jan 2011 23:02:05 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PacMn-0006Sq-01 for submit@debbugs.gnu.org; Wed, 05 Jan 2011 18:02:05 -0500 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PacMl-0006SN-I2 for submit@debbugs.gnu.org; Wed, 05 Jan 2011 18:02:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PacTi-0001iu-Uj for submit@debbugs.gnu.org; Wed, 05 Jan 2011 18:09:16 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RFC_ABUSE_POST, T_DKIM_INVALID, T_TO_NO_BRKTS_FREEMAIL autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:43266) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PacTD-0001bZ-KT for submit@debbugs.gnu.org; Wed, 05 Jan 2011 18:09:14 -0500 Received: from [140.186.70.92] (port=41731 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PacSn-0006SC-10 for bug-gnu-emacs@gnu.org; Wed, 05 Jan 2011 18:08:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PacSN-0001Vm-5I for bug-gnu-emacs@gnu.org; Wed, 05 Jan 2011 18:07:52 -0500 Received: from mail-ew0-f41.google.com ([209.85.215.41]:43372) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PacSM-0001Vd-Uo for bug-gnu-emacs@gnu.org; Wed, 05 Jan 2011 18:07:51 -0500 Received: by ewy27 with SMTP id 27so7870423ewy.0 for ; Wed, 05 Jan 2011 15:07:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received:date :x-google-sender-auth:message-id:subject:from:to:content-type; bh=SiJUwV0RX+FPwFuwnzr7Vg4iL96UoQS6LaKkktSMQTk=; b=dJaWGlbjJkpbsOYj+0jn2KiC462r39XN2mDJO4iGX/xyykfnodve9AEXk7vQlHohcw r26tWwM2qBBEDM5XgdOzCi9ysx67OGawloIW+2LYMKV/Y1G2Kc0Cycoqozhspd4Nat3d 7SpHlNIQQ3Ux0JPnvcr2k5BuSm23JnFcnD17k= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type; b=VeYEc1irzORkqnbTLmw/6woxT0/5RjEFO/uRuCVO86za/DNYn9LJV02rsSM6mI5MKD XahMKqzqYU9sGVp/7v2raJpU55YD7Wqw4aTbFaEEQPZYM2UGj1BjQg5upMHTVtQQTbrC x92HtuAZXXxT23QR3SMmW8XevEqbsAigJriIk= MIME-Version: 1.0 Received: by 10.213.17.75 with SMTP id r11mr32376eba.66.1294268868122; Wed, 05 Jan 2011 15:07:48 -0800 (PST) Received: by 10.14.127.207 with HTTP; Wed, 5 Jan 2011 15:07:48 -0800 (PST) Date: Wed, 5 Jan 2011 18:07:48 -0500 X-Google-Sender-Auth: 7jskSJWpPBOZH8mQdBJ7crXsggQ Message-ID: From: Sam Steingold Content-Type: text/plain; charset=UTF-8 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Spam-Score: -5.1 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.1 (-----) suppose you have two directories (A&B) which contain two different executables with the same name (N). e.g., find.exe(N) in both "c:/gnu/gnuwin32/bin"(A) and "c:/WINDOWS/system32"(B). if A follows B in $PATH, then M-x shell-command will call A/N for N even if I manually swap A & B in exec-path. So far so good. However, if I run rgrep in "emacs -q", it fails because by default B is before A in PATH and exec-path; while if I push A to the beginning of exec-path before the first invocation of rgrep, rgrep will find and use the good N. this inconsistency is bad and together with bugs http://debbugs.gnu.org/cgi/bugreport.cgi?bug=6784 and http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7785 is causing me much grief in my first encounter with windows in 4 years. thanks. -- Sam Steingold From unknown Mon Aug 18 17:54:38 2025 X-Loop: help-debbugs@gnu.org Subject: bug#7793: inconsistent behavior of exec-path Resent-From: Eli Zaretskii Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 06 Jan 2011 10:04:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 7793 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Sam Steingold Cc: 7793@debbugs.gnu.org Reply-To: Eli Zaretskii Received: via spool by 7793-submit@debbugs.gnu.org id=B7793.129430820516829 (code B ref 7793); Thu, 06 Jan 2011 10:04:02 +0000 Received: (at 7793) by debbugs.gnu.org; 6 Jan 2011 10:03:25 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Pamgn-0004NO-3X for submit@debbugs.gnu.org; Thu, 06 Jan 2011 05:03:25 -0500 Received: from fencepost.gnu.org ([140.186.70.10]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Pamgl-0004NB-3B for 7793@debbugs.gnu.org; Thu, 06 Jan 2011 05:03:23 -0500 Received: from eliz by fencepost.gnu.org with local (Exim 4.69) (envelope-from ) id 1Pamnh-0008P2-Io; Thu, 06 Jan 2011 05:10:33 -0500 From: Eli Zaretskii In-reply-to: (message from Sam Steingold on Wed, 5 Jan 2011 18:07:48 -0500) References: Message-Id: Date: Thu, 06 Jan 2011 05:10:33 -0500 X-Spam-Score: -6.5 (------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.5 (------) > Date: Wed, 5 Jan 2011 18:07:48 -0500 > From: Sam Steingold > Cc: > > suppose you have two directories (A&B) which contain two different > executables with the same name (N). > e.g., find.exe(N) in both "c:/gnu/gnuwin32/bin"(A) and "c:/WINDOWS/system32"(B). > if A follows B in $PATH, then M-x shell-command will call A/N for N > even if I manually swap A & B in exec-path. You mean "iff", not "even if", right? Because if you do _not_ swap A and B in exec-path, I'd expect B/N to be invoked, since B precedes A in PATH. Am I missing something? > However, if I run rgrep in "emacs -q", it fails because by default B > is before A in PATH and exec-path; > while if I push A to the beginning of exec-path before the first > invocation of rgrep, rgrep will find and use the good N. I used to play such games with PATH and exec-path (and a few other related variables) inside Emacs, but then I grew older and wiser. Please consider taking advice of my gray hair: don't do that. Do _not_ have values of PATH, exec-path, process-environment, etc. that have the same directories in different order. That way lies madness, believe me. The reason for this is very basic, on Windows as on Unix: exec-path is used only for the program that Emacs invokes directly. If that program invokes other programs, it will look them up on PATH. So having conflicting orders in PATH and exec-path means that programs invoked through call-process and programs invoked through shell-command will be searched for using different order of directories. To get deterministic behavior out of this, you'd need to know, for every Emacs command, whether it uses the former or the latter, and even if you do, I don't think you will be able to set both PATH and exec-path correctly for all your use-cases (including all the bugs, misfeatures, and subtle incompatibilities of the Windows ports of GNU software). FWIW, I don't think the inconsistency that is the subject of this bug can be resolved in any reasonable way. The separation between exec-path and PATH is deliberate in Emacs, so setting one from the other will not DTRT at least for some use-cases. > this inconsistency is bad and together with bugs > http://debbugs.gnu.org/cgi/bugreport.cgi?bug=6784 > and > http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7785 > is causing me much grief in my first encounter with windows in 4 years. I'm sorry about your trouble. To save some of it in the future, I'd suggest: . Put the GnuWin32 directory _before_ the Windows directories in PATH . If you need to use Cygwin executables in the same session as GnuWin32, decide on the order between them according to your needs; if you only use one or the other, throw together a bunch of batch files that reorder PATH for each one, and invoke the one you need when you need it (you can have a separate setting in each shell window) . Don't reshuffle exec-path and process-environment in your .emacs . If needed, and only as a last resort (if PATH reordering doesn't help), rename a few ported programs (e.g. find->gfind or date->gdate), so that Windows versions don't come in the way (you may need to customize a few variables if you do this, e.g. find-program for "gfind") I find this arrangement to be a much saner one, and it works very well for me for years. From unknown Mon Aug 18 17:54:38 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.428 (Entity 5.428) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Sam Steingold Subject: bug#7793: closed (Re: bug#7793: inconsistent behavior of exec-path) Message-ID: References: X-Gnu-PR-Message: they-closed 7793 X-Gnu-PR-Package: emacs Reply-To: 7793@debbugs.gnu.org Date: Fri, 03 Feb 2012 22:32:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1328308322-23160-1" This is a multi-part message in MIME format... ------------=_1328308322-23160-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #7793: inconsistent behavior of exec-path which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 7793@debbugs.gnu.org. --=20 7793: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D7793 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1328308322-23160-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 7793-done) by debbugs.gnu.org; 3 Feb 2012 22:31:55 +0000 Received: from localhost ([127.0.0.1]:52855 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RtRfe-00061H-RA for submit@debbugs.gnu.org; Fri, 03 Feb 2012 17:31:54 -0500 Received: from fencepost.gnu.org ([140.186.70.10]:53076 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RtRfc-00061B-J4 for 7793-done@debbugs.gnu.org; Fri, 03 Feb 2012 17:31:53 -0500 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1RtRf3-0002Nz-3s; Fri, 03 Feb 2012 17:31:17 -0500 From: Glenn Morris To: 7793-done@debbugs.gnu.org Subject: Re: bug#7793: inconsistent behavior of exec-path References: X-Spook: CipherTAC-2000 sniper eternity server Serbian Aladdin X-Ran: lEsy.X,gZWl<"l(Eb]bPS;0j|}VMz*hv9#.l\@,WMso\[m5o;KG*@pUU|(jXJk-/PnpzD] X-Hue: magenta X-Attribution: GM Date: Fri, 03 Feb 2012 17:31:17 -0500 In-Reply-To: (Eli Zaretskii's message of "Thu, 06 Jan 2011 05:10:33 -0500") Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: 7793-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.2 (----) Eli Zaretskii wrote: > FWIW, I don't think the inconsistency that is the subject of this bug > can be resolved in any reasonable way. The separation between > exec-path and PATH is deliberate in Emacs, so setting one from the > other will not DTRT at least for some use-cases. I am closing this report. ------------=_1328308322-23160-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 5 Jan 2011 23:02:05 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PacMn-0006Sq-01 for submit@debbugs.gnu.org; Wed, 05 Jan 2011 18:02:05 -0500 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PacMl-0006SN-I2 for submit@debbugs.gnu.org; Wed, 05 Jan 2011 18:02:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PacTi-0001iu-Uj for submit@debbugs.gnu.org; Wed, 05 Jan 2011 18:09:16 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RFC_ABUSE_POST, T_DKIM_INVALID, T_TO_NO_BRKTS_FREEMAIL autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:43266) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PacTD-0001bZ-KT for submit@debbugs.gnu.org; Wed, 05 Jan 2011 18:09:14 -0500 Received: from [140.186.70.92] (port=41731 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PacSn-0006SC-10 for bug-gnu-emacs@gnu.org; Wed, 05 Jan 2011 18:08:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PacSN-0001Vm-5I for bug-gnu-emacs@gnu.org; Wed, 05 Jan 2011 18:07:52 -0500 Received: from mail-ew0-f41.google.com ([209.85.215.41]:43372) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PacSM-0001Vd-Uo for bug-gnu-emacs@gnu.org; Wed, 05 Jan 2011 18:07:51 -0500 Received: by ewy27 with SMTP id 27so7870423ewy.0 for ; Wed, 05 Jan 2011 15:07:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received:date :x-google-sender-auth:message-id:subject:from:to:content-type; bh=SiJUwV0RX+FPwFuwnzr7Vg4iL96UoQS6LaKkktSMQTk=; b=dJaWGlbjJkpbsOYj+0jn2KiC462r39XN2mDJO4iGX/xyykfnodve9AEXk7vQlHohcw r26tWwM2qBBEDM5XgdOzCi9ysx67OGawloIW+2LYMKV/Y1G2Kc0Cycoqozhspd4Nat3d 7SpHlNIQQ3Ux0JPnvcr2k5BuSm23JnFcnD17k= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type; b=VeYEc1irzORkqnbTLmw/6woxT0/5RjEFO/uRuCVO86za/DNYn9LJV02rsSM6mI5MKD XahMKqzqYU9sGVp/7v2raJpU55YD7Wqw4aTbFaEEQPZYM2UGj1BjQg5upMHTVtQQTbrC x92HtuAZXXxT23QR3SMmW8XevEqbsAigJriIk= MIME-Version: 1.0 Received: by 10.213.17.75 with SMTP id r11mr32376eba.66.1294268868122; Wed, 05 Jan 2011 15:07:48 -0800 (PST) Received: by 10.14.127.207 with HTTP; Wed, 5 Jan 2011 15:07:48 -0800 (PST) Date: Wed, 5 Jan 2011 18:07:48 -0500 X-Google-Sender-Auth: 7jskSJWpPBOZH8mQdBJ7crXsggQ Message-ID: Subject: inconsistent behavior of exec-path From: Sam Steingold To: bug-gnu-emacs@gnu.org Content-Type: text/plain; charset=UTF-8 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Spam-Score: -5.1 (-----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.1 (-----) suppose you have two directories (A&B) which contain two different executables with the same name (N). e.g., find.exe(N) in both "c:/gnu/gnuwin32/bin"(A) and "c:/WINDOWS/system32"(B). if A follows B in $PATH, then M-x shell-command will call A/N for N even if I manually swap A & B in exec-path. So far so good. However, if I run rgrep in "emacs -q", it fails because by default B is before A in PATH and exec-path; while if I push A to the beginning of exec-path before the first invocation of rgrep, rgrep will find and use the good N. this inconsistency is bad and together with bugs http://debbugs.gnu.org/cgi/bugreport.cgi?bug=6784 and http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7785 is causing me much grief in my first encounter with windows in 4 years. thanks. -- Sam Steingold ------------=_1328308322-23160-1-- From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 03 17:32:30 2012 Received: (at control) by debbugs.gnu.org; 3 Feb 2012 22:32:30 +0000 Received: from localhost ([127.0.0.1]:52861 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RtRgE-00062j-5o for submit@debbugs.gnu.org; Fri, 03 Feb 2012 17:32:30 -0500 Received: from fencepost.gnu.org ([140.186.70.10]:53089 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RtRgC-00062d-GL for control@debbugs.gnu.org; Fri, 03 Feb 2012 17:32:28 -0500 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1RtRfd-0002Ql-GT for control@debbugs.gnu.org; Fri, 03 Feb 2012 17:31:53 -0500 Date: Fri, 03 Feb 2012 17:31:53 -0500 Message-Id: Subject: control message for bug 7793 To: X-Mailer: mail (GNU Mailutils 2.1) From: Glenn Morris X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.2 (----) tag 7793 notabug wontfix