Opened 6 years ago

Closed 3 years ago

Last modified 3 years ago

#56817 closed defect (fixed)

`port activate`: error selecting already active version/variant

Reported by: chrstphrchvz (Christopher Chavez) Owned by: jmroot (Joshua Root)
Priority: Normal Milestone: MacPorts 2.7.0
Component: base Version: 2.5.3
Keywords: Cc:
Port:

Description (last modified by chrstphrchvz (Christopher Chavez))

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

Change History (3)

comment:1 Changed 5 years ago by chrstphrchvz (Christopher Chavez)

Description: modified (diff)
Summary: `port activate`: error selecting already active variant`port activate`: error selecting already active version/variant

comment:2 Changed 3 years ago by jmroot (Joshua Root)

Owner: set to jmroot
Resolution: fixed
Status: newclosed

In 5f41bb41b310d2d4671fbfffbd718ceba9834197/macports-base (master):

Relax activate/deactivate error conditions

Treat activating an already active port and deactivating an already
inactive port as harmless no-ops. Specifying a port or version of a
port that isn't installed is still an error.

Fixes: #56817

comment:3 Changed 3 years ago by jmroot (Joshua Root)

Milestone: MacPorts 2.7.0
Note: See TracTickets for help on using tickets.