"port upgrade" error message usability

Ryan Schmidt ryandesign at macports.org
Sun Jan 30 09:04:43 UTC 2022

On Jan 30, 2022, at 02:24, Andrew Janke wrote:

> Hi, MacPorts developers,
> Long-time Homebrew user and recent MacPorts convert here.

Welcome! I'm interested in your impressions of MacPorts as a Homebrew user and if you have any suggestions for changes we can make to make your MacPorts experience more enjoyable.

> Minor usability issue with the `port` program, I think: I suspect that a common operation for regular MacPorts users to do is "upgrade all my stuff to the latest version".
> I tried doing this with `port selfupdate`; `port upgrade`, and got this error message:
> [~] $ sudo port selfupdate
> --->  Updating MacPorts base sources using rsync
> MacPorts base version 2.7.1 installed,
> MacPorts base version 2.7.1 downloaded.
> --->  Updating the ports tree
> --->  MacPorts base is already the latest version
> The ports tree has been updated. To upgrade your installed ports, you should run
>   port upgrade outdated
> [~] $ sudo port upgrade
> Can't map the URL 'file://.' to a port description file ("Could not find Portfile in /Users/janke").
> Please verify that the directory and portfile syntax are correct.
> To use the current port, you must be in a port's directory.
> [~] $
> I'm a dev with 25 years of coding and sysadmin experience, and I don't know what to do with that error message. I dunno what a regular user is supposed to do with that. (Yes, I saw the "To upgrade your installed ports" output from the selfupdate command, but still.)
> Maybe the error message here could be modified to include a "maybe you meant `port upgrade outdated`" message or something like that? Where's the 'file://'" coming from, anyway? Does `port upgrade` operate on some port definition found in the current working directory by default? I did not provide a URL as an input to the `port upgrade` command, so it's a little unexpected that I got an error complaining about a URL here.

All MacPorts commands operate on a Portfile in the current directory if you don't specify what ports to operate on. The error message when there isn't actually a Portfile in the current directory perhaps isn't the best, though "Could not find Portfile in /Users/janke" isn't too unclear, is it?

There's no reason to suspect that a user who doesn't specify a port meant to specify the pseudoport "outdated". I think it might not necessarily even be known at the time that the list of specified ports is processed which command that set of ports will be handed to.

More information about the macports-dev mailing list