registry backup (and upgrade --force)
Clemens Lang
cal at macports.org
Sun Apr 3 05:41:06 PDT 2016
Hello,
On Sun, Apr 03, 2016 at 11:31:47AM +0200, René J.V. Bertin wrote:
> Subsequent port commands hung without even a line of debug output,
> which I finally presumed due to registry corruption.
How did you presume that? Are you sure your assumption is correct?
> 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.
That would still leave a time window where your registry doesn't match
what's on disk. You wouldn't loose all data, but your data would now be
faulty. I'd argue that's not much of an improvement.
We do, however, have signal handling code on trunk that should
gracefully handle interruptions in the critical phases that touch the
registry and avoid these problems in the future. Until then:
Interrupting MacPorts during activation/deactivation isn't safe. Don't
do it.
> I don't know if there's a way to check an sqlite3 db's integrity
> without handing
There is a way to check a sqlite3 database's integrity.
> but if it is, an existing backup could be used to replace a corrupt
> registry more or less transparently.
Only if the contents are the same, which isn't the case in general when
the backup is a day old. Doing this kind of recovery automatically would
silently introduce corrupted data -- a very bad idea.
> 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?
I agree, upgrade --force should imply only rebuilding the given ports. A
patch would be nice.
--
Clemens
More information about the macports-dev
mailing list