GNU bug report logs - #7923
23.2; Shell PATH environment variable problem

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,ns; Reported by: John McHugh <mchugh <at> cs.unc.edu>; dated Wed, 26 Jan 2011 21:30:03 UTC; Maintainer for emacs is bug-gnu-emacs <at> gnu.org.

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


Received: (at 7923) by debbugs.gnu.org; 27 Jan 2011 22:25:44 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 27 17:25:44 2011
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1PiaHg-0000J1-Kg
	for submit <at> debbugs.gnu.org; Thu, 27 Jan 2011 17:25:44 -0500
Received: from fafnir.cs.unc.edu ([152.2.129.90])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <mchugh <at> cs.unc.edu>) id 1PiaHf-0000Io-7V
	for 7923 <at> debbugs.gnu.org; Thu, 27 Jan 2011 17:25:43 -0500
Received: from [69.22.144.226] ([69.22.144.226]) (authenticated bits=0)
	by fafnir.cs.unc.edu (8.14.3/8.14.3) with ESMTP id p0RMXk8Y031450
	(version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO);
	Thu, 27 Jan 2011 17:33:52 -0500
Subject: Re: bug#7923: 23.2; Shell PATH environment variable problem
Mime-Version: 1.0 (Apple Message framework v1082)
Content-Type: text/plain; charset=us-ascii
From: John McHugh <mchugh <at> cs.unc.edu>
In-Reply-To: <jwvd3njkn6z.fsf-monnier+emacs <at> gnu.org>
Date: Thu, 27 Jan 2011 17:33:41 -0500
Content-Transfer-Encoding: quoted-printable
Message-Id: <BBF4696D-A791-4571-8E4E-9C6A08ECE91C <at> cs.unc.edu>
References: <41BA395F-882C-4220-8783-DD0835920415 <at> cs.unc.edu>
	<jwvd3njkn6z.fsf-monnier+emacs <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
X-Mailer: Apple Mail (2.1082)
X-Scanned-By: MIMEDefang 2.71 on 152.2.129.90
X-Spam-Score: -4.3 (----)
X-Debbugs-Envelope-To: 7923
Cc: 7923 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/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: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -3.7 (---)

Stefan

I don't think this is the problem

In OS X, Leopard, the initial $PATH setting comes from a property list =
file

~/.MacOSX/environment.plist =20

This file contains a list of properties and their initial values.  In =
this case, the properties are environment variables.
The value for the PATH is=20

/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin

According to the OS X Leopard documentation, the contents of files in =
/etc/paths.d is then added to PATH.  This allows software packages to =
add their specific bin directories without consideration of the specific =
shell to be used, or the user using the machine.  Installing X11 adds a =
file to this directory containing the path to X11 binaries.

Now, if I issue the emacs command "shell-command echo $PATH" I get the =
PATH value that is in the plist file.  If I change the plist file, =
output of that command changes, as well.

What is not happening is that the additional files in /etc/paths.d are =
not being added to the path.

Since my shell for shell windows in emacs is bash, my .bashrc file is =
being executed since, they appear in the PATH echoed from a shell window =
in emacs.

Is there an explanation of how emacs sets the path for shell commands?

John





Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7923; Package emacs,ns. Full text available.

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


Received: (at 7923) by debbugs.gnu.org; 27 Jan 2011 04:02:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jan 26 23:02:33 2011
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1PiJ45-0000dC-Na
	for submit <at> debbugs.gnu.org; Wed, 26 Jan 2011 23:02:33 -0500
Received: from ironport2-out.teksavvy.com ([206.248.154.181]
	helo=ironport2-out.pppoe.ca)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <monnier <at> iro.umontreal.ca>) id 1PiJ44-0000d3-KA
	for 7923 <at> debbugs.gnu.org; Wed, 26 Jan 2011 23:02:33 -0500
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: AvsEAJt/QE1MCo4O/2dsb2JhbACke3S7doMCEAGCPASFGI9wgzY
X-IronPort-AV: E=Sophos;i="4.60,384,1291611600"; d="scan'208";a="89379352"
Received: from 76-10-142-14.dsl.teksavvy.com (HELO ceviche.home)
	([76.10.142.14])
	by ironport2-out.pppoe.ca with ESMTP/TLS/ADH-AES256-SHA;
	26 Jan 2011 23:10:29 -0500
Received: by ceviche.home (Postfix, from userid 20848)
	id A1802660DC; Wed, 26 Jan 2011 23:10:29 -0500 (EST)
From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: John McHugh <mchugh <at> cs.unc.edu>
Subject: Re: bug#7923: 23.2; Shell PATH environment variable problem
Message-ID: <jwvd3njkn6z.fsf-monnier+emacs <at> gnu.org>
References: <41BA395F-882C-4220-8783-DD0835920415 <at> cs.unc.edu>
Date: Wed, 26 Jan 2011 23:10:29 -0500
In-Reply-To: <41BA395F-882C-4220-8783-DD0835920415 <at> cs.unc.edu> (John McHugh's
	message of "Wed, 26 Jan 2011 16:34:51 -0500")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.1 (--)
