On Aug 23, 2019, at 11:58, Bill Cole wrote:

> I'm having apparently initial success from doing a 'port -n upgrade outdated' 
> but that makes me a bit nervous...

It should make you nervous. You probably shouldn't run that unless you know 
exactly why each port is outdated and what rebuilding it will do.

"-n" tells MacPorts not to upgrade dependencies first. But the whole reason why 
a port was updated may be because of changes in one of its dependencies.

Consider: perhaps ImageMagick is updated to a new version. That new version has 
new library versions, which means everything using ImageMagick libraries needs 
to be rebuilt, so their revisions are increased [1], so they show up as 
outdated. If you upgrade one of those ports that depends on ImageMagick (let's 
call it "X") normally using "sudo port upgrade X", MacPorts upgrades 
ImageMagick first, then upgrades port X so that it now links with the new 
library. All is well. But if you instead run "sudo port -n upgrade X", without 
having first upgraded ImageMagick, then port X would rebuild against the old 
libraries, defeating the purpose of the upgrade. Or you might have received a 
binary of the new X from our server, where ImageMagick was upgraded first. Now 
you have a version of X installed that links with versions of the ImageMagick 
libraries newer than the ones you have, which means the program will not work. 
If you have rev-upgrade turned on, MacPorts will detect X as broken and will 
rebuild X, and I forget what happens here: either MacPorts will do a 
from-source build and you'll be left back in the first situation of having 
defeated the purpose of the upgrade, or it will repeatedly download the binary 
from our server, until after a number of attempts it gives up. When you finally 
do upgrade ImageMagick to the new version later, now X and everything else you 
upgraded before while ignoring dependencies will be broken, leading to another 
rev-upgrade cycle.

Not all situations are like that. You mentioned cmake, which is a configuration 
tool. If a program requires cmake to configure, and you have cmake installed, 
even if it's a slightly older version, it's probably alright if you don't 
upgrade it first. cmake is just a program; it doesn't have any libraries that 
other programs use, so library version mismatches aren't a possibility. 
MacPorts doesn't know the specifics of any port, so it assumes that it should 
upgrade all of a port's dependencies first.

So using the "-n" flag when upgrading can be safe in some circumstances, but 
since it can be difficult to figure out whether a particular upgrade matches 
those circumstances, especially since it depends on what other ports are 
outdated on your system which depends on how recently you last upgraded your 
ports, the safest advice is not to use the "-n" flag when upgrading.


[1] Here is an example of that situation: 
https://github.com/macports/macports-ports/pull/5016

Reply via email to