Opened 10 years ago

Closed 4 years ago

Last modified 4 years ago

#43749 closed defect (duplicate)

Macports install: keep repeating in .profile...

Reported by: jul_bsd@… Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: base Version:
Keywords: Cc: larryv (Lawrence Velázquez), mkae (Marko Käning), 1-61803
Port:

Description

I just notice:

$ ls -l .profile*
-rw-r--r--  1 myuser  staff  1351 17 mai 21:39 .profile
-rw-r--r--  1 myuser  staff   241 10 déc 05:57 .profile.macports-saved_2014-03-02_at_22:22:53 
-rw-r--r--  1 myuser  staff   611  2 mar 22:22 .profile.macports-saved_2014-03-23_at_12:16:49
-rw-r--r--  1 myuser  staff   981 23 mar 12:16 .profile.macports-saved_2014-05-17_at_21:39:03

and .profile

# MacPorts Installer addition on 2013-12-10_at_11:57:29: 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.


##
# Your previous /Users/my-user/.profile file was backed up as /Users/my-user/.profile.macports-saved_2014-03-02_at_22:22:53
##

# MacPorts Installer addition on 2014-03-02_at_22:22:53: 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.


##
# Your previous /Users/my-user/.profile file was backed up as /Users/my-user/.profile.macports-saved_2014-03-23_at_12:16:49
##

# MacPorts Installer addition on 2014-03-23_at_12:16:49: 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.
##
# Your previous /Users/my-user/.profile file was backed up as /Users/my-user/.profile.macports-saved_2014-05-17_at_21:39:03
##

# MacPorts Installer addition on 2014-05-17_at_21:39:03: 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.

Maybe if an appropriate chained is already present, no need to further write more .profile ... Also it can be in .bash_profile or any user file, so ... or is it the official way to keep base install history ;-) ?

Change History (10)

comment:1 Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

The code that adds to your shell startup file only runs when you run the package installer downloaded from our web site. You should normally only need to do that once; thereafter you can use "sudo port selfupdate", unless your network does not allow rsync traffic.

The code that adds to your shell startup file knows about the different shell startup files that are used by bash and tcsh and tries to pick the best one to modify. Also, it does not modify the file if the MacPorts prefix is already in your PATH. So perhaps in your case you have multiple shell startup files, and MacPorts has picked the wrong one, and it's therefore not actually getting into your environment, and therefore MacPorts keeps trying to modify the file again?

If you can suggest any improvement to the code that does this, please do.

comment:2 in reply to:  1 Changed 8 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to ryandesign@…:

The code that adds to your shell startup file knows about the different shell startup files that are used by bash and tcsh and tries to pick the best one to modify. Also, it does not modify the file if the MacPorts prefix is already in your PATH. So perhaps in your case you have multiple shell startup files, and MacPorts has picked the wrong one, and it's therefore not actually getting into your environment, and therefore MacPorts keeps trying to modify the file again?

I was mistaken; this problem happened to me too when reinstalling MacPorts on one of our buildbot builders (running El Capitan). The part of the script that's supposed to detect if PATH already contains the MacPorts prefix doesn't seem to be working. I haven't checked if this is because of changes in OS X or changes in the script. The part of the script that detects MANPATH and DISPLAY seems to be working fine.

comment:3 Changed 7 years ago by neverpanic (Clemens Lang)

r154110 fixes a part of this that will eventually cause the strings to not appear twice. Finding out why our check for the presence of ${PREFIX} in $PATH doesn't work correctly is still open. We should try

SHELL=/usr/bin/dscl . -read "/Users/${USER}" shell | awk -F'/' '{print $NF}'
$SHELL $LOGIN_FLAG -c '/usr/bin/printenv PATH' | grep "${PREFIX}"

on as many machines possible, especially those where we see it end up twice.

comment:4 Changed 7 years ago by larryv (Lawrence Velázquez)

Cc: larryv added

comment:5 Changed 7 years ago by raimue (Rainer Müller)

Milestone: MacPorts 2.3.5

comment:6 Changed 7 years ago by mkae (Marko Käning)

Cc: mkae added

comment:7 Changed 7 years ago by jmroot (Joshua Root)

Milestone: MacPorts 2.3.5MacPorts Future

comment:8 Changed 7 years ago by 1-61803

Cc: 1-61803 added

comment:9 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

Resolution: duplicate
Status: newclosed

Duplicate of #34841.

comment:10 Changed 4 years ago by jmroot (Joshua Root)

Milestone: MacPorts Future
Note: See TracTickets for help on using tickets.