If there are multiple versions or variants of a port installed, using port activate portname
brings up an interactive prompt to select which version and variant to activate. If the one marked (active)
is selected, it exits with an Image error
. However, if there was only one version and variant installed, or if a specific version and variant are specified, there is no prompt and no error, so this behavior is somewhat inconsistent.
As discussed with jmr_mp this morning on IRC:
Sunday, July 15th, 2018 (CDT)
1:35 AM <chrstphrchvz> I notice that activating an already-active port with one variant installed exits without error, but activating an already active variant of a port with multiple variants installed exits *with* an error. Is this right?
4:06 AM <jmr_mp> chrstphrchvz: with or without specifying which one you mean unambiguously?
4:28 AM <chrstphrchvz> jmr_mp, Unambiguously? I'm not sure I understand. To clarify, if I run `port activate portname` and am prompted with a list of installed variants, it will error if I select the one marked `active`
4:43 AM <jmr_mp> chrstphrchvz: ah, interactive mode - yeah that sounds like a bug
4:44 AM if you say 'port activate portname' in a non-interactive context, that's ambiguous when there is more than one version of portname installed, and an error is appropriate
4:45 AM the solution being to say portname @1.0_0+foo or whatever instead
4:49 AM interactive mode gets to resolve the ambiguity with user input, so it shouldn't ever error for that reason
4:49 AM it arguably shouldn't even offer the one that's currently active
4:50 AM although then you might accidentally activate a version you didn't really want active, if it just assumed the inactive one
4:51 AM (in the case where there's only one active and one inactive)
4:57 AM <chrstphrchvz> jmr_mp: ahh, I was missing the `@version`, so that led to the promot. Though it probably is nice for the prompt to indicate which variant is currently active
4:58 AM <jmr_mp> yeah, should probably just be labelled a bit differently
4:58 AM anyway definitely shouldn't error because you selected one of the choices offered
In 5f41bb41b310d2d4671fbfffbd718ceba9834197/macports-base (master):