registry backup (and upgrade --force)
René J.V. Bertin
rjvbertin at gmail.com
Sun Apr 3 02:31:47 PDT 2016
Hi,
I just went through a bit of a hairy exercise. With a bit too much distraction and hurry going on I did a `port upgrade --force` of a port I'd just rebuilt from source so I forgot both the -s and the (crucial) -n options. Seeing the resulting "reinstall all dependencies" begin to happen, I hit ^C, but not before I had already replaced my libiconv with an apparently incompatible binary package.
Subsequent port commands hung without even a line of debug output, which I finally presumed due to registry corruption. There was no backup in var/macports/registry, but fortunately I had an up-to-date copy in my previous TM backup (evidently the Latest backup already contained the corrupted file).
I think something like this already came up not that long ago: wouldn't it be possible and wise to keep a backup of the registry.db file, possibly compressed? The file does become quite large, so making a compressed copy before every operation that changes the file (or after every successful change) might be too costly, but the compression could be handled "offline" by a launchctl script.
I don't know if there's a way to check an sqlite3 db's integrity without handing but if it is, an existing backup could be used to replace a corrupt registry more or less transparently. The restoration process I went through is definitely not something I'd like to have to explain to a casual MacPorts user.
In addition, what do you think of using the existing prompting mechanisms to warn the user that `upgrade --force` without -n will reinstall not only the requested port(s) but all its/their dependencies? It's not the first time I've been bitten by that peculiarity which I continue to find somewhat unexpected. I'm sure there's a use case for being this exhaustive, but does it have to be the default behaviour?
R.
More information about the macports-dev
mailing list