zsh-users
 help / color / mirror / code / Atom feed
* PATH reordered when running zsh inside screen on Mac OS X Mountain Lion and MacPorts
@ 2013-01-28  9:15 Nikolai Weibull
  2013-01-28  9:33 ` rahul
  2013-01-28  9:58 ` Peter Stephenson
  0 siblings, 2 replies; 10+ messages in thread
From: Nikolai Weibull @ 2013-01-28  9:15 UTC (permalink / raw)
  To: Zsh Users

Hi!

For some reason, my PATH is being reordered when running zsh 5.0.2
inside screen 4.0.3 on Mac OS X Mountain Lion, installed via MacPorts.
 I’ve tried investigating what change made this happen, but have so
far failed.  Has anyone happened upon this problem and know of a fix?
I’ve tried running bash under screen and it doesn’t seem to change the
order of PATH and, as far as I can tell, this didn’t occur before I
upgraded to 5.0.2 (from zsh-devel? (which was at 5.0.0?), can’t
remember).


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: PATH reordered when running zsh inside screen on Mac OS X Mountain Lion and MacPorts
  2013-01-28  9:15 PATH reordered when running zsh inside screen on Mac OS X Mountain Lion and MacPorts Nikolai Weibull
@ 2013-01-28  9:33 ` rahul
  2013-01-28 10:08   ` Nikolai Weibull
  2013-01-28  9:58 ` Peter Stephenson
  1 sibling, 1 reply; 10+ messages in thread
From: rahul @ 2013-01-28  9:33 UTC (permalink / raw)
  To: Nikolai Weibull; +Cc: Zsh Users

[-- Attachment #1: Type: text/plain, Size: 1214 bytes --]

On Mon, Jan 28, 2013 at 2:45 PM, Nikolai Weibull <now@bitwi.se> wrote:

> Hi!
>
> For some reason, my PATH is being reordered when running zsh 5.0.2
> inside screen 4.0.3 on Mac OS X Mountain Lion, installed via MacPorts.
>  I’ve tried investigating what change made this happen, but have so
> far failed.  Has anyone happened upon this problem and know of a fix?
> I’ve tried running bash under screen and it doesn’t seem to change the
> order of PATH and, as far as I can tell, this didn’t occur before I
> upgraded to 5.0.2 (from zsh-devel? (which was at 5.0.0?), can’t
> remember).
>

I was having this problem a month or so back while running some scripts
that executed other extermal programs. (I am using latest homebrew zsh in
tmux in Mountain Lion but I think that is immaterial in my case). I can't
remember specifics but I just did some searches in my system. I use
zpresto. It contains a file: runcoms/zshenv which i think is what was
resetting my path. I believe I corrected the order there and now things are
working.

There's a line starting with : path=(
You can search for that in your system and see if this has any relevance to
your problem.
HTH
-- 
 rahul

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: PATH reordered when running zsh inside screen on Mac OS X Mountain Lion and MacPorts
  2013-01-28  9:15 PATH reordered when running zsh inside screen on Mac OS X Mountain Lion and MacPorts Nikolai Weibull
  2013-01-28  9:33 ` rahul
@ 2013-01-28  9:58 ` Peter Stephenson
  1 sibling, 0 replies; 10+ messages in thread
From: Peter Stephenson @ 2013-01-28  9:58 UTC (permalink / raw)
  To: Zsh Users

On Mon, 28 Jan 2013 10:15:39 +0100
Nikolai Weibull <now@bitwi.se> wrote:
> For some reason, my PATH is being reordered when running zsh 5.0.2
> inside screen 4.0.3 on Mac OS X Mountain Lion, installed via MacPorts.

This will be something going on in an initialisation file.  Trace what's
happening by running with -x (possibly using 'script').

pws


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: PATH reordered when running zsh inside screen on Mac OS X Mountain Lion and MacPorts
  2013-01-28  9:33 ` rahul
@ 2013-01-28 10:08   ` Nikolai Weibull
  2013-01-28 20:22     ` Phil Pennock
  2013-01-29  6:21     ` Lawrence Velázquez
  0 siblings, 2 replies; 10+ messages in thread
From: Nikolai Weibull @ 2013-01-28 10:08 UTC (permalink / raw)
  To: rahul; +Cc: Zsh Users

On Mon, Jan 28, 2013 at 10:33 AM, rahul <rahul2012@gmail.com> wrote:
> On Mon, Jan 28, 2013 at 2:45 PM, Nikolai Weibull <now@bitwi.se> wrote:

>> For some reason, my PATH is being reordered when running zsh 5.0.2

> I was having this problem a month or so back
> [...]
> I use zpresto.

I don’t, so it’s not that.

I figured out what the problem was.  /etc/zshenv on Mac OS X Mountain
Lion calls a utility called path_helper.  I for some reason only
checked /etc/profile.  I don’t quite see why MacPort’s zsh checks
/etc/zshenv instead of /opt/local/etc/zshenv (is this hard coded
behavior in Zsh?), but there you go.  Oh, and why /etc/zshenv in Mac
OS X Mountain Lion modifies path in this way is way beyond me.  In my
world, that’d go into /etc/zprofile.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: PATH reordered when running zsh inside screen on Mac OS X Mountain Lion and MacPorts
  2013-01-28 10:08   ` Nikolai Weibull
