Opened 21 years ago

Closed 21 years ago

Last modified 21 years ago

#1324 closed defect (fixed)

Port uninstall doesn't work with hyphens in the version

Reported by: pguyot (Paul Guyot) Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: base Version: 1.0
Keywords: Cc:
Port:

Description

Port uninstall doesn't work with hyphens in the port version string. Case to reproduce the bug: Install fortune (current version is 4.6.2-release). Uninstall fortune. Try to install again. Installation will fail. The file /opt/local/var/db/darwinports/receipts/fortune-4.6.2-RELEASE.bz2 is not removed by uninstall.

The bug is actually situated in the poor use of lindex and split that takes only the first bits after the hyphen. I suggest to replace this with a regular expression, although it surely won't work with ports with hyphens in their names (I leave that to DP2, since hyphens in port names will probably break everywhere).

Attachments (4)

portuninstall.tcl.diff (882 bytes) - added by pguyot (Paul Guyot) 21 years ago.
Patch to fix the bug by replacing lindex/split with regsub
portuninstall.tcl.2.diff (802 bytes) - added by pguyot (Paul Guyot) 21 years ago.
Patch to actually do as with exists, i.e. to glob for the version (fixes the problem with hyphens in names)
darwinports.tcl.diff (1.2 KB) - added by pguyot (Paul Guyot) 21 years ago.
Patch to darwinports.tcl to glob for receipts if no port version is provided in delete procedure
darwinports.tcl.2.diff (1.3 KB) - added by pguyot (Paul Guyot) 21 years ago.
Patch to darwinports.tcl to glob for receipts with Will's cleanup

Download all attachments as: .zip

Change History (8)

Changed 21 years ago by pguyot (Paul Guyot)

Attachment: portuninstall.tcl.diff added

Patch to fix the bug by replacing lindex/split with regsub

Changed 21 years ago by pguyot (Paul Guyot)

Attachment: portuninstall.tcl.2.diff added

Patch to actually do as with exists, i.e. to glob for the version (fixes the problem with hyphens in names)

comment:1 Changed 21 years ago by pguyot (Paul Guyot)

attachments.isobsolete: 01

Changed 21 years ago by pguyot (Paul Guyot)

Attachment: darwinports.tcl.diff added

Patch to darwinports.tcl to glob for receipts if no port version is provided in delete procedure

comment:2 Changed 21 years ago by pguyot (Paul Guyot)

Hyphens in port names apparently don't break everywhere (I didn't realize there was that many), so the current patches actually fix the problem for hyphens in the version and hyphens in the name.

The method is different. Since the receipt file is found by globbing in the exists method, it's not really useful to extract the version from this path later to pass it to the delete method. Plus doing so properly would have meant retrieving the path of receipts files (this path can include hyphens or the name of some port). Instead, I extented the delete method to glob for the receipt file to delete, just like exists does.

Please note that default behavior is no longer to consider that version is 1.0. This shouldn't be a problem since if no version is provided, 1.0 receipt will be deleted anyway.

Changed 21 years ago by pguyot (Paul Guyot)

Attachment: darwinports.tcl.2.diff added

Patch to darwinports.tcl to glob for receipts with Will's cleanup

comment:3 Changed 21 years ago by pguyot (Paul Guyot)

attachments.isobsolete: 01

comment:4 Changed 21 years ago by jkh@…

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.