Strange Behavior

Jeremy Lavergne jeremy at
Wed Dec 21 06:24:08 PST 2011

> This code is in opIntersection in base/src/port/port.tcl [1]. First, it
> creates a map from the port names to the list index in $b. If a port
> appears multiple times in this list, the last index is stored in the
> array. This is clearly wrong as we would want to keep the first entry.

I'd recommend we simply do a check before [re]setting the port in the array:

if {[lempty [array get port $bitem]]} {

lempty returns 1 if we get an empty list of matches back.

array get returns a list containing pairs of elements (using string
match). If the array contains no elements then an empty list is returned.

More information about the macports-dev mailing list