Subject: bug#76568: 'package-install' should not install duplicate packages

From: Stefan Monnier <[email-masked]>
Date: Wed, 18 Jun 2025 16:45:55 -0400

[ Sorry for getting here so late.  ]

>> If we decide to disallow multiple side-by-side installs, this becomes moot.
> No, I don't think we should do that for backwards compatibility reasons,
> but it might be worthwhile considering it as something to deprecate at
> some point...

It's not just backward compatibility: multiple installed versions of
the same package is a feature we want to support (we don't support
activating several different versions in the same Emacs session, of
course, but you can have several different sessions activating
different versions of a package).

But, yes, it's a feature that's used very rarely, so we should not let
unsuspecting users fall into this situation.  I have not yet had time
to look very much at the patch, but an optional `allow-multiple` option
seems OK to me.

It might make sense to determine the value of this `allow-multiple` from
within the `interactive` spec: if the package is already installed with
another version, prompt the user to decide whether we should delete the
other version or not and then pass an appropriate `allow-multiple`.

>> Doesn't this still bite us if people use both ELPA devel and ELPA
>> production since they're treated as different archives?  Perhaps we can
>> unify duplicate package detection at least in the core Emacs archives.
> That is true, though I am also of the opinion that end-users ought not
> to use ELPA-devel directly.  In that case, we can at least rely on
> sensible version number handling.

BTW, IIUC this archive issue is actually unrelated except maybe that it
makes the problem easier to reproduce.  AFAIK the multiple-install issue
comes up when the already-installed version is different from the
to-be-installed version.  This can happen also with only
a single archive.

        Stefan