@ 2013-01-28 20:22     ` Phil Pennock
  2013-01-28 22:44       ` Lawrence Velázquez
  2013-01-29  6:21     ` Lawrence Velázquez
  1 sibling, 1 reply; 10+ messages in thread
From: Phil Pennock @ 2013-01-28 20:22 UTC (permalink / raw)
  To: Nikolai Weibull; +Cc: rahul, Zsh Users

On 2013-01-28 at 11:08 +0100, Nikolai Weibull wrote:
> I figured out what the problem was.  /etc/zshenv on Mac OS X Mountain
> Lion calls a utility called path_helper.  I for some reason only
> checked /etc/profile.  I don’t quite see why MacPort’s zsh checks
> /etc/zshenv instead of /opt/local/etc/zshenv (is this hard coded
> behavior in Zsh?),

No, that's controlled at build configure time by --enable-etcdir and
then each individual global config file can also have its path overriden
to be different.  However, the default is to use /etc/ instead of
$prefix/etc -- presumably because config files for shell start-up have
always been in /etc.

While MacPorts might override it, note that MacOS ships with an older
version of zsh, so using two different config files creates issues.
There's not a "clearly right" answer, "different config" or "same
config" have their pros and cons, but for people trying to minimize the
impact on administrators of users switching shells, with files in /etc/
being maintained by a config management system, using the same files for
the MacPorts build is IMO least likely to cause backlash that gets the
MacPorts version forcibly uninstalled after someone has spent too long
debugging an end-user complaint.

-Phil


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: PATH reordered when running zsh inside screen on Mac OS X Mountain Lion and MacPorts
  2013-01-28 20:22     ` Phil Pennock
@ 2013-01-28 22:44       ` Lawrence Velázquez
  0 siblings, 0 replies; 10+ messages in thread
From: Lawrence Velázquez @ 2013-01-28 22:44 UTC (permalink / raw)
  To: Phil Pennock; +Cc: Nikolai Weibull, rahul, zsh-users

Hi, I'm the MacPorts maintainer for zsh.

On Jan 28, 2013, at 3:22 PM, Phil Pennock <zsh-workers+phil.pennock@spodhuis.org> wrote:

> While MacPorts might override it, note that MacOS ships with an older
> version of zsh, so using two different config files creates issues.
> There's not a "clearly right" answer, "different config" or "same
> config" have their pros and cons, but for people trying to minimize the
> impact on administrators of users switching shells, with files in /etc/
> being maintained by a config management system, using the same files for
> the MacPorts build is IMO least likely to cause backlash that gets the
> MacPorts version forcibly uninstalled after someone has spent too long
> debugging an end-user complaint.

This is precisely my reasoning for not overriding the default setting. It also maintains consistency with the behavior of MacPorts' bash.

vq

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: PATH reordered when running zsh inside screen on Mac OS X Mountain Lion and MacPorts
  2013-01-28 10:08   ` Nikolai Weibull
  2013-01-28 20:22     ` Phil Pennock
@ 2013-01-29  6:21     ` Lawrence Velázquez
  2013-01-29  8:08       ` Lawrence Velázquez
  2013-01-29 11:24       ` Nikolai Weibull
  1 sibling, 2 replies; 10+ messages in thread
From: Lawrence Velázquez @ 2013-01-29  6:21 UTC (permalink / raw)
  To: Nikolai Weibull; +Cc: Zsh Users

On Jan 28, 2013, at 5:08 AM, Nikolai Weibull <now@bitwi.se> wrote:

> I figured out what the problem was.  /etc/zshenv on Mac OS X Mountain Lion calls a utility called path_helper.

The /usr/libexec/path_helper program is used by prior versions of OS X also, albeit implemented differently. (At one point it was a shell script.) Its purpose is to create a default ${PATH} and ${MANPATH} using the contents of /etc/{paths,manpaths} and /etc/{paths,manpaths}.d.

For more details, see the path_helper(8) man page[1]. For way too many details, see the path_helper source code[2].

    [1] https://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man8/path_helper.8.html.
    [2] http://www.opensource.apple.com/source/shell_cmds/shell_cmds-170/path_helper/path_helper.c

> Oh, and why /etc/zshenv in Mac OS X Mountain Lion modifies path in this way is way beyond me.  In my world, that’d go into /etc/zprofile.

I agree that /etc/zprofile would be a better place to set ${PATH}, but you would still run into the issue because terminal multiplexers usually run login shells. I previously encountered it under tmux.

The real problem is that /usr/libexec/path_helper alters ${PATH} even if ${PATH} already contains the entries it wants to add. In this case, it moves the entries to the beginning of ${PATH} instead of just leaving it as is.

> as far as I can tell, this didn’t occur before I upgraded to 5.0.2 (from zsh-devel? (which was at 5.0.0?), can’t remember).

