Opened 10 years ago

Last modified 10 years ago

#47706 new enhancement

base: postflight.in: Missing check causes duplicate PATH entries when sourcing CONF_FILE — at Initial Version

Reported by: anonymous@… Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: base Version: 2.3.3
Keywords: Cc:
Port:

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.

Change History (0)

Note: See TracTickets for help on using tickets.