Uninstall not updating state file

Rainer Müller raimue at macports.org
Sat Jul 18 06:06:34 PDT 2009


On 2009-07-18 05:36 , Mike Alexander wrote:
> Using macports from SVN version r53993, which is pretty much up to 
> date, I get an error if I do
> 
> port uninstall foo
> port install foo
> 
> where foo is any installed port.  The error is
> 
> Error: Target org.macports.activate returned: Registry error: foo 
> x.y.z_w not registered as installed.

To reproduce this you either have to set "portautoclean no" in
macports.conf or use 'port -k' so that the work directory is not being
removed.

> This correct, but irrelevant.  The problem is that the line "target: 
> org.macports.install" is not being removed from the .macports.foo.state 
> file by uninstall.  Did this ever work?  I think I remember it working 
> at some time in the past, but I can't find any place in the macports 
> source where it tries to remove that line, either in r53993 or r51337 
> which is the last version I used much.  Does anyone have any idea where 
> to look for the bug?

Indeed, this is a bug. It does work as expected with 1.7, but not on
trunk. Thanks for the report.

The problem is that no phase gets removed from the state file at all,
just the next phase will be appended at the end. In 1.7 the install
phase is not recorded to the state file. On trunk it will get recorded,
introduced by me in r49491 [1].

My reasoning was that install has to match previously selected variants,
otherwise you can get unexpected results.
For example:
  port destroot
  port install +foo
That would result in a normal build, but install with different variants
although they have not been compiled in. So we have to check that the
variants passed to install match the variants previously used.

There has been another very old bug in the variants compare code which I
just fixed in r54002 [2].

Probably we need an exception in the code that install should not be
recorded although it needs state checking for variants?

Rainer

[1] http://trac.macports.org/changeset/49491
[2] http://trac.macports.org/changeset/54002


More information about the macports-dev mailing list