The old zsh-devel port did use --enable-etcdir in its configure phase. For the reason given by Phil, I chose not to carry this over to the zsh port when I assumed maintenance of both and obsoleted zsh-devel.

vq

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: PATH reordered when running zsh inside screen on Mac OS X Mountain Lion and MacPorts
  2013-01-29  6:21     ` Lawrence Velázquez
@ 2013-01-29  8:08       ` Lawrence Velázquez
  2013-01-29 11:25         ` Nikolai Weibull
  2013-01-29 11:24       ` Nikolai Weibull
  1 sibling, 1 reply; 10+ messages in thread
From: Lawrence Velázquez @ 2013-01-29  8:08 UTC (permalink / raw)
  To: Nikolai Weibull; +Cc: zsh-users

BTW, I have submitted bug reports to Apple for both these issues.

On Jan 29, 2013, at 1:21 AM, Lawrence Velázquez <larryv@macports.org> wrote:

> I agree that /etc/zprofile would be a better place to set ${PATH}

rdar://problem/13103029
http://openradar.appspot.com/radar?id=2622401

> The real problem is that /usr/libexec/path_helper alters ${PATH} even if ${PATH} already contains the entries it wants to add. In this case, it moves the entries to the beginning of ${PATH} instead of just leaving it as is.


rdar://problem/13103103
http://openradar.appspot.com/radar?id=2620402

vq

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: PATH reordered when running zsh inside screen on Mac OS X Mountain Lion and MacPorts
  2013-01-29  6:21     ` Lawrence Velázquez
  2013-01-29  8:08       ` Lawrence Velázquez
@ 2013-01-29 11:24       ` Nikolai Weibull
  1 sibling, 0 replies; 10+ messages in thread
From: Nikolai Weibull @ 2013-01-29 11:24 UTC (permalink / raw)
  To: Lawrence Velázquez; +Cc: Zsh Users

On Tue, Jan 29, 2013 at 7:21 AM, Lawrence Velázquez <larryv@macports.org> wrote:
> On Jan 28, 2013, at 5:08 AM, Nikolai Weibull <now@bitwi.se> wrote:

>> I figured out what the problem was.  /etc/zshenv on Mac OS X Mountain Lion calls a utility called path_helper.

> I agree that /etc/zprofile would be a better place to set ${PATH}, but you would still run into the issue because terminal multiplexers usually run login shells. I previously encountered it under tmux.

Not screen, not the way I have it configured, anyway.  Tmux seems to
force logged in terminals.  I guess one could check SHLVL or something
like that.

> The real problem is that /usr/libexec/path_helper alters ${PATH} even if ${PATH} already contains the entries it wants to add. In this case, it moves the entries to the beginning of ${PATH} instead of just leaving it as is.

Yes, precisely.

> The old zsh-devel port did use --enable-etcdir in its configure phase. For the reason given by Phil, I chose not to carry this over to the zsh port when I assumed maintenance of both and obsoleted zsh-devel.

Aha, that explains why it occured only recently.

Thank you for filling in the details!


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: PATH reordered when running zsh inside screen on Mac OS X Mountain Lion and MacPorts
  2013-01-29  8:08       ` Lawrence Velázquez
@ 2013-01-29 11:25         ` Nikolai Weibull
  0 siblings, 0 replies; 10+ messages in thread
From: Nikolai Weibull @ 2013-01-29 11:25 UTC (permalink / raw)
  To: Lawrence Velázquez; +Cc: zsh-users

On Tue, Jan 29, 2013 at 9:08 AM, Lawrence Velázquez <larryv@macports.org> wrote:
> BTW, I have submitted bug reports to Apple for both these issues.
>
> On Jan 29, 2013, at 1:21 AM, Lawrence Velázquez <larryv@macports.org> wrote:
>
>> I agree that /etc/zprofile would be a better place to set ${PATH}
>
> rdar://problem/13103029
> http://openradar.appspot.com/radar?id=2622401

I submitted something similar to http://apple.com/feedback.

>> The real problem is that /usr/libexec/path_helper alters ${PATH} even if ${PATH} already contains the entries it wants to add. In this case, it moves the entries to the beginning of ${PATH} instead of just leaving it as is.

> rdar://problem/13103103
> http://openradar.appspot.com/radar?id=2620402

Great, thanks!


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2013-01-29 12:30 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-28  9:15 PATH reordered when running zsh inside screen on Mac OS X Mountain Lion and MacPorts Nikolai Weibull
2013-01-28  9:33 ` rahul
2013-01-28 10:08   ` Nikolai Weibull
2013-01-28 20:22     ` Phil Pennock
2013-01-28 22:44       ` Lawrence Velázquez
2013-01-29  6:21     ` Lawrence Velázquez
2013-01-29  8:08       ` Lawrence Velázquez
2013-01-29 11:25         ` Nikolai Weibull
2013-01-29 11:24       ` Nikolai Weibull
2013-01-28  9:58 ` Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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 NNTP newsgroup(s).