non-privileged `port search` can update the registry db but I have to use sudo to install/activate ports?

René J.V. Bertin rjvbertin at gmail.com
Fri Aug 9 19:42:11 UTC 2024


Hi,

I think I already posted about my idea to have a port:MacPorts-devel and port:MacPorts-altdevel, where the former installs into /opt/local and the latter into /alt/local. The idea is that I can have the latter actually installed in my main MacPorts install, and then install former in the /alt/local install to update the main install ... after having tested the /alt/local install.

Anyway, I just did my first `port install MacPorts-altdevel`. I then had a brain fart: I copied my existing macports.conf and sources.conf into /alt/local/etc/macports, FORGOT TO EDIT THEM and ran `/alt/local/bin/port search "*"` just to see if that worked. Note the absence of `sudo`.

It did, but when I then did `port installed` (i.e. invoking my main port driver command), I got an error:

Version number in metadata table is newer than expected.

My registry.db file had indeed been modified according to the mod.date ... which in itself is not a mystery as I'm a member of the admin group and the registry db file belongs to that group and is group-writeable. 

FORTUNATELY I had sqlitebrowser installed and downgrading the version tag in the metadata FORTUNATELY restored full functionality of my main install. Good thing that I started by trying a command that (supposedly/hopefully) has little reason to do anything else to the registry that would make it backwards incompatible!

But what I don't get is how I need to use `sudo` to make any changes to my install. Long ago I had things set up so my admin privileges were enough, and if memory serves me well  the only thing I did to revert from that was to change the ownership /opt/local/var/macports (and family) back to root. Am I forgetting something?

What are the "official" ownership and permissions on the registry (directory and the .db file)?

Finally, a suggestion: guide.macports.org doesn't seem to say anything about how the registry.db file has to be created by a first command to be run as root, in case you install from sources and have no reason to run `port sync` or `port selfupdate` .

R.


More information about the macports-dev mailing list