X-Debbugs-Envelope-To: 7923
Cc: 7923 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/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: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -2.1 (--)

> from MacTeX-2010.  I noticed that tex programs were in the PATH in a
> terminal shell, but not in an emacs shell.  Ultimately, I discovered

IIUC the difference is because Terminal.app runs the shell as a login
shell (which is a somewhat unusual choice, for an old Unix guy), whereas
Emacs's M-x shell doesn't.

You can make your .bashrc to source /etc/profile.

Tho maybe your better choice will be to try and make Emacs's own PATH to
be set properly (i.e. have it run your path_helper somehow).


        Stefan




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7923; Package emacs,ns. Full text available.

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


Received: (at submit) by debbugs.gnu.org; 26 Jan 2011 21:29:30 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jan 26 16:29:29 2011
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1PiCve-0008E0-M1
	for submit <at> debbugs.gnu.org; Wed, 26 Jan 2011 16:29:27 -0500
Received: from eggs.gnu.org ([140.186.70.92])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <mchugh <at> cs.unc.edu>) id 1PiCtP-00089W-C8
	for submit <at> debbugs.gnu.org; Wed, 26 Jan 2011 16:27:08 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <mchugh <at> cs.unc.edu>) id 1PiD1G-0007NJ-7x
	for submit <at> debbugs.gnu.org; Wed, 26 Jan 2011 16:35:15 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD
	autolearn=unavailable version=3.3.1
Received: from lists.gnu.org ([199.232.76.165]:41245)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <mchugh <at> cs.unc.edu>) id 1PiD1G-0007NF-5E
	for submit <at> debbugs.gnu.org; Wed, 26 Jan 2011 16:35:14 -0500
Received: from [140.186.70.92] (port=38711 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1PiD1E-0000zP-VZ
	for bug-gnu-emacs <at> gnu.org; Wed, 26 Jan 2011 16:35:14 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <mchugh <at> cs.unc.edu>) id 1PiD1D-0007N3-H0
	for bug-gnu-emacs <at> gnu.org; Wed, 26 Jan 2011 16:35:12 -0500
Received: from fafnir.cs.unc.edu ([152.2.129.90]:41395)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <mchugh <at> cs.unc.edu>) id 1PiD1D-0007MR-B6
	for bug-gnu-emacs <at> gnu.org; Wed, 26 Jan 2011 16:35:11 -0500
Received: from [69.22.144.223] ([69.22.144.223]) (authenticated bits=0)
	by fafnir.cs.unc.edu (8.14.3/8.14.3) with ESMTP id p0QLYvvX028083
	(version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO)
	for <bug-gnu-emacs <at> gnu.org>; Wed, 26 Jan 2011 16:35:02 -0500
From: John McHugh <mchugh <at> cs.unc.edu>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: quoted-printable
Subject: 23.2; Shell PATH environment variable problem
Date: Wed, 26 Jan 2011 16:34:51 -0500
Message-Id: <41BA395F-882C-4220-8783-DD0835920415 <at> cs.unc.edu>
To: bug-gnu-emacs <at> gnu.org
Mime-Version: 1.0 (Apple Message framework v1082)
X-Mailer: Apple Mail (2.1082)
X-Scanned-By: MIMEDefang 2.71 on 152.2.129.90
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Spam-Score: -5.9 (-----)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Wed, 26 Jan 2011 16:29:25 -0500
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/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: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -5.9 (-----)

From: John McHugh <mchugh <at> John-McHughs-MacBook-Pro.local>

This seems to be specific to OS X Leopard

I use bash as my emacs shell. I loaded 23.2.1 yesterday using
"homebrew", replacing an earlier version from macports which I
removed. along with a large number of applications.  I reinstalled TeX
from MacTeX-2010.  I noticed that tex programs were in the PATH in a
terminal shell, but not in an emacs shell.  Ultimately, I discovered
that the new TeX install had added a file with the path for TeX binaries
to /etc/paths.d/ and that none of the paths from these files were in the
PATH for the emacs shell but they were in the path for terminal shells.

As far as I can tell, emacs is obtaining the default PATH from
~/.MacOSX/environment.plist and then executing my .bashrc (or .profile
which is identical), but is not invoking the /etc/profile nor is it
calling "/usr/libexec/path_helper -s" which augments the defaults and is
called in /etc/profile.

My workaround is to create a .emacs_bash file which contains the line

eval `/usr/libexec/path_helper -s`

This provides the correct path at the minor expense of two command
prompts on the first line of the resulting shell buffer.

John McHugh

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

In GNU Emacs 23.2.1 (x86_64-apple-darwin10.6.0, NS apple-appkit-1038.35)
 of 2011-01-25 on John-McHughs-MacBook-Pro.local
