[MacPorts] #47706: base: postflight.in: Missing check causes duplicate PATH entries when sourcing CONF_FILE
#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
#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 Resolution: | Keywords: Port: | --------------------------+-------------------------------- Changes (by larryv@…): * keywords: PATH, postflight.in => Old description:
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. }}}
New description: 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 ([[source: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 source: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#comment:1> MacPorts <https://www.macports.org/> Ports system for OS X
#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 Resolution: | Keywords: Port: | --------------------------+-------------------------------- Comment (by ryandesign@…): That's not a bad idea. I might use separate lines for bin and sbin, in case the user has them in a different order for some reason. -- Ticket URL: <https://trac.macports.org/ticket/47706#comment:2> MacPorts <https://www.macports.org/> Ports system for OS X
participants (1)
-
MacPorts