Ticket #12596 (closed defect: fixed)
malformed variants can break registry
| Reported by: | david.reitter@… | Owned by: | mww@… |
|---|---|---|---|
| Priority: | Normal | Milestone: | MacPorts 1.8.0 |
| Component: | base | Version: | 1.5.0 |
| Keywords: | Cc: | eridius@…, jmr@… | |
| Port: |
Description
Beginning with a failed install of gcc43 on my (Intel) Macbook Pro (osx 10.4, current macports), I've been getting this error message when doing various things:
$ sudo port installed Error: port installed failed: list must have an even number of elements No ports are installed.
I have done "sudo port sync", to no avail. "outdated" brings up the same message.
I have also tried to reinstall Macports from the release DMG (I still get the above message), only to discover that this has broken more things (i'll file a bug should i conclude it is one.)
Attachments
Change History
comment:1 Changed 6 years ago by mww@…
- Owner changed from macports-dev@… to mww@…
- Cc eridius@…, mww@… added
- Status changed from new to assigned
comment:2 Changed 6 years ago by david.reitter@…
The following might give you more information. (Looks similar for port -d outdated.)
The problem is that this doesn't just happen when installing gcc43 -- it also seems to be a permanent thing!
sudo port -d installed
DEBUG: list must have an even number of elements
while executing
"array set receipt_$ref $receipt_contents"
(procedure "receipt_flat::open_entry" line 84) invoked from within
"${macports::registry.format}::open_entry $name $version $revision $variants"
(procedure "open_entry" line 4) invoked from within
"open_entry $iname $iversion $irevision $ivariants"
(procedure "registry::installed" line 13) invoked from within
"registry::installed" Error: port installed failed: list must have an even number of elements No ports are installed.
comment:3 Changed 6 years ago by chas@…
i encountered same error. tried installing gcc43 which ended which ended with
DEBUG: installing file: /opt/local/var/macports/software/gcc43/4.3-20070907_0+darwin_8/opt/local/share/man/man1/gcov-mp-4.3.1.gz list must have an even number of elements Warning: the following items did not execute (for gcc43): org.macports.activate Error: Status 1 encountered during processing.
port -d sync does not fix the problem. i still keep getting:
macbook:/opt/local root$ port -d installed
DEBUG: list must have an even number of elements
while executing
"array set receipt_$ref $receipt_contents"
(procedure "receipt_flat::open_entry" line 84)
invoked from within
"${macports::registry.format}::open_entry $name $version $revision $variants"
(procedure "open_entry" line 4)
invoked from within
"open_entry $iname $iversion $irevision $ivariants"
(procedure "registry::installed" line 13)
invoked from within
"registry::installed"
Error: port installed failed: list must have an even number of elements
No ports are installed.
is there something i can do to manually correct this? hopefully something besides rm -rf /opt/local
comment:4 Changed 5 years ago by jmr@…
- Component changed from ports to base
- Milestone set to MacPorts base bugs
comment:6 Changed 5 years ago by chris@…
It is not the same. I do not even have gcc43 installed, and I get the same error, with the same tcl traceback.
comment:7 Changed 5 years ago by jmr@…
#12698 was caused by a malformed variant definition in the gcc43 portfile, so it's possible that other ports could have the same problem.
comment:8 Changed 5 years ago by chris@…
Good error reporting is invaluable. This isn't a fix, but it at least tells you what's causing the problem:
--- base/src/registry1.0/receipt_flat.tcl.orig 2008-10-13 23:34:15.000000000 -0400 +++ base/src/registry1.0/receipt_flat.tcl 2008-10-13 23:43:08.000000000 -0400 @@ -181,7 +181,9 @@
# Remove any line starting with # while {[regexp "(|\n)#.*\n(.*)\$" $receipt_contents match foo receipt_contents]} {}
- array set receipt_$ref $receipt_contents
+ if { [catch {array set receipt_$ref $receipt_contents} rcpterr] } { + error "Malformed package receipt for $name $version $revision $variants: $rcpterr" + }
} else {
# This is old Images format
comment:9 follow-up: ↓ 10 Changed 5 years ago by chris@…
Bah. Check the attachments, and here's a format that's readable:
--- base/src/registry1.0/receipt_flat.tcl.orig 2008-10-13 23:34:15.000000000 -0400
+++ base/src/registry1.0/receipt_flat.tcl 2008-10-13 23:43:08.000000000 -0400
@@ -181,7 +181,9 @@
# Remove any line starting with #
while {[regexp "(^|\n)#.*\n(.*)\$" $receipt_contents match foo receipt_contents]} {}
- array set receipt_$ref $receipt_contents
+ if { [catch {array set receipt_$ref $receipt_contents} rcpterr] } {
+ error "Malformed package receipt for $name $version $revision $variants: $rcpterr"
+ }
} else {
# This is old Images format
Changed 5 years ago by chris@…
- Attachment receipt_flat.tcl.patch added
Error reporting patch for receipt_flat.tcl
comment:10 in reply to: ↑ 9 Changed 5 years ago by chris@…
Replying to chris@…:
A slightly better version, IMHO, as it points out that the problem stems back to a malformed Portfile:
--- base/src/receipt1.0/receipt_flat.tcl.orig 2008-10-13 23:34:15.000000000 -0400
+++ base/src/receipt1.0/receipt_flat.tcl 2008-10-13 23:54:53.000000000 -0400
@@ -181,7 +181,11 @@
# Remove any line starting with #
while {[regexp "(^|\n)#.*\n(.*)\$" $receipt_contents match foo receipt_contents]} {}
- array set receipt_$ref $receipt_contents
+ if { [catch {array set receipt_$ref $receipt_contents} rcpterr] } {
+ puts "Malformed package receipt for $name $version $revision $variants"
+ puts "receipt_contents = '$receipt_contents'"
+ error $rcpterr
+ }
} else {
# This is old Images format
The problem was an extra newline in the Portfile. There's no way I could have figured that out from the original error message.
comment:11 Changed 5 years ago by jmr@…
Patch fails to apply to trunk, even with 'receipt1.0' changed to 'registry1.0'.
comment:12 Changed 4 years ago by toby@…
- Milestone changed from MacPorts base bugs to MacPorts Future
Milestone MacPorts base bugs deleted
comment:13 Changed 4 years ago by jmr@…
- Summary changed from "list must have an even number of elements" to malformed variants can break registry
comment:14 Changed 4 years ago by jmr@…
Applied a modified version of the error reporting patch in r44612. We still need to error out on malformed variants when parsing Portfiles.
comment:15 Changed 4 years ago by jmr@…
- Status changed from assigned to closed
- Resolution set to fixed
- Milestone changed from MacPorts Future to MacPorts 1.8.0
Fixed in r50719.


I get this error, too - when doing livecheck on gcc43 and (on a different machine) when trying to activate gcc43.
Does someone know where this error originates from? (I'd really love to have this one more verbosive)