Windowing system distributor `Apple', version 10.3.1038
configured using `configure  '--prefix=3D/usr/local/Cellar/emacs/23.2' =
'--without-dbus' =
'--enable-locallisppath=3D/usr/local/share/emacs/site-lisp' =
'--infodir=3D/usr/local/Cellar/emacs/23.2/share/info/emacs' '--with-ns' =
'--disable-ns-self-contained' 'CC=3D/usr/bin/cc' 'CFLAGS=3D-O3 -w =
-pipe''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: nil
  value of $XMODIFIERS: nil
  locale-coding-system: nil
  default enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
  shell-dirtrack-mode: t
  display-time-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
<mouse-1> C-x b * s c r <tab> <return> M-v C-y <help-echo>=20
<help-echo> <down-mouse-1> <mouse-1> <down-mouse-1>=20
<mouse-1> M-x c o m p a r e SPC w SPC <return> <down-mouse-1>=20
<mouse-1> <help-echo> <down-mouse-1> <mouse-1> C-x=20
b p r <tab> <backspace> <backspace> . e m a <tab> <backspace>=20
<backspace> <backspace> C-g g C-x C-r . e m a <tab>=20
b <tab> <backspace> _ <tab> <return> <help-echo> <help-echo>=20
<help-echo> <help-echo> <down-mouse-1> <mouse-movement>=20
<mouse-movement> <drag-mouse-1> <down-mouse-1> <mouse-movement>=20
<mouse-movement> <drag-mouse-1> <help-echo> <down-mouse-1>=20
<mouse-1> C-y <return> e c h o SPC $ P A T H <return>=20
<help-echo> <help-echo> <down-mouse-1> <mouse-1> C-x=20
b <return> <down-mouse-1> <mouse-1> <help-echo> <down-mouse-1>=20
<mouse-1> M-x c o m p a r e SPC w SPC <return> <help-echo>=20
<help-echo> <down-mouse-1> <help-echo> <mouse-movement>=20
<mouse-movement> <drag-mouse-1> <help-echo> <down-mouse-1>=20
<mouse-1> C-x b <return> <up> <up> C-k C-x C-q C-a=20
C-k C-k C-d C-x C-s <help-echo> C-o e c h o SPC f o=20
o <down-mouse-1> <wheel-up> <drag-mouse-1> e c h o=20
SPC b a r <return> C-x C-s <help-echo> <down-mouse-1>=20
<mouse-1> C-x j C-x k <return> y e s <return> <backspace>=20
M-x s h e k k <backspace> <backspace> l l <return>=20
e c h o SPC $ P A T H <return> <help-echo> <down-mouse-1>=20
<mouse-1> C-x b <return> <down-mouse-1> <mouse-1> <help-echo>=20
<down-mouse-1> <mouse-1> M-x c o m p a r e SPC w SPC=20
<return> <down-mouse-1> <mouse-1> C-x b <return> <up>=20
<up> <up> C-k C-k <down> C-k C-k C-x C-s <down-mouse-1>=20
<mouse-1> C-x k <return> y e s <return> M-x s h e l=20
l <return> <return> e c h o SPC $ P A T H <return>=20
<down-mouse-1> <mouse-1> <down-mouse-1> <mouse-1> C-x=20
b <return> <up> <up> <up> M-x c o m p a r e SPC w SPC=20
<return> <help-echo> M-x r e p o r t - e m <tab> <
return>

Recent messages:
Saving file /Users/mchugh/.emacs_bash...
Wrote /Users/mchugh/.emacs_bash
byte-code: Beginning of buffer
Mark set
Saving file /Users/mchugh/.emacs_bash...
Wrote /Users/mchugh/.emacs_bash
Mark set
Saving file /Users/mchugh/.emacs_bash...
Wrote /Users/mchugh/.emacs_bash
Mark set

Load-path shadows:
None found.

Features:
(shadow sort mail-extr message ecomplete rfc822 mml mml-sec
password-cache mm-decode mm-bodies mm-encode mailcap mail-parse rfc2231
rfc2047 rfc2045 qp ietf-drums mailabbrev nnheader gnus-util netrc
time-date mm-util mail-prsvr gmm-utils mailheader canlock sha1 hex-util
hashcash mail-utils emacsbug compare-w multi-isearch dired-aux dired
regexp-opt cus-edit wid-edit pp help-mode view apropos help-fns
ansi-color shell comint ring time cus-start cus-load tooltip ediff-hook
vc-hooks lisp-float-type mwheel ns-win easymenu tool-bar dnd fontset
image fringe lisp-mode register page menu-bar rfn-eshadow timer select
scroll-bar mldrag mouse jit-lock font-lock syntax facemenu font-core
frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai
tai-viet lao korean japanese hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help
simple abbrev loaddefs button minibuffer faces cus-face files
text-properties overlay md5 base64 format env code-pages mule custom
widget hashtable-print-readable backquote make-network-process ns
multi-tty emacs)





Acknowledgement sent to John McHugh <mchugh <at> cs.unc.edu>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. Full text available.
Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7923; 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: Tue, 20 Sep 2011 19:45:02 UTC

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