OS X 10.8.2: path_helper alters $PATH even when added dirs are already present

Originator:larry.velazquez
Number:rdar://13103103 Date Originated:28-Jan-2013 11:29 PM
Status:Open Resolved:
Product:Mac OS X Product Version:10.8.2 (12C60)
Classification:Other Bug Reproducible:Always
 
Summary:

The /usr/libexec/path_helper program prepends the appropriate directories to $PATH (i.e., the ones given in /etc/paths and /etc/paths.d), even if those directories are already present in $PATH. If those directories are already in $PATH, there really is no need to add them again.

Steps to Reproduce:

1. Open a new Terminal window or tab.
2. Prepend a directory to $PATH, so it is different from the default one constructed by path_helper. For example, run "export PATH=/usr/local/sbin:$PATH". If your shell's startup files already add directories to $PATH, this step is unnecessary.
3. Run "/usr/libexec/path_helper -s" to display the new $PATH that path_helper constructs.

Expected Results:

Since $PATH already contains all the entries that /usr/libexec/path_helper wants to add, path_helper should not alter it.

Actual Results:

/usr/libexec/path_helper moves all default paths back to the beginning of $PATH. This is unnecessary; path_helper should only append any entries that are missing from the pre-existing $PATH.

Regression:

I do not have older versions of OS X available to check for regressions.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!