[MacPorts] #47706: base: postflight.in: Missing check causes duplicate PATH entries when sourcing CONF_FILE
MacPorts
noreply at macports.org
Mon May 11 13:53:04 PDT 2015
#47706: base: postflight.in: Missing check causes duplicate PATH entries when
sourcing CONF_FILE
---------------------------------+--------------------------------
Reporter: anonymous@… | Owner: macports-tickets@…
Type: enhancement | Status: new
Priority: Normal | Milestone:
Component: base | Version: 2.3.3
Keywords: PATH, postflight.in | Port:
---------------------------------+--------------------------------
When sourcing CONF_FILE (in this case ~/.profile) with source ~/.profile,
my PATH variable expands indefinitely, since there is no check if BINPATH
is already in PATH (
https://trac.macports.org/browser/trunk/base/portmgr/dmg/postflight.in#L243
).
My ~/.profile looks like this:
{{{
# MacPorts Installer addition on 2015-01-17_at_00:00:40: adding an
appropriate PATH variable for use with MacPorts.
export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
# Finished adapting your PATH environment variable for use with MacPorts.
}}}
The solution is to check in
https://trac.macports.org/browser/trunk/base/portmgr/dmg/postflight.in#L103
if BINPATH (Part of ${2}) is already in PATH (\$ + ${1}). If so, do not
export it again.
I fixed it in my ~/.profile with this modification (bash):
{{{
# MacPorts Installer addition on 2015-01-17_at_00:00:40: adding an
appropriate PATH variable for use with MacPorts.
[[ ! "$PATH" =~ "/opt/local/bin:/opt/local/sbin" ]] && export
PATH="/opt/local/bin:/opt/local/sbin:$PATH"
# Finished adapting your PATH environment variable for use with MacPorts.
}}}
--
Ticket URL: <https://trac.macports.org/ticket/47706>
MacPorts <https://www.macports.org/>
Ports system for OS X
More information about the macports-tickets
mailing list