Opened 17 years ago

Closed 14 years ago

#8763 closed defect (fixed)

duplicate entries in dependency list

Reported by: agentmonkey@… Owned by: jmroot (Joshua Root)
Priority: Normal Milestone: MacPorts 1.7.0
Component: base Version:
Keywords: Cc: nox@…, ryandesign (Ryan Schmidt)
Port:

Description (last modified by jmpp@…)

After going through a few upgrades via "port -a upgrade" I noticed that the upgrades only deactivated older versions of packages. After uninstalling the inactive ports manually (I needed to use -f since inactive ports can still have dependents) I noticed that their entries in the "dependency list" are not removed. For example:

~ $ sudo port installed | grep apr
  apr @1.2.6_0 (active)
  apr-util @1.2.6_0 (active)
-= rom@leviathan =- Sun May 07, 02:00 AM 
~ $

then,

-= rom@leviathan =- Sun May 07, 02:00 AM 
~ $ sudo port uninstall apr
Password:
--->  Unable to uninstall apr 1.2.6_0, the following ports depend on it:
--->    apr-util
--->    apr-util
--->    apr-util
--->    subversion
--->    subversion-javahlbindings
Error: /opt/local/bin/port: port uninstall failed: Please uninstall the ports that depend on apr first.
-= rom@leviathan =- Sun May 07, 02:16 AM 
~ $ 

Notice that apr-util appears three times but in the former command only one apr-util package is shown to be installed (apr-util @1.2.6_0). These "residual" packages are from previous inactive versions (because of upgrades) that were manually uninstalled.

Attachments (3)

no-depmap-dupes.diff (550 bytes) - added by jmroot (Joshua Root) 15 years ago.
proposed fix
regclean.diff (2.4 KB) - added by jmroot (Joshua Root) 15 years ago.
add the 'regclean' target
portdepclean.tcl (492 bytes) - added by jmroot (Joshua Root) 14 years ago.
a simple script to run clean_dep_map

Download all attachments as: .zip

Change History (25)

comment:1 Changed 16 years ago by markd@…

Summary: port uninstall package does not remove entry in dependency list.BUG: 'port uninstall' does not remove entry in dependency list.

comment:2 Changed 16 years ago by pipping@…

Milestone: Port Bugs

comment:3 Changed 16 years ago by pipping@…

Milestone: Port BugsMacPorts 1.4

comment:4 Changed 16 years ago by jmpp@…

Description: modified (diff)

comment:5 Changed 16 years ago by jmpp@…

Milestone: MacPorts 1.4Needs developer review
Owner: changed from macports-tickets@… to macports-dev@…

I'm not entirely sure the repeated entries in that dependents list is due to leftovers in the dependency list (dep_map), could very well be in the port(1) code that builds the list and echo's it to the user. But I'm sure developer review instead of wild guesses would best serve toward fixing this issue, therefore setting this ticket to that milestone ;-)

-jmpp

comment:6 Changed 16 years ago by kballard (Lily Ballard)

The duplicates are definitely in the dep_map. I just checked my own dep_map file on disk and it has duplicates right in there. I can't vouch for the source of the duplicates, but upgrade seems to be a reasonable assumption.

comment:7 Changed 16 years ago by kballard (Lily Ballard)

Ah hah, I've reproduced this issue.

  1. Install port1 and port2, where port2 depends on port1
  2. Upgrade your dports tree such that a new version of port2 is available
  3. Deactivate port2 and install the new version. The default port upgrade behaviour does exactly this.

Now the dep_map contains two entries for port2 depending on port1. At this point, uninstalling port2 does not change the dep map, leaving behind two entries.

Uninstalling all copies of port2 will clean up the dep map, but as long as you have one version of port2 installed at all times, the duplicates will occur.

comment:8 Changed 16 years ago by kballard (Lily Ballard)

D'oh, wiki formatting lied to me. I needed a space before the list items.

  1. Install port1 and port2, where port2 depends on port1
  2. Upgrade your dports tree such that a new version of port2 is available
  3. Deactivate port2 and install the new version. The default port upgrade behaviour does exactly this.

comment:9 Changed 15 years ago by jmpp@…

Milestone: Needs developer reviewMacPorts base bugs

Milestone Needs developer review deleted

comment:10 Changed 15 years ago by nox@…

Priority: ExpectedNormal
Version: 1.2

Is this still relevant?

comment:11 Changed 15 years ago by ryandesign (Ryan Schmidt)

Cc: agentmonkey@… ryandesign@… added

comment:12 Changed 15 years ago by nox@…

Cc: nox@… added
Summary: BUG: 'port uninstall' does not remove entry in dependency list.'port uninstall' does not remove entry in dependency list.

comment:13 Changed 15 years ago by jmroot (Joshua Root)

Cc: jmr@… added; agentmonkey@… removed

The bit of code that is causing this problem is here. The issue is that at that point you don't know which of the multiple versions of the port actually needed a given dependency (since dependencies can change between versions), and hence you don't know whether you can remove the dep map entry.

It would be possible to just trim the supernumerary entries from the dep map, but that would still leave you with spurious entries in cases where dependencies have been dropped from the new port version.

Maybe upgrade should clear the dep map entries for the old version before installing the new version?

Changed 15 years ago by jmroot (Joshua Root)

Attachment: no-depmap-dupes.diff added

proposed fix

comment:14 Changed 15 years ago by jmroot (Joshua Root)

Milestone: MacPorts base bugsMacPorts 1.6.1

Let's just prevent duplicate dep map entries being inserted in the first place. Attached patch implements this. We can make a tool to trim existing duplicates as well if we decide it's too inconvenient for users to remove them by uninstall + reinstall.

Nominating for the upcoming release.

comment:15 Changed 15 years ago by raimue (Rainer Müller)

Things like this should become faster with registry2.0, so just fix it in this slow way for now.

comment:16 Changed 15 years ago by jmroot (Joshua Root)

Summary: 'port uninstall' does not remove entry in dependency list.duplicate entries in dependency list

Committed the patch to trunk in r36745. I'll see about adding a command to clean out existing duplicates.

Changed 15 years ago by jmroot (Joshua Root)

Attachment: regclean.diff added

add the 'regclean' target

comment:17 Changed 15 years ago by jmroot (Joshua Root)

Cc: jmr@… removed
Owner: changed from macports-tickets@… to jmr@…
Status: newassigned

Attached a new patch which adds a 'regclean' target. This will remove all duplicate entries from the dep_map. It appears to do the right thing for me without breaking anything, but back up your dep_map.bz2 just in case. ;-)

comment:18 Changed 15 years ago by raimue (Rainer Müller)

Hm, do we really need a new action for this? I mean, this is a one time issue only. We could as well release some extra script which cleans the registry and only needs to be run one time (announced in the release notes). Or we add this script to postflight/make install in the next release to do it automatically. With the next release this will not happen anymore, so I don't see a reason for a new action.

comment:19 Changed 15 years ago by jmroot (Joshua Root)

Sure, an action isn't necessary if we're going to run the code in postflight and selfupdate. But it's quite convenient for testing purposes. :-)

comment:20 Changed 14 years ago by jmroot (Joshua Root)

Committed the clean_dep_map registry procedure in r39116.

Changed 14 years ago by jmroot (Joshua Root)

Attachment: portdepclean.tcl added

a simple script to run clean_dep_map

comment:21 Changed 14 years ago by jmroot (Joshua Root)

Added a working version of the cleanup script to postflight and make install in r40142. Now all that is needed is for the MacPorts port to be updated to include the script in the .dmg resources.

comment:22 Changed 14 years ago by raimue (Rainer Müller)

Resolution: fixed
Status: assignedclosed

Marking fixed.

Note: See TracTickets for help on using tickets.