Permalink
Browse files

Error when a port is opened with a nonexistent subport

  • Loading branch information...
1 parent 4573c64 commit 9c48520c7347a84af603ed35ed27a96a42d57838 @jmroot jmroot committed Jul 30, 2017
Showing with 13 additions and 1 deletion.
  1. +13 −1 src/macports1.0/macports.tcl
@@ -1773,7 +1773,19 @@ proc mportopen {porturl {options {}} {variations {}} {nocache {}}} {
$workername eval {port::run_callbacks}
- ditem_key $mport provides [$workername eval {set subport}]
+ set actual_subport [$workername eval {set PortInfo(name)}]
+ if {[$workername eval {info exists user_options(subport)}]} {
+ # The supplied subport may have been set on the command line by the
+ # user, or simply obtained from the PortIndex or registry. Check that
+ # it's valid in case the user made a mistake.
+ set supplied_subport [$workername eval {set user_options(subport)}]
+ if {$supplied_subport ne $actual_subport} {
+ set portname [$workername eval {set name}]
+ mportclose $mport
+ error "$portname does not have a subport '$supplied_subport'"
+ }
+ }
+ ditem_key $mport provides $actual_subport
return $mport
}

0 comments on commit 9c48520

Please sign in